add libelf and libdwarf for potential fun times. none of the elf examples were working for me so i didnt even get a chance to test dwarf, but i dont think the problem is with the libs

This commit is contained in:
zeromus 2010-04-29 20:12:21 +00:00
parent 8c4d4bb3a1
commit dae6fcbd0f
58 changed files with 11615 additions and 582 deletions

View File

@ -81,7 +81,7 @@
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="directx-win32-ddraw-dinput8-dsound-dxerr8-dxguid.lib glib-vc8-Win32.lib lua-vc8-Win32-debug.lib 7z-vc8-Win32.lib zlib-vc8-Win32.lib agg-2.5.lib vfw32.lib winmm.lib opengl32.lib glu32.lib ws2_32.lib user32.lib gdi32.lib shell32.lib comdlg32.lib shlwapi.lib Rpcrt4.lib"
AdditionalDependencies="directx-win32-ddraw-dinput8-dsound-dxerr8-dxguid.lib libelf_libdwarf-vc8-Win32.lib glib-vc8-Win32.lib lua-vc8-Win32-debug.lib 7z-vc8-Win32.lib zlib-vc8-Win32.lib agg-2.5.lib vfw32.lib winmm.lib opengl32.lib glu32.lib ws2_32.lib user32.lib gdi32.lib shell32.lib comdlg32.lib shlwapi.lib Rpcrt4.lib"
OutputFile="$(OutDir)\$(ProjectName)_debug.exe"
AdditionalLibraryDirectories=".\zlib123;agg;.libs"
IgnoreDefaultLibraryNames="LIBCPMT"
@ -115,204 +115,6 @@
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)\__bins"
IntermediateDirectory="$(SolutionDir)\.VS2005\$(ConfigurationName)\$(PlatformName)"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
CommandLine="defaultconfig\SubWCRev.bat"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="MASM"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="2"
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
OmitFramePointers="true"
EnableFiberSafeOptimizations="true"
WholeProgramOptimization="true"
AdditionalIncludeDirectories=".;..;lua\include;&quot;glib-2.20.1\build&quot;;&quot;glib-2.20.1\build\glib&quot;;.\zlib123;.\zziplib;.\winpcap;userconfig;defaultconfig;.\7z;.\agg\include;.\agg\examples;.\wx\include"
PreprocessorDefinitions="_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;GLIB_STATIC_COMPILATION;WIN32;HAVE_LIBZ;NOMINMAX;NDEBUG;RELEASE;_WIN32_WINNT=0x0501"
StringPooling="true"
ExceptionHandling="1"
BasicRuntimeChecks="0"
StructMemberAlignment="0"
BufferSecurityCheck="false"
EnableFunctionLevelLinking="false"
EnableEnhancedInstructionSet="2"
FloatingPointModel="2"
RuntimeTypeInfo="false"
WarningLevel="1"
DebugInformationFormat="3"
CallingConvention="0"
CompileAs="0"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="directx-win32-ddraw-dinput8-dsound-dxerr8-dxguid.lib lua-vc8-Win32.lib glib-vc8-Win32.lib 7z-vc8-Win32.lib zlib-vc8-Win32.lib agg-2.5.lib vfw32.lib winmm.lib opengl32.lib glu32.lib ws2_32.lib user32.lib gdi32.lib shell32.lib comdlg32.lib shlwapi.lib Rpcrt4.lib"
OutputFile="$(OutDir)\$(ProjectName)_release.exe"
AdditionalLibraryDirectories=".\zlib123;agg;.libs"
GenerateDebugInformation="true"
GenerateMapFile="true"
EnableCOMDATFolding="0"
OptimizeForWindows98="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
AdditionalManifestFiles="DeSmuME_x86.manifest"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release FastBuild|Win32"
OutputDirectory="$(SolutionDir)\__bins"
IntermediateDirectory="$(SolutionDir)\.VS2005\$(ConfigurationName)\$(PlatformName)"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
WholeProgramOptimization="0"
>
<Tool
Name="VCPreBuildEventTool"
CommandLine="defaultconfig\SubWCRev.bat"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="MASM"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/MP3"
Optimization="2"
InlineFunctionExpansion="2"
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
OmitFramePointers="true"
EnableFiberSafeOptimizations="true"
WholeProgramOptimization="false"
AdditionalIncludeDirectories=".;..;lua\include;&quot;glib-2.20.1\build&quot;;&quot;glib-2.20.1\build\glib&quot;;.\zlib123;.\zziplib;.\winpcap;userconfig;defaultconfig;.\7z;.\agg\include;.\agg\examples;.\wx\include"
PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;GLIB_STATIC_COMPILATION;WIN32;HAVE_LIBZ;NOMINMAX;NDEBUG;RELEASE;_WIN32_WINNT=0x0501;FASTBUILD"
StringPooling="true"
ExceptionHandling="1"
BasicRuntimeChecks="0"
StructMemberAlignment="0"
BufferSecurityCheck="false"
EnableFunctionLevelLinking="false"
EnableEnhancedInstructionSet="2"
FloatingPointModel="2"
RuntimeTypeInfo="false"
WarningLevel="3"
WarnAsError="false"
DebugInformationFormat="3"
CallingConvention="0"
CompileAs="0"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="directx-win32-ddraw-dinput8-dsound-dxerr8-dxguid.lib lua-vc8-Win32.lib glib-vc8-Win32.lib 7z-vc8-Win32.lib zlib-vc8-Win32.lib agg-2.5.lib vfw32.lib winmm.lib comctl32.lib opengl32.lib glu32.lib ws2_32.lib user32.lib gdi32.lib shell32.lib comdlg32.lib shlwapi.lib Rpcrt4.lib"
OutputFile="$(OutDir)\$(ProjectName)_releaseFastBuild.exe"
AdditionalLibraryDirectories=".\zlib123;agg;.libs"
GenerateDebugInformation="true"
GenerateMapFile="true"
OptimizeReferences="2"
EnableCOMDATFolding="0"
OptimizeForWindows98="1"
LinkTimeCodeGeneration="0"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
AdditionalManifestFiles="DeSmuME_x86.manifest"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug|x64"
OutputDirectory="$(SolutionDir)\__bins"
@ -406,6 +208,103 @@
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)\__bins"
IntermediateDirectory="$(SolutionDir)\.VS2005\$(ConfigurationName)\$(PlatformName)"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
CommandLine="defaultconfig\SubWCRev.bat"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="MASM"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="2"
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
OmitFramePointers="true"
EnableFiberSafeOptimizations="true"
WholeProgramOptimization="true"
AdditionalIncludeDirectories=".;..;lua\include;&quot;glib-2.20.1\build&quot;;&quot;glib-2.20.1\build\glib&quot;;.\zlib123;.\zziplib;.\winpcap;userconfig;defaultconfig;.\7z;.\agg\include;.\agg\examples;.\wx\include"
PreprocessorDefinitions="_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;GLIB_STATIC_COMPILATION;WIN32;HAVE_LIBZ;NOMINMAX;NDEBUG;RELEASE;_WIN32_WINNT=0x0501"
StringPooling="true"
ExceptionHandling="1"
BasicRuntimeChecks="0"
StructMemberAlignment="0"
BufferSecurityCheck="false"
EnableFunctionLevelLinking="false"
EnableEnhancedInstructionSet="2"
FloatingPointModel="2"
RuntimeTypeInfo="false"
WarningLevel="1"
DebugInformationFormat="3"
CallingConvention="0"
CompileAs="0"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="directx-win32-ddraw-dinput8-dsound-dxerr8-dxguid.lib libelf-vc8-Win32.lib lua-vc8-Win32.lib glib-vc8-Win32.lib 7z-vc8-Win32.lib zlib-vc8-Win32.lib agg-2.5.lib vfw32.lib winmm.lib opengl32.lib glu32.lib ws2_32.lib user32.lib gdi32.lib shell32.lib comdlg32.lib shlwapi.lib Rpcrt4.lib"
OutputFile="$(OutDir)\$(ProjectName)_release.exe"
AdditionalLibraryDirectories=".\zlib123;agg;.libs"
GenerateDebugInformation="true"
GenerateMapFile="true"
EnableCOMDATFolding="0"
OptimizeForWindows98="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
AdditionalManifestFiles="DeSmuME_x86.manifest"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|x64"
OutputDirectory="$(SolutionDir)\__bins"
@ -505,6 +404,107 @@
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release FastBuild|Win32"
OutputDirectory="$(SolutionDir)\__bins"
IntermediateDirectory="$(SolutionDir)\.VS2005\$(ConfigurationName)\$(PlatformName)"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
WholeProgramOptimization="0"
>
<Tool
Name="VCPreBuildEventTool"
CommandLine="defaultconfig\SubWCRev.bat"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="MASM"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/MP3"
Optimization="2"
InlineFunctionExpansion="2"
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
OmitFramePointers="true"
EnableFiberSafeOptimizations="true"
WholeProgramOptimization="false"
AdditionalIncludeDirectories=".;..;lua\include;&quot;glib-2.20.1\build&quot;;&quot;glib-2.20.1\build\glib&quot;;.\zlib123;.\zziplib;.\winpcap;userconfig;defaultconfig;.\7z;.\agg\include;.\agg\examples;.\wx\include"
PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;GLIB_STATIC_COMPILATION;WIN32;HAVE_LIBZ;NOMINMAX;NDEBUG;RELEASE;_WIN32_WINNT=0x0501;FASTBUILD"
StringPooling="true"
ExceptionHandling="1"
BasicRuntimeChecks="0"
StructMemberAlignment="0"
BufferSecurityCheck="false"
EnableFunctionLevelLinking="false"
EnableEnhancedInstructionSet="2"
FloatingPointModel="2"
RuntimeTypeInfo="false"
WarningLevel="3"
WarnAsError="false"
DebugInformationFormat="3"
CallingConvention="0"
CompileAs="0"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="directx-win32-ddraw-dinput8-dsound-dxerr8-dxguid.lib libelf-vc8-Win32.lib lua-vc8-Win32.lib glib-vc8-Win32.lib 7z-vc8-Win32.lib zlib-vc8-Win32.lib agg-2.5.lib vfw32.lib winmm.lib comctl32.lib opengl32.lib glu32.lib ws2_32.lib user32.lib gdi32.lib shell32.lib comdlg32.lib shlwapi.lib Rpcrt4.lib"
OutputFile="$(OutDir)\$(ProjectName)_releaseFastBuild.exe"
AdditionalLibraryDirectories=".\zlib123;agg;.libs"
GenerateDebugInformation="true"
GenerateMapFile="true"
OptimizeReferences="2"
EnableCOMDATFolding="0"
OptimizeForWindows98="1"
LinkTimeCodeGeneration="0"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
AdditionalManifestFiles="DeSmuME_x86.manifest"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release FastBuild|x64"
OutputDirectory="$(SolutionDir)\__bins"
@ -974,26 +974,6 @@
Outputs=".libs\7z.tag"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCustomBuildTool"
CommandLine="un7z_and_touch.bat 7z\7z.7z .libs\7z*&#x0D;&#x0A;"
AdditionalDependencies="7z.exe;un7z_and_touch.bat"
Outputs=".libs\7z.tag"
/>
</FileConfiguration>
<FileConfiguration
Name="Release FastBuild|Win32"
>
<Tool
Name="VCCustomBuildTool"
CommandLine="un7z_and_touch.bat 7z\7z.7z .libs\7z*&#x0D;&#x0A;"
AdditionalDependencies="7z.exe;un7z_and_touch.bat"
Outputs=".libs\7z.tag"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
>
@ -1004,6 +984,16 @@
Outputs=".libs\7z.tag"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCustomBuildTool"
CommandLine="un7z_and_touch.bat 7z\7z.7z .libs\7z*&#x0D;&#x0A;"
AdditionalDependencies="7z.exe;un7z_and_touch.bat"
Outputs=".libs\7z.tag"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
>
@ -1014,6 +1004,16 @@
Outputs=".libs\7z.tag"
/>
</FileConfiguration>
<FileConfiguration
Name="Release FastBuild|Win32"
>
<Tool
Name="VCCustomBuildTool"
CommandLine="un7z_and_touch.bat 7z\7z.7z .libs\7z*&#x0D;&#x0A;"
AdditionalDependencies="7z.exe;un7z_and_touch.bat"
Outputs=".libs\7z.tag"
/>
</FileConfiguration>
<FileConfiguration
Name="Release FastBuild|x64"
>
@ -1038,26 +1038,6 @@
Outputs=".libs\directx.tag"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCustomBuildTool"
CommandLine="un7z_and_touch.bat directx\directx.7z .libs\directx*&#x0D;&#x0A;"
AdditionalDependencies="7z.exe;un7z_and_touch.bat"
Outputs=".libs\directx.tag"
/>
</FileConfiguration>
<FileConfiguration
Name="Release FastBuild|Win32"
>
<Tool
Name="VCCustomBuildTool"
CommandLine="un7z_and_touch.bat directx\directx.7z .libs\directx*&#x0D;&#x0A;"
AdditionalDependencies="7z.exe;un7z_and_touch.bat"
Outputs=".libs\directx.tag"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
>
@ -1068,6 +1048,16 @@
Outputs=".libs\directx.tag"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCustomBuildTool"
CommandLine="un7z_and_touch.bat directx\directx.7z .libs\directx*&#x0D;&#x0A;"
AdditionalDependencies="7z.exe;un7z_and_touch.bat"
Outputs=".libs\directx.tag"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
>
@ -1078,6 +1068,16 @@
Outputs=".libs\directx.tag"
/>
</FileConfiguration>
<FileConfiguration
Name="Release FastBuild|Win32"
>
<Tool
Name="VCCustomBuildTool"
CommandLine="un7z_and_touch.bat directx\directx.7z .libs\directx*&#x0D;&#x0A;"
AdditionalDependencies="7z.exe;un7z_and_touch.bat"
Outputs=".libs\directx.tag"
/>
</FileConfiguration>
<FileConfiguration
Name="Release FastBuild|x64"
>
@ -1102,26 +1102,6 @@
Outputs=".libs\glib-vc8.tag"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCustomBuildTool"
CommandLine="un7z_and_touch.bat glib-2.20.1\glib-2.20.1.7z .libs\glib*&#x0D;&#x0A;"
AdditionalDependencies="7z.exe;un7z_and_touch.bat"
Outputs=".libs\glib-vc8.tag"
/>
</FileConfiguration>
<FileConfiguration
Name="Release FastBuild|Win32"
>
<Tool
Name="VCCustomBuildTool"
CommandLine="un7z_and_touch.bat glib-2.20.1\glib-2.20.1.7z .libs\glib*&#x0D;&#x0A;"
AdditionalDependencies="7z.exe;un7z_and_touch.bat"
Outputs=".libs\glib-vc8.tag"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
>
@ -1132,6 +1112,16 @@
Outputs=".libs\glib-vc8.tag"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCustomBuildTool"
CommandLine="un7z_and_touch.bat glib-2.20.1\glib-2.20.1.7z .libs\glib*&#x0D;&#x0A;"
AdditionalDependencies="7z.exe;un7z_and_touch.bat"
Outputs=".libs\glib-vc8.tag"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
>
@ -1142,6 +1132,16 @@
Outputs=".libs\glib-vc8.tag"
/>
</FileConfiguration>
<FileConfiguration
Name="Release FastBuild|Win32"
>
<Tool
Name="VCCustomBuildTool"
CommandLine="un7z_and_touch.bat glib-2.20.1\glib-2.20.1.7z .libs\glib*&#x0D;&#x0A;"
AdditionalDependencies="7z.exe;un7z_and_touch.bat"
Outputs=".libs\glib-vc8.tag"
/>
</FileConfiguration>
<FileConfiguration
Name="Release FastBuild|x64"
>
@ -1154,16 +1154,26 @@
</FileConfiguration>
</File>
<File
RelativePath=".\lua\lua.7z"
RelativePath=".\libelf_libdwarf\libelf_libdwarf.7z"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCustomBuildTool"
CommandLine="un7z_and_touch.bat lua\lua.7z .libs\lua*&#x0D;&#x0A;"
CommandLine="un7z_and_touch.bat libelf_libdwarf\libelf_libdwarf.7z .libs\libelf_libdwarf*"
AdditionalDependencies="7z.exe;un7z_and_touch.bat"
Outputs=".libs\lua.tag"
Outputs=".libs\libelf_libdwarf.tag"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
>
<Tool
Name="VCCustomBuildTool"
CommandLine="un7z_and_touch.bat libelf_libdwarf\libelf_libdwarf.7z .libs\libelf_libdwarf*"
AdditionalDependencies="7z.exe;un7z_and_touch.bat"
Outputs=".libs\libelf_libdwarf.tag"
/>
</FileConfiguration>
<FileConfiguration
@ -1171,14 +1181,48 @@
>
<Tool
Name="VCCustomBuildTool"
CommandLine="un7z_and_touch.bat lua\lua.7z .libs\lua*&#x0D;&#x0A;"
CommandLine="un7z_and_touch.bat libelf_libdwarf\libelf_libdwarf.7z .libs\libelf_libdwarf*"
AdditionalDependencies="7z.exe;un7z_and_touch.bat"
Outputs=".libs\lua.tag"
Outputs=".libs\libelf_libdwarf.tag"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
>
<Tool
Name="VCCustomBuildTool"
CommandLine="un7z_and_touch.bat libelf_libdwarf\libelf_libdwarf.7z .libs\libelf_libdwarf*"
AdditionalDependencies="7z.exe;un7z_and_touch.bat"
Outputs=".libs\libelf_libdwarf.tag"
/>
</FileConfiguration>
<FileConfiguration
Name="Release FastBuild|Win32"
>
<Tool
Name="VCCustomBuildTool"
CommandLine="un7z_and_touch.bat libelf_libdwarf\libelf_libdwarf.7z .libs\libelf_libdwarf*"
AdditionalDependencies="7z.exe;un7z_and_touch.bat"
Outputs=".libs\libelf_libdwarf.tag"
/>
</FileConfiguration>
<FileConfiguration
Name="Release FastBuild|x64"
>
<Tool
Name="VCCustomBuildTool"
CommandLine="un7z_and_touch.bat libelf_libdwarf\libelf_libdwarf.7z .libs\libelf_libdwarf*"
AdditionalDependencies="7z.exe;un7z_and_touch.bat"
Outputs=".libs\libelf_libdwarf.tag"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\lua\lua.7z"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCustomBuildTool"
CommandLine="un7z_and_touch.bat lua\lua.7z .libs\lua*&#x0D;&#x0A;"
@ -1196,6 +1240,16 @@
Outputs=".libs\lua.tag"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCustomBuildTool"
CommandLine="un7z_and_touch.bat lua\lua.7z .libs\lua*&#x0D;&#x0A;"
AdditionalDependencies="7z.exe;un7z_and_touch.bat"
Outputs=".libs\lua.tag"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
>
@ -1206,6 +1260,16 @@
Outputs=".libs\lua.tag"
/>
</FileConfiguration>
<FileConfiguration
Name="Release FastBuild|Win32"
>
<Tool
Name="VCCustomBuildTool"
CommandLine="un7z_and_touch.bat lua\lua.7z .libs\lua*&#x0D;&#x0A;"
AdditionalDependencies="7z.exe;un7z_and_touch.bat"
Outputs=".libs\lua.tag"
/>
</FileConfiguration>
<FileConfiguration
Name="Release FastBuild|x64"
>
@ -1230,26 +1294,6 @@
Outputs=".libs\wx.tag"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCustomBuildTool"
CommandLine="un7z_and_touch.bat wx\wx.7z .libs\wx*&#x0D;&#x0A;"
AdditionalDependencies="7z.exe;un7z_and_touch.bat"
Outputs=".libs\wx.tag"
/>
</FileConfiguration>
<FileConfiguration
Name="Release FastBuild|Win32"
>
<Tool
Name="VCCustomBuildTool"
CommandLine="un7z_and_touch.bat wx\wx.7z .libs\wx*&#x0D;&#x0A;"
AdditionalDependencies="7z.exe;un7z_and_touch.bat"
Outputs=".libs\wx.tag"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
>
@ -1260,6 +1304,16 @@
Outputs=".libs\wx.tag"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCustomBuildTool"
CommandLine="un7z_and_touch.bat wx\wx.7z .libs\wx*&#x0D;&#x0A;"
AdditionalDependencies="7z.exe;un7z_and_touch.bat"
Outputs=".libs\wx.tag"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
>
@ -1270,6 +1324,16 @@
Outputs=".libs\wx.tag"
/>
</FileConfiguration>
<FileConfiguration
Name="Release FastBuild|Win32"
>
<Tool
Name="VCCustomBuildTool"
CommandLine="un7z_and_touch.bat wx\wx.7z .libs\wx*&#x0D;&#x0A;"
AdditionalDependencies="7z.exe;un7z_and_touch.bat"
Outputs=".libs\wx.tag"
/>
</FileConfiguration>
<FileConfiguration
Name="Release FastBuild|x64"
>
@ -1361,24 +1425,6 @@
XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\$(InputName)1.obj"
XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
/>
</FileConfiguration>
<FileConfiguration
Name="Release FastBuild|Win32"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\$(InputName)1.obj"
XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
>
@ -1388,6 +1434,15 @@
XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\$(InputName)1.obj"
XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
>
@ -1397,6 +1452,15 @@
XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
/>
</FileConfiguration>
<FileConfiguration
Name="Release FastBuild|Win32"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\$(InputName)1.obj"
XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
/>
</FileConfiguration>
<FileConfiguration
Name="Release FastBuild|x64"
>
@ -1689,7 +1753,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release FastBuild|Win32"
Name="Release|x64"
>
<Tool
Name="VCCLCompilerTool"
@ -1697,7 +1761,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
Name="Release FastBuild|Win32"
>
<Tool
Name="VCCLCompilerTool"

View File

@ -77,7 +77,7 @@
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="directx-win32-ddraw-dinput8-dsound-dxerr8-dxguid.lib lua-vc8-Win32-debug.lib glib-vc8-Win32.lib 7z-vc8-Win32.lib zlib-vc8-Win32.lib agg-2.5.lib vfw32.lib winmm.lib opengl32.lib glu32.lib ws2_32.lib user32.lib gdi32.lib shell32.lib comdlg32.lib shlwapi.lib comctl32.lib"
AdditionalDependencies="directx-win32-ddraw-dinput8-dsound-dxerr8-dxguid.lib libelf_libdwarf-vc8-Win32.lib lua-vc8-Win32-debug.lib glib-vc8-Win32.lib 7z-vc8-Win32.lib zlib-vc8-Win32.lib agg-2.5.lib vfw32.lib winmm.lib opengl32.lib glu32.lib ws2_32.lib user32.lib gdi32.lib shell32.lib comdlg32.lib shlwapi.lib comctl32.lib"
OutputFile="$(OutDir)\$(ProjectName)_debug.exe"
AdditionalLibraryDirectories=".\zlib123;agg;.libs"
DelayLoadDLLs=""
@ -109,193 +109,6 @@
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)\__bins"
IntermediateDirectory="$(SolutionDir)\.VS2008\$(ConfigurationName)\$(PlatformName)"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
CommandLine="defaultconfig\SubWCRev.bat"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="MASM"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="2"
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
OmitFramePointers="true"
EnableFiberSafeOptimizations="true"
WholeProgramOptimization="true"
AdditionalIncludeDirectories=".;..;lua\include;&quot;glib-2.20.1\build&quot;;&quot;glib-2.20.1\build\glib&quot;;.\zlib123;.\zziplib;.\winpcap;userconfig;defaultconfig;.\7z;.\agg\include;.\agg\examples;.\wx\include"
PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;GLIB_STATIC_COMPILATION;WIN32;HAVE_LIBZ;NOMINMAX;RELEASE;NDEBUG"
StringPooling="true"
ExceptionHandling="1"
StructMemberAlignment="0"
BufferSecurityCheck="false"
EnableEnhancedInstructionSet="2"
FloatingPointModel="2"
WarningLevel="1"
DebugInformationFormat="3"
CallingConvention="0"
CompileAs="0"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="directx-win32-ddraw-dinput8-dsound-dxerr8-dxguid.lib lua-vc8-Win32.lib glib-vc8-Win32.lib 7z-vc8-Win32.lib zlib-vc8-Win32.lib agg-2.5.lib vfw32.lib winmm.lib opengl32.lib glu32.lib ws2_32.lib user32.lib gdi32.lib shell32.lib comdlg32.lib shlwapi.lib comctl32.lib"
OutputFile="$(OutDir)\$(ProjectName)_release.exe"
AdditionalLibraryDirectories=".\zlib123;agg;.libs"
DelayLoadDLLs=""
GenerateDebugInformation="true"
OptimizeReferences="2"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
Profile="false"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
AdditionalManifestFiles="DeSmuME_x86.manifest"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Dev+|Win32"
OutputDirectory="$(SolutionDir)\__bins"
IntermediateDirectory="$(SolutionDir)\.VS2008\$(ConfigurationName)\$(PlatformName)"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
WholeProgramOptimization="0"
>
<Tool
Name="VCPreBuildEventTool"
CommandLine="defaultconfig\SubWCRev.bat"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="MASM"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="3"
InlineFunctionExpansion="2"
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
OmitFramePointers="true"
EnableFiberSafeOptimizations="true"
WholeProgramOptimization="false"
AdditionalIncludeDirectories=".;..;lua\include;&quot;glib-2.20.1\build&quot;;&quot;glib-2.20.1\build\glib&quot;;.\zlib123;.\zziplib;.\winpcap;userconfig;defaultconfig;.\7z;.\agg\include;.\agg\examples;.\wx\include"
PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;GLIB_STATIC_COMPILATION;WIN32;HAVE_LIBZ;NOMINMAX;RELEASE;NDEBUG;FASTBUILD;DEVELOPER"
StringPooling="true"
ExceptionHandling="1"
StructMemberAlignment="0"
BufferSecurityCheck="false"
EnableEnhancedInstructionSet="2"
FloatingPointModel="2"
WarningLevel="1"
DebugInformationFormat="3"
CallingConvention="0"
CompileAs="0"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="directx-win32-ddraw-dinput8-dsound-dxerr8-dxguid.lib lua-vc8-Win32.lib glib-vc8-Win32.lib 7z-vc8-Win32.lib zlib-vc8-Win32.lib agg-2.5.lib vfw32.lib winmm.lib opengl32.lib glu32.lib ws2_32.lib user32.lib gdi32.lib shell32.lib comdlg32.lib shlwapi.lib comctl32.lib"
OutputFile="$(OutDir)\$(ProjectName)_dev+.exe"
AdditionalLibraryDirectories=".\zlib123;agg;.libs"
DelayLoadDLLs=""
GenerateDebugInformation="true"
OptimizeReferences="2"
LinkTimeCodeGeneration="0"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
Profile="false"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
AdditionalManifestFiles="DeSmuME_x86.manifest"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug|x64"
OutputDirectory="$(SolutionDir)\__bins"
@ -353,7 +166,7 @@
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="directx-x64-ddraw-dinput8-dsound-dxerr8-dxguid.lib lua-vc8-x64.lib glib-vc8-x64.lib 7z-vc8-x64.lib zlib-vc8-x64.lib agg-2.5-x64.lib vfw32.lib winmm.lib opengl32.lib glu32.lib ws2_32.lib user32.lib gdi32.lib shell32.lib comdlg32.lib shlwapi.lib"
AdditionalDependencies="directx-x64-ddraw-dinput8-dsound-dxerr8-dxguid.lib libelf_libdwarf-vc8-x64.lib lua-vc8-x64.lib glib-vc8-x64.lib 7z-vc8-x64.lib zlib-vc8-x64.lib agg-2.5-x64.lib vfw32.lib winmm.lib opengl32.lib glu32.lib ws2_32.lib user32.lib gdi32.lib shell32.lib comdlg32.lib shlwapi.lib"
OutputFile="$(OutDir)\$(ProjectName)_x64_debug.exe"
AdditionalLibraryDirectories=".\zlib123;agg;.libs"
GenerateDebugInformation="true"
@ -385,6 +198,99 @@
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)\__bins"
IntermediateDirectory="$(SolutionDir)\.VS2008\$(ConfigurationName)\$(PlatformName)"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
CommandLine="defaultconfig\SubWCRev.bat"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="MASM"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="2"
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
OmitFramePointers="true"
EnableFiberSafeOptimizations="true"
WholeProgramOptimization="true"
AdditionalIncludeDirectories=".;..;lua\include;&quot;glib-2.20.1\build&quot;;&quot;glib-2.20.1\build\glib&quot;;.\zlib123;.\zziplib;.\winpcap;userconfig;defaultconfig;.\7z;.\agg\include;.\agg\examples;.\wx\include"
PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;GLIB_STATIC_COMPILATION;WIN32;HAVE_LIBZ;NOMINMAX;RELEASE;NDEBUG"
StringPooling="true"
ExceptionHandling="1"
StructMemberAlignment="0"
BufferSecurityCheck="false"
EnableEnhancedInstructionSet="2"
FloatingPointModel="2"
WarningLevel="1"
DebugInformationFormat="3"
CallingConvention="0"
CompileAs="0"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="directx-win32-ddraw-dinput8-dsound-dxerr8-dxguid.lib libelf_libdwarf-vc8-Win32.lib lua-vc8-Win32.lib glib-vc8-Win32.lib 7z-vc8-Win32.lib zlib-vc8-Win32.lib agg-2.5.lib vfw32.lib winmm.lib opengl32.lib glu32.lib ws2_32.lib user32.lib gdi32.lib shell32.lib comdlg32.lib shlwapi.lib comctl32.lib"
OutputFile="$(OutDir)\$(ProjectName)_release.exe"
AdditionalLibraryDirectories=".\zlib123;agg;.libs"
DelayLoadDLLs=""
GenerateDebugInformation="true"
OptimizeReferences="2"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
Profile="false"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
AdditionalManifestFiles="DeSmuME_x86.manifest"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|x64"
OutputDirectory="$(SolutionDir)\__bins"
@ -446,7 +352,7 @@
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="directx-x64-ddraw-dinput8-dsound-dxerr8-dxguid.lib lua-vc8-x64.lib glib-vc8-x64.lib 7z-vc8-x64.lib zlib-vc8-x64.lib agg-2.5-x64.lib vfw32.lib winmm.lib opengl32.lib glu32.lib ws2_32.lib user32.lib gdi32.lib shell32.lib comdlg32.lib shlwapi.lib"
AdditionalDependencies="directx-x64-ddraw-dinput8-dsound-dxerr8-dxguid.lib libelf_libdwarf-vc8-x64.lib lua-vc8-x64.lib glib-vc8-x64.lib 7z-vc8-x64.lib zlib-vc8-x64.lib agg-2.5-x64.lib vfw32.lib winmm.lib opengl32.lib glu32.lib ws2_32.lib user32.lib gdi32.lib shell32.lib comdlg32.lib shlwapi.lib"
OutputFile="$(OutDir)\$(ProjectName)_x64_release.exe"
AdditionalLibraryDirectories=".\zlib123;agg;.libs"
GenerateDebugInformation="true"
@ -479,6 +385,100 @@
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Dev+|Win32"
OutputDirectory="$(SolutionDir)\__bins"
IntermediateDirectory="$(SolutionDir)\.VS2008\$(ConfigurationName)\$(PlatformName)"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
WholeProgramOptimization="0"
>
<Tool
Name="VCPreBuildEventTool"
CommandLine="defaultconfig\SubWCRev.bat"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="MASM"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="3"
InlineFunctionExpansion="2"
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
OmitFramePointers="true"
EnableFiberSafeOptimizations="true"
WholeProgramOptimization="false"
AdditionalIncludeDirectories=".;..;lua\include;&quot;glib-2.20.1\build&quot;;&quot;glib-2.20.1\build\glib&quot;;.\zlib123;.\zziplib;.\winpcap;userconfig;defaultconfig;.\7z;.\agg\include;.\agg\examples;.\wx\include"
PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;GLIB_STATIC_COMPILATION;WIN32;HAVE_LIBZ;NOMINMAX;RELEASE;NDEBUG;FASTBUILD;DEVELOPER"
StringPooling="true"
ExceptionHandling="1"
StructMemberAlignment="0"
BufferSecurityCheck="false"
EnableEnhancedInstructionSet="2"
FloatingPointModel="2"
WarningLevel="1"
DebugInformationFormat="3"
CallingConvention="0"
CompileAs="0"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="directx-win32-ddraw-dinput8-dsound-dxerr8-dxguid.lib libelf_libdwarf-vc8-Win32.lib lua-vc8-Win32.lib glib-vc8-Win32.lib 7z-vc8-Win32.lib zlib-vc8-Win32.lib agg-2.5.lib vfw32.lib winmm.lib opengl32.lib glu32.lib ws2_32.lib user32.lib gdi32.lib shell32.lib comdlg32.lib shlwapi.lib comctl32.lib"
OutputFile="$(OutDir)\$(ProjectName)_dev+.exe"
AdditionalLibraryDirectories=".\zlib123;agg;.libs"
DelayLoadDLLs=""
GenerateDebugInformation="true"
OptimizeReferences="2"
LinkTimeCodeGeneration="0"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
Profile="false"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
AdditionalManifestFiles="DeSmuME_x86.manifest"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Dev+|x64"
OutputDirectory="$(SolutionDir)\__bins"
@ -540,7 +540,7 @@
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="directx-x64-ddraw-dinput8-dsound-dxerr8-dxguid.lib lua-vc8-x64.lib glib-vc8-x64.lib 7z-vc8-x64.lib zlib-vc8-x64.lib agg-2.5-x64.lib vfw32.lib winmm.lib opengl32.lib glu32.lib ws2_32.lib user32.lib gdi32.lib shell32.lib comdlg32.lib shlwapi.lib"
AdditionalDependencies="directx-x64-ddraw-dinput8-dsound-dxerr8-dxguid.lib libelf_libdwarf-vc8-x64.lib lua-vc8-x64.lib glib-vc8-x64.lib 7z-vc8-x64.lib zlib-vc8-x64.lib agg-2.5-x64.lib vfw32.lib winmm.lib opengl32.lib glu32.lib ws2_32.lib user32.lib gdi32.lib shell32.lib comdlg32.lib shlwapi.lib"
OutputFile="$(OutDir)\$(ProjectName)_x64_dev+.exe"
AdditionalLibraryDirectories=".\zlib123;agg;.libs"
GenerateDebugInformation="true"
@ -641,7 +641,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Dev+|Win32"
Name="Release|x64"
>
<Tool
Name="VCCLCompilerTool"
@ -649,7 +649,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
Name="Dev+|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -1593,26 +1593,6 @@
Outputs=".libs\7z.tag"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCustomBuildTool"
CommandLine="un7z_and_touch.bat 7z\7z.7z .libs\7z*&#x0D;&#x0A;"
AdditionalDependencies="7z.exe;un7z_and_touch.bat"
Outputs=".libs\7z.tag"
/>
</FileConfiguration>
<FileConfiguration
Name="Dev+|Win32"
>
<Tool
Name="VCCustomBuildTool"
CommandLine="un7z_and_touch.bat 7z\7z.7z .libs\7z*&#x0D;&#x0A;"
AdditionalDependencies="7z.exe;un7z_and_touch.bat"
Outputs=".libs\7z.tag"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
>
@ -1623,6 +1603,16 @@
Outputs=".libs\7z.tag"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCustomBuildTool"
CommandLine="un7z_and_touch.bat 7z\7z.7z .libs\7z*&#x0D;&#x0A;"
AdditionalDependencies="7z.exe;un7z_and_touch.bat"
Outputs=".libs\7z.tag"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
>
@ -1633,6 +1623,16 @@
Outputs=".libs\7z.tag"
/>
</FileConfiguration>
<FileConfiguration
Name="Dev+|Win32"
>
<Tool
Name="VCCustomBuildTool"
CommandLine="un7z_and_touch.bat 7z\7z.7z .libs\7z*&#x0D;&#x0A;"
AdditionalDependencies="7z.exe;un7z_and_touch.bat"
Outputs=".libs\7z.tag"
/>
</FileConfiguration>
<FileConfiguration
Name="Release FastBuild|x64"
>
@ -1657,26 +1657,6 @@
Outputs=".libs\directx.tag"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCustomBuildTool"
CommandLine="un7z_and_touch.bat directx\directx.7z .libs\directx*&#x0D;&#x0A;"
AdditionalDependencies="7z.exe;un7z_and_touch.bat"
Outputs=".libs\directx.tag"
/>
</FileConfiguration>
<FileConfiguration
Name="Dev+|Win32"
>
<Tool
Name="VCCustomBuildTool"
CommandLine="un7z_and_touch.bat directx\directx.7z .libs\directx*&#x0D;&#x0A;"
AdditionalDependencies="7z.exe;un7z_and_touch.bat"
Outputs=".libs\directx.tag"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
>
@ -1687,6 +1667,16 @@
Outputs=".libs\directx.tag"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCustomBuildTool"
CommandLine="un7z_and_touch.bat directx\directx.7z .libs\directx*&#x0D;&#x0A;"
AdditionalDependencies="7z.exe;un7z_and_touch.bat"
Outputs=".libs\directx.tag"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
>
@ -1697,6 +1687,16 @@
Outputs=".libs\directx.tag"
/>
</FileConfiguration>
<FileConfiguration
Name="Dev+|Win32"
>
<Tool
Name="VCCustomBuildTool"
CommandLine="un7z_and_touch.bat directx\directx.7z .libs\directx*&#x0D;&#x0A;"
AdditionalDependencies="7z.exe;un7z_and_touch.bat"
Outputs=".libs\directx.tag"
/>
</FileConfiguration>
<FileConfiguration
Name="Release FastBuild|x64"
>
@ -1721,26 +1721,6 @@
Outputs=".libs\glib-vc8.tag"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCustomBuildTool"
CommandLine="un7z_and_touch.bat glib-2.20.1\glib-2.20.1.7z .libs\glib*&#x0D;&#x0A;"
AdditionalDependencies="7z.exe;un7z_and_touch.bat"
Outputs=".libs\glib-vc8.tag"
/>
</FileConfiguration>
<FileConfiguration
Name="Dev+|Win32"
>
<Tool
Name="VCCustomBuildTool"
CommandLine="un7z_and_touch.bat glib-2.20.1\glib-2.20.1.7z .libs\glib*&#x0D;&#x0A;"
AdditionalDependencies="7z.exe;un7z_and_touch.bat"
Outputs=".libs\glib-vc8.tag"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
>
@ -1751,6 +1731,16 @@
Outputs=".libs\glib-vc8.tag"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCustomBuildTool"
CommandLine="un7z_and_touch.bat glib-2.20.1\glib-2.20.1.7z .libs\glib*&#x0D;&#x0A;"
AdditionalDependencies="7z.exe;un7z_and_touch.bat"
Outputs=".libs\glib-vc8.tag"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
>
@ -1761,6 +1751,16 @@
Outputs=".libs\glib-vc8.tag"
/>
</FileConfiguration>
<FileConfiguration
Name="Dev+|Win32"
>
<Tool
Name="VCCustomBuildTool"
CommandLine="un7z_and_touch.bat glib-2.20.1\glib-2.20.1.7z .libs\glib*&#x0D;&#x0A;"
AdditionalDependencies="7z.exe;un7z_and_touch.bat"
Outputs=".libs\glib-vc8.tag"
/>
</FileConfiguration>
<FileConfiguration
Name="Release FastBuild|x64"
>
@ -1773,16 +1773,26 @@
</FileConfiguration>
</File>
<File
RelativePath=".\lua\lua.7z"
RelativePath=".\libelf_libdwarf\libelf_libdwarf.7z"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCustomBuildTool"
CommandLine="un7z_and_touch.bat lua\lua.7z .libs\lua*&#x0D;&#x0A;"
CommandLine="un7z_and_touch.bat libelf_libdwarf\libelf_libdwarf.7z .libs\libelf_libdwarf*"
AdditionalDependencies="7z.exe;un7z_and_touch.bat"
Outputs=".libs\lua.tag"
Outputs=".libs\libelf_libdwarf.tag"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
>
<Tool
Name="VCCustomBuildTool"
CommandLine="un7z_and_touch.bat libelf_libdwarf\libelf_libdwarf.7z .libs\libelf_libdwarf*"
AdditionalDependencies="7z.exe;un7z_and_touch.bat"
Outputs=".libs\libelf_libdwarf.tag"
/>
</FileConfiguration>
<FileConfiguration
@ -1790,14 +1800,48 @@
>
<Tool
Name="VCCustomBuildTool"
CommandLine="un7z_and_touch.bat lua\lua.7z .libs\lua*&#x0D;&#x0A;"
CommandLine="un7z_and_touch.bat libelf_libdwarf\libelf_libdwarf.7z .libs\libelf_libdwarf*"
AdditionalDependencies="7z.exe;un7z_and_touch.bat"
Outputs=".libs\lua.tag"
Outputs=".libs\libelf_libdwarf.tag"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
>
<Tool
Name="VCCustomBuildTool"
CommandLine="un7z_and_touch.bat libelf_libdwarf\libelf_libdwarf.7z .libs\libelf_libdwarf*"
AdditionalDependencies="7z.exe;un7z_and_touch.bat"
Outputs=".libs\libelf_libdwarf.tag"
/>
</FileConfiguration>
<FileConfiguration
Name="Dev+|Win32"
>
<Tool
Name="VCCustomBuildTool"
CommandLine="un7z_and_touch.bat libelf_libdwarf\libelf_libdwarf.7z .libs\libelf_libdwarf*"
AdditionalDependencies="7z.exe;un7z_and_touch.bat"
Outputs=".libs\libelf_libdwarf.tag"
/>
</FileConfiguration>
<FileConfiguration
Name="Dev+|x64"
>
<Tool
Name="VCCustomBuildTool"
CommandLine="un7z_and_touch.bat libelf_libdwarf\libelf_libdwarf.7z .libs\libelf_libdwarf*"
AdditionalDependencies="7z.exe;un7z_and_touch.bat"
Outputs=".libs\libelf_libdwarf.tag"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\lua\lua.7z"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCustomBuildTool"
CommandLine="un7z_and_touch.bat lua\lua.7z .libs\lua*&#x0D;&#x0A;"
@ -1815,6 +1859,16 @@
Outputs=".libs\lua.tag"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCustomBuildTool"
CommandLine="un7z_and_touch.bat lua\lua.7z .libs\lua*&#x0D;&#x0A;"
AdditionalDependencies="7z.exe;un7z_and_touch.bat"
Outputs=".libs\lua.tag"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
>
@ -1825,6 +1879,16 @@
Outputs=".libs\lua.tag"
/>
</FileConfiguration>
<FileConfiguration
Name="Dev+|Win32"
>
<Tool
Name="VCCustomBuildTool"
CommandLine="un7z_and_touch.bat lua\lua.7z .libs\lua*&#x0D;&#x0A;"
AdditionalDependencies="7z.exe;un7z_and_touch.bat"
Outputs=".libs\lua.tag"
/>
</FileConfiguration>
<FileConfiguration
Name="Release FastBuild|x64"
>
@ -1849,6 +1913,16 @@
Outputs=".libs\wx.tag"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
>
<Tool
Name="VCCustomBuildTool"
CommandLine="un7z_and_touch.bat wx\wx.7z .libs\wx*&#x0D;&#x0A;"
AdditionalDependencies="7z.exe;un7z_and_touch.bat"
Outputs=".libs\wx.tag"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
@ -1859,6 +1933,16 @@
Outputs=".libs\wx.tag"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
>
<Tool
Name="VCCustomBuildTool"
CommandLine="un7z_and_touch.bat wx\wx.7z .libs\wx*&#x0D;&#x0A;"
AdditionalDependencies="7z.exe;un7z_and_touch.bat"
Outputs=".libs\wx.tag"
/>
</FileConfiguration>
<FileConfiguration
Name="Dev+|Win32"
>
@ -1869,26 +1953,6 @@
Outputs=".libs\wx.tag"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
>
<Tool
Name="VCCustomBuildTool"
CommandLine="un7z_and_touch.bat wx\wx.7z .libs\wx*"
AdditionalDependencies="7z.exe;un7z_and_touch.bat"
Outputs=".libs\wx.tag"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
>
<Tool
Name="VCCustomBuildTool"
CommandLine="un7z_and_touch.bat wx\wx.7z .libs\wx*"
AdditionalDependencies="7z.exe;un7z_and_touch.bat"
Outputs=".libs\wx.tag"
/>
</FileConfiguration>
<FileConfiguration
Name="Release FastBuild|x64"
>

View File

@ -0,0 +1,47 @@
/*
Copyright (C) 2009-2010 SN Systems. All Rights Reserved.
Portions Copyright (C) 2009-2010 David Anderson. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it
under the terms of version 2.1 of the GNU Lesser General Public License
as published by the Free Software Foundation.
This program is distributed in the hope that it would be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Further, this software is distributed without any warranty that it is
free of the rightful claim of any third person regarding infringement
or the like. Any license provided herein, whether implied or
otherwise, applies only to this software file. Patent licenses, if
any, provided herein do not apply to combinations of this program with
other software, or any other product whatsoever.
You should have received a copy of the GNU Lesser General Public
License along with this program; if not, write the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston MA 02110-1301,
USA.
Contact information: Silicon Graphics, Inc., 1500 Crittenden Lane,
Mountain View, CA 94043, or:
http://www.sgi.com
For further information regarding this notice, see:
http://oss.sgi.com/projects/GenInfo/NoticeExplan
*/
#ifndef common_INCLUDED
#define common_INCLUDED
#include <stdio.h>
void print_args(int argc, char *argv[]);
void print_usage_message(const char *options[]);
void print_version(const char * name);
#endif /* common_INCLUDED */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,55 @@
/*
Copyright (C) 2000 Silicon Graphics, Inc. All Rights Reserved.
Portions Copyright (C) 2008-2010 David Anderson. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it
under the terms of version 2.1 of the GNU Lesser General Public License
as published by the Free Software Foundation.
This program is distributed in the hope that it would be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Further, this software is distributed without any warranty that it is
free of the rightful claim of any third person regarding infringement
or the like. Any license provided herein, whether implied or
otherwise, applies only to this software file. Patent licenses, if
any, provided herein do not apply to combinations of this program with
other software, or any other product whatsoever.
You should have received a copy of the GNU Lesser General Public
License along with this program; if not, write the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston MA 02110-1301,
USA.
Contact information: Silicon Graphics, Inc., 1500 Crittenden Lane,
Mountain View, CA 94043, or:
http://www.sgi.com
For further information regarding this notice, see:
http://oss.sgi.com/projects/GenInfo/NoticeExplan
*/
/* In a given CU, one of these is (eventually) set up
for every abbreviation we need to find (and for all.
those ealier in the abbreviations for that CU).
So we don't want elements needlessly big.
*/
struct Dwarf_Abbrev_s {
/* No TAG should exceed DW_TAG_hi_user, 0xffff, but
we do allow a larger value here. */
Dwarf_Word ab_tag;
/* Abbreviations are numbered (normally sequentially from
1 and so 16 bits is not enough! */
Dwarf_Word ab_code;
Dwarf_Small ab_has_child;
Dwarf_Byte_Ptr ab_abbrev_ptr;
Dwarf_Debug ab_dbg;
};

View File

@ -0,0 +1,55 @@
/*
dwarf_addr_finder.h
$Source: /plroot/cmplrs.src/v7.4.5m/.RCS/PL/include/cmplrs/RCS/dwarf_addr_finder.h,v $
$Date: 2002/06/11 17:49:06 $
Defines user interface.
*/
/* return codes for functions
*/
#define DW_DLV_NO_ENTRY -1
#define DW_DLV_OK 0
#define DW_DLV_ERROR 1
/* the following are the 'section' number passed to the called-back
function.
The called-back application must translate this to the
appropriate elf section number/pointer.
Putting this burden on the application avoids having to store
the numbers in the Dwarf_Debug structure (thereby saving space
for most consumers).
*/
#define DW_SECTION_INFO 0
#define DW_SECTION_FRAME 1
#define DW_SECTION_ARANGES 2
#define DW_SECTION_LINE 3
#define DW_SECTION_LOC 4 /* .debug_loc */
/* section is one of the above codes: it specifies a section.
secoff is the offset in the dwarf section.
existingAddr is the value at the specified offset (so the
called back routine can sanity check the proceedings).
It's up to the caller to know the size of an address (4 or 8)
and update the right number of bytes.
*/
typedef int (*Dwarf_addr_callback_func) (int /*section*/,
Dwarf_Off /*secoff*/, Dwarf_Addr /*existingAddr*/);
/* call this to do the work: it calls back thru cb_func
once per each address to be modified.
Once this returns you are done.
Returns DW_DLV_OK if finished ok.
Returns DW_DLV_ERROR if there was some kind of error, in which
the dwarf error number was passed back thu the dwerr ptr.
Returns DW_DLV_NO_ENTRY if there are no relevant dwarf sections,
so there were no addresses to be modified (and none
called back).
*/
int _dwarf_addr_finder(dwarf_elf_handle elf_file_ptr,
Dwarf_addr_callback_func cb_func,
int *dwerr);

View File

@ -0,0 +1,177 @@
/*
Copyright (C) 2000,2005 Silicon Graphics, Inc. All Rights Reserved.
Portions Copyright (C) 2008-2010 David Anderson. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it
under the terms of version 2.1 of the GNU Lesser General Public License
as published by the Free Software Foundation.
This program is distributed in the hope that it would be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Further, this software is distributed without any warranty that it is
free of the rightful claim of any third person regarding infringement
or the like. Any license provided herein, whether implied or
otherwise, applies only to this software file. Patent licenses, if
any, provided herein do not apply to combinations of this program with
other software, or any other product whatsoever.
You should have received a copy of the GNU Lesser General Public
License along with this program; if not, write the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston MA 02110-1301,
USA.
Contact information: Silicon Graphics, Inc., 1500 Crittenden Lane,
Mountain View, CA 94043, or:
http://www.sgi.com
For further information regarding this notice, see:
http://oss.sgi.com/projects/GenInfo/NoticeExplan
*/
/* #define DWARF_SIMPLE_MALLOC 1 */
Dwarf_Ptr _dwarf_get_alloc(Dwarf_Debug, Dwarf_Small, Dwarf_Unsigned);
Dwarf_Debug _dwarf_get_debug(void);
Dwarf_Debug _dwarf_setup_debug(Dwarf_Debug);
int _dwarf_free_all_of_one_debug(Dwarf_Debug);
typedef struct Dwarf_Alloc_Area_s *Dwarf_Alloc_Area;
typedef struct Dwarf_Free_List_s *Dwarf_Free_List;
/* ALLOC_AREA_INDEX_TABLE_MAX is the size of the
struct ial_s index_into_allocated array in dwarf_alloc.c
*/
#define ALLOC_AREA_INDEX_TABLE_MAX 45
/* ALLOC_AREA_REAL_TABLE_MAX is the size of the array needed
to hold pointers to dwarf alloc chunk areas.
It's smaller as some of the index_into_allocated
entries (they look like {0,1,1,0,0} )
are treated specially and don't use 'chunks'.
*/
#define ALLOC_AREA_REAL_TABLE_MAX 32
/*
This struct is used to chain all the deallocated
structs on the free list of each chain. The structs
are chained internally, by using the memory they
contain.
*/
struct Dwarf_Free_List_s {
Dwarf_Free_List fl_next;
};
/*
This struct is used to manage all the chunks malloc'ed
for a particular alloc_type. Many of the fields are
initialized by dwarf_init().
*/
struct Dwarf_Alloc_Hdr_s {
/* Count of actual number of structs user app holds pointers to
currently. */
Dwarf_Sword ah_struct_user_holds;
/*
Size of each struct that will be allocated for this alloc_type.
Initialized by dwarf_init(). */
Dwarf_Half ah_bytes_one_struct;
/*
Number of structs of this alloc_type that will be contained in
each chunk that is malloc'ed. Initialized by dwarf_init(). */
Dwarf_Word ah_structs_per_chunk;
/*
Number of bytes malloc'ed per chunk which is basically
(ah_bytes_one_struct+_DWARF_RESERVE) * ah_alloc_num. */
Dwarf_Word ah_bytes_malloc_per_chunk;
/* Count of chunks currently allocated for type. */
Dwarf_Sword ah_chunks_allocated;
/*
Points to a chain of Dwarf_Alloc_Area_s structs that represent
all the chunks currently allocated for the alloc_type. */
Dwarf_Alloc_Area ah_alloc_area_head;
/* Last Alloc Area that was allocated by malloc. The
free-space-search area looks here first and only if it is full
goes thru the list pointed to by ah_alloc_area_head. */
Dwarf_Alloc_Area ah_last_alloc_area;
};
/*
This struct is used to manage each chunk that is
malloc'ed for a particular alloc_type. For each
allocation type, the allocation header points to
a list of all the chunks malloc'ed for that type.
*/
struct Dwarf_Alloc_Area_s {
/* Points to the free list of structs in the chunk. */
Dwarf_Ptr aa_free_list;
/*
Count of the number of free structs in the chunk. This includes
both those on the free list, and in the blob. */
Dwarf_Sword aa_free_structs_in_chunk;
/*
Points to the first byte of the blob from which struct will be
allocated. A struct is put on the free_list only when it
dwarf_deallocated. Initial allocations are from the blob. */
Dwarf_Small *aa_blob_start;
/* Points just past the last byte of the blob. */
Dwarf_Small *aa_blob_end;
/* Points to alloc_hdr this alloc_area is linked to: The owner, in
other words. */
Dwarf_Alloc_Hdr aa_alloc_hdr;
/*
Used for chaining Dwarf_Alloc_Area_s atructs. Alloc areas are
doubly linked to enable deletion from the list in constant time. */
Dwarf_Alloc_Area aa_next;
Dwarf_Alloc_Area aa_prev;
};
struct Dwarf_Error_s *_dwarf_special_no_dbg_error_malloc(void);
#ifdef DWARF_SIMPLE_MALLOC
/*
DWARF_SIMPLE_MALLOC is for testing the hypothesis that the existing
complex malloc scheme in libdwarf is pointless complexity.
DWARF_SIMPLE_MALLOC also makes it easy for a malloc-tracing
tool to verify libdwarf malloc has no botches (though of course
such does not test the complicated standard-libdwarf-alloc code).
*/
struct simple_malloc_entry_s {
Dwarf_Small *se_addr;
unsigned long se_size;
short se_type;
};
#define DSM_BLOCK_COUNT (1000)
#define DSM_BLOCK_SIZE (sizeof(struct simple_malloc_entry_s)*DSM_BLOCK_COUNT)
/* we do this so dwarf_dealloc can really free everything */
struct simple_malloc_record_s {
struct simple_malloc_record_s *sr_next;
int sr_used;
struct simple_malloc_entry_s sr_entry[DSM_BLOCK_COUNT];
};
#endif /* DWARF_SIMPLE_MALLOC */

View File

@ -0,0 +1,71 @@
/*
Copyright (C) 2000 Silicon Graphics, Inc. All Rights Reserved.
Portions Copyright (C) 2010 David Anderson. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it
under the terms of version 2.1 of the GNU Lesser General Public License
as published by the Free Software Foundation.
This program is distributed in the hope that it would be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Further, this software is distributed without any warranty that it is
free of the rightful claim of any third person regarding infringement
or the like. Any license provided herein, whether implied or
otherwise, applies only to this software file. Patent licenses, if
any, provided herein do not apply to combinations of this program with
other software, or any other product whatsoever.
You should have received a copy of the GNU Lesser General Public
License along with this program; if not, write the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston MA 02110-1301,
USA.
Contact information: Silicon Graphics, Inc., 1500 Crittenden Lane,
Mountain View, CA 94043, or:
http://www.sgi.com
For further information regarding this notice, see:
http://oss.sgi.com/projects/GenInfo/NoticeExplan
*/
/* This structure is used to read an arange into. */
struct Dwarf_Arange_s {
/* The segment selector. Only non-zero if Dwarf4, only
meaningful if ar_segment_selector_size non-zero */
Dwarf_Unsigned ar_segment_selector;
/* Starting address of the arange, ie low-pc. */
Dwarf_Addr ar_address;
/* Length of the arange. */
Dwarf_Unsigned ar_length;
/*
Offset into .debug_info of the start of the compilation-unit
containing this set of aranges. */
Dwarf_Off ar_info_offset;
/* Corresponding Dwarf_Debug. */
Dwarf_Debug ar_dbg;
Dwarf_Half ar_segment_selector_size;
};
int
_dwarf_get_aranges_addr_offsets(Dwarf_Debug dbg,
Dwarf_Addr ** addrs,
Dwarf_Off ** offsets,
Dwarf_Signed * count,
Dwarf_Error * error);

View File

@ -0,0 +1,123 @@
/*
Copyright (C) 2000,2005 Silicon Graphics, Inc. All Rights Reserved.
Portions Copyright (C) 2008-2010 David Anderson. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it
under the terms of version 2.1 of the GNU Lesser General Public License
as published by the Free Software Foundation.
This program is distributed in the hope that it would be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Further, this software is distributed without any warranty that it is
free of the rightful claim of any third person regarding infringement
or the like. Any license provided herein, whether implied or
otherwise, applies only to this software file. Patent licenses, if
any, provided herein do not apply to combinations of this program with
other software, or any other product whatsoever.
You should have received a copy of the GNU Lesser General Public
License along with this program; if not, write the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston MA 02110-1301,
USA.
Contact information: Silicon Graphics, Inc., 1500 Crittenden Lane,
Mountain View, CA 94043, or:
http://www.sgi.com
For further information regarding this notice, see:
http://oss.sgi.com/projects/GenInfo/NoticeExplan
*/
#include "libdwarfdefs.h"
#define true 1
#define false 0
/* to identify a cie */
#define DW_CIE_ID ~(0x0)
#define DW_CIE_VERSION 1 /* DWARF2 */
#define DW_CIE_VERSION3 3 /* DWARF3 */
#define DW_CIE_VERSION4 4 /* DWARF4 */
#define DW_CU_VERSION2 2
#define DW_CU_VERSION3 3
#define DW_CU_VERSION4 4
/* DWARF2,3 and 4 */
#define DW_ARANGES_VERSION2 2
#define DW_LINE_VERSION2 2
#define DW_LINE_VERSION3 3
#define DW_LINE_VERSION4 4
/*
These are allocation type codes for structs that
are internal to the Libdwarf Consumer library.
*/
#define DW_DLA_ABBREV_LIST DW_DLA_RANGES + 1
#define DW_DLA_CHAIN DW_DLA_RANGES + 2
#define DW_DLA_CU_CONTEXT DW_DLA_RANGES + 3
#define DW_DLA_FRAME DW_DLA_RANGES + 4
#define DW_DLA_GLOBAL_CONTEXT DW_DLA_RANGES + 5
#define DW_DLA_FILE_ENTRY DW_DLA_RANGES + 6
#define DW_DLA_LINE_CONTEXT DW_DLA_RANGES + 7
#define DW_DLA_LOC_CHAIN DW_DLA_RANGES + 8
#define DW_DLA_HASH_TABLE DW_DLA_RANGES + 9
#define DW_DLA_FUNC_CONTEXT DW_DLA_RANGES + 10
#define DW_DLA_TYPENAME_CONTEXT DW_DLA_RANGES + 11
#define DW_DLA_VAR_CONTEXT DW_DLA_RANGES + 12
#define DW_DLA_WEAK_CONTEXT DW_DLA_RANGES + 13
#define DW_DLA_PUBTYPES_CONTEXT DW_DLA_RANGES + 14 /* DWARF3 */
#define DW_DLA_HASH_TABLE_ENTRY DW_DLA_RANGES + 15
/* Maximum number of allocation types for allocation routines. */
#define MAX_DW_DLA DW_DLA_HASH_TABLE_ENTRY
/*Dwarf_Word is unsigned word usable for index, count in memory */
/*Dwarf_Sword is signed word usable for index, count in memory */
/* The are 32 or 64 bits depending if 64 bit longs or not, which
** fits the ILP32 and LP64 models
** These work equally well with ILP64.
*/
typedef unsigned long Dwarf_Word;
typedef signed long Dwarf_Sword;
typedef signed char Dwarf_Sbyte;
typedef unsigned char Dwarf_Ubyte;
typedef signed short Dwarf_Shalf;
typedef Dwarf_Small *Dwarf_Byte_Ptr;
/* these 2 are fixed sizes which must not vary with the
** ILP32/LP64 model. Between these two, stay at 32 bit.
*/
typedef __uint32_t Dwarf_ufixed;
typedef __int32_t Dwarf_sfixed;
/*
In various places the code mistakenly associates
forms 8 bytes long with Dwarf_Signed or Dwarf_Unsigned
This is not a very portable assumption.
The following should be used instead for 64 bit integers.
*/
typedef __uint64_t Dwarf_ufixed64;
typedef __int64_t Dwarf_sfixed64;
typedef struct Dwarf_Abbrev_List_s *Dwarf_Abbrev_List;
typedef struct Dwarf_File_Entry_s *Dwarf_File_Entry;
typedef struct Dwarf_CU_Context_s *Dwarf_CU_Context;
typedef struct Dwarf_Hash_Table_s *Dwarf_Hash_Table;
typedef struct Dwarf_Hash_Table_Entry_s *Dwarf_Hash_Table_Entry;
typedef struct Dwarf_Alloc_Hdr_s *Dwarf_Alloc_Hdr;

View File

@ -0,0 +1,57 @@
/*
Copyright (C) 2000 Silicon Graphics, Inc. All Rights Reserved.
Portions Copyright (C) 2008-2010 David Anderson. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it
under the terms of version 2.1 of the GNU Lesser General Public License
as published by the Free Software Foundation.
This program is distributed in the hope that it would be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Further, this software is distributed without any warranty that it is
free of the rightful claim of any third person regarding infringement
or the like. Any license provided herein, whether implied or
otherwise, applies only to this software file. Patent licenses, if
any, provided herein do not apply to combinations of this program with
other software, or any other product whatsoever.
You should have received a copy of the GNU Lesser General Public
License along with this program; if not, write the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston MA 02110-1301,
USA.
Contact information: Silicon Graphics, Inc., 1500 Crittenden Lane,
Mountain View, CA 94043, or:
http://www.sgi.com
For further information regarding this notice, see:
http://oss.sgi.com/projects/GenInfo/NoticeExplan
*/
/*
This struct holds information about a abbreviation.
It is put in the hash table for abbreviations for
a compile-unit.
*/
struct Dwarf_Abbrev_List_s {
Dwarf_Unsigned ab_code;
Dwarf_Half ab_tag;
Dwarf_Half ab_has_child;
/*
Points to start of attribute and form pairs in the .debug_abbrev
section for the abbrev. */
Dwarf_Byte_Ptr ab_abbrev_ptr;
struct Dwarf_Abbrev_List_s *ab_next;
};

View File

@ -0,0 +1,55 @@
#ifndef _DWARF_ELF_PORT_H
#define _DWARF_ELF_PORT_H
/*
Copyright (C) 2008-2010 David Anderson. All rights reserved.
Portions Copyright 2008-2010 Arxan Technologies, Inc. All rights reserved.
This program is free software; you can redistribute it and/or modify it
under the terms of version 2.1 of the GNU Lesser General Public License
as published by the Free Software Foundation.
This program is distributed in the hope that it would be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Further, this software is distributed without any warranty that it is
free of the rightful claim of any third person regarding infringement
or the like. Any license provided herein, whether implied or
otherwise, applies only to this software file. Patent licenses, if
any, provided herein do not apply to combinations of this program with
other software, or any other product whatsoever.
You should have received a copy of the GNU Lesser General Public
License along with this program; if not, write the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston MA 02110-1301,
USA.
Contact information: Silicon Graphics, Inc., 1500 Crittenden Lane,
Mountain View, CA 94043, or:
http://www.sgi.com
For further information regarding this notice, see:
http://oss.sgi.com/projects/GenInfo/NoticeExplan
*/
/* ELF (usually libelf) object access for the generic object file interface */
int
dwarf_elf_object_access_init(dwarf_elf_handle elf ,
int libdwarf_owns_elf,
Dwarf_Obj_Access_Interface** ret_obj,
int *err );
void
dwarf_elf_object_access_finish(Dwarf_Obj_Access_Interface* obj );
/* End ELF object access for the generic object file interface */
#endif

View File

@ -0,0 +1,43 @@
/*
Copyright (C) 2000 Silicon Graphics, Inc. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it
under the terms of version 2.1 of the GNU Lesser General Public License
as published by the Free Software Foundation.
This program is distributed in the hope that it would be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Further, this software is distributed without any warranty that it is
free of the rightful claim of any third person regarding infringement
or the like. Any license provided herein, whether implied or
otherwise, applies only to this software file. Patent licenses, if
any, provided herein do not apply to combinations of this program with
other software, or any other product whatsoever.
You should have received a copy of the GNU Lesser General Public
License along with this program; if not, write the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston MA 02110-1301,
USA.
Contact information: Silicon Graphics, Inc., 1500 Crittenden Lane,
Mountain View, CA 94043, or:
http://www.sgi.com
For further information regarding this notice, see:
http://oss.sgi.com/projects/GenInfo/NoticeExplan
*/
void _dwarf_error(Dwarf_Debug dbg, Dwarf_Error * error,
Dwarf_Sword errval);
struct Dwarf_Error_s {
Dwarf_Sword er_errval;
};

View File

@ -0,0 +1,421 @@
/*
Copyright (C) 2000, 2004, 2006 Silicon Graphics, Inc. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it
under the terms of version 2.1 of the GNU Lesser General Public License
as published by the Free Software Foundation.
This program is distributed in the hope that it would be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Further, this software is distributed without any warranty that it is
free of the rightful claim of any third person regarding infringement
or the like. Any license provided herein, whether implied or
otherwise, applies only to this software file. Patent licenses, if
any, provided herein do not apply to combinations of this program with
other software, or any other product whatsoever.
You should have received a copy of the GNU Lesser General Public
License along with this program; if not, write the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston MA 02110-1301,
USA.
Contact information: Silicon Graphics, Inc., 1500 Crittenden Lane,
Mountain View, CA 94043, or:
http://www.sgi.com
For further information regarding this notice, see:
http://oss.sgi.com/projects/GenInfo/NoticeExplan
*/
/* The dwarf 2.0 standard dictates that only the following
* fields can be read when an unexpected augmentation string
* (in the cie) is encountered: CIE length, CIE_id, version and
* augmentation; FDE: length, CIE pointer, initial location and
* address range. Unfortunately, with the above restrictions, it
* is impossible to read the instruction table from a CIE or a FDE
* when a new augmentation string is encountered.
* To fix this problem, the following layout is used, if the
* augmentation string starts with the string "z".
* CIE FDE
* length length
* CIE_id CIE_pointer
* version initial_location
* augmentation address_range
* length_of_augmented_fields (*NEW*)
* code_alignment_factor Any new fields as necessary
* data_alignment_factor instruction_table
* return_address
* length_of_augmented fields
* Any new fields as necessary
* initial_instructions
*
* The type of all the old data items are the same as what is
* described in dwarf 2.0 standard. The length_of_augmented_fields
* is an LEB128 data item that denotes the size (in bytes) of
* the augmented fields (not including the size of
* "length_of_augmented_fields" itself).
* Handling of cie augmentation strings is necessarly a heuristic.
* See dwarf_frame.c for the currently known augmentation strings.
---START SGI-ONLY COMMENT:
* SGI-IRIX versions of cie or fde were intended to use "z1", "z2" as the
* augmenter strings if required for new augmentation.
* However, that never happened (as of March 2005).
*
* The fde's augmented by the string "z" have a new field
* (signed constant, 4 byte field)
* called offset_into_exception_tables, following the
* length_of_augmented field. This field contains an offset
* into the "_MIPS_eh_region", which describes
* the IRIX CC exception handling tables.
---END SGI-ONLY COMMENT
* GNU .eh_frame has an augmentation string of z[RLP]* (gcc 3.4)
* The similarity to IRIX 'z' (and proposed but never
* implemented IRIX z1, z2 etc) was confusing things.
* If the section is .eh_frame then 'z' means GNU exception
* information 'Augmentation Data' not IRIX 'z'.
* See The Linux Standard Base Core Specification version 3.0
*/
#define DW_DEBUG_FRAME_VERSION 1 /* DWARF2 */
#define DW_DEBUG_FRAME_VERSION3 3 /* DWARF3 */
#define DW_DEBUG_FRAME_VERSION4 4 /* DWARF4 */
/* The following is SGI/IRIX specific, and probably no longer
in use anywhere. */
#define DW_DEBUG_FRAME_AUGMENTER_STRING "mti v1"
/* The value of the offset field for Cie's. */
#define DW_CIE_OFFSET ~(0x0)
/* The augmentation string may be NULL. */
#define DW_EMPTY_STRING ""
#define DW_FRAME_INSTR_OPCODE_SHIFT 6
#define DW_FRAME_INSTR_OFFSET_MASK 0x3f
/*
This struct denotes the rule for a register in a row of
the frame table. In other words, it is one element of
the table.
*/
struct Dwarf_Reg_Rule_s {
/*
Is a flag indicating whether the rule includes the offset
field, ie whether the ru_offset field is valid or not.
Applies only if DW_EXPR_OFFSET or DW_EXPR_VAL_OFFSET.
It is important, since reg+offset (offset of 0) is different from
just 'register' since the former means 'read memory at address
given by the sum of register contents plus offset to get the
value'. whereas the latter means 'the value is in the register'.
The 'register' numbers are either real registers (ie, table
columns defined as real registers) or defined entries that are
not really hardware registers, such as DW_FRAME_SAME_VAL or
DW_FRAME_CFA_COL.
*/
Dwarf_Sbyte ru_is_off;
/* DW_EXPR_OFFSET (0, DWARF2)
DW_EXPR_VAL_OFFSET 1 (dwarf2/3)
DW_EXPR_EXPRESSION 2 (dwarf2/3)
DW_EXPR_VAL_EXPRESSION 3 (dwarf2/3)
See dwarf_frame.h. */
Dwarf_Sbyte ru_value_type;
/* Register involved in this rule. */
Dwarf_Half ru_register;
/* Offset to add to register, if indicated by ru_is_offset
and if DW_EXPR_OFFSET or DW_EXPR_VAL_OFFSET.
If DW_EXPR_EXPRESSION or DW_EXPR_VAL_EXPRESSION
this is DW_FORM_block block-length, not offset. */
Dwarf_Unsigned ru_offset_or_block_len;
/* For DW_EXPR_EXPRESSION DW_EXPR_VAL_EXPRESSION these is set,
else 0. */
Dwarf_Small *ru_block;
};
typedef struct Dwarf_Frame_s *Dwarf_Frame;
/*
This structure represents a row of the frame table.
Fr_loc is the pc value for this row, and Fr_reg
contains the rule for each column.
Entry DW_FRAME_CFA_COL of fr_reg was the tradional MIPS
way of setting CFA. cfa_rule is the new one.
*/
struct Dwarf_Frame_s {
/* Pc value corresponding to this row of the frame table. */
Dwarf_Addr fr_loc;
/* Rules for all the registers in this row. */
struct Dwarf_Reg_Rule_s fr_cfa_rule;
/* fr_reg_count is the the number of
entries of the fr_reg array. */
unsigned long fr_reg_count;
struct Dwarf_Reg_Rule_s *fr_reg;
Dwarf_Frame fr_next;
};
typedef struct Dwarf_Frame_Op_List_s *Dwarf_Frame_Op_List;
/* This is used to chain together Dwarf_Frame_Op structures. */
struct Dwarf_Frame_Op_List_s {
Dwarf_Frame_Op *fl_frame_instr;
Dwarf_Frame_Op_List fl_next;
};
/* See dwarf_frame.c for the heuristics used to set the
Dwarf_Cie ci_augmentation_type.
This succinctly helps interpret the size and meaning of .debug_frame
and (for gcc) .eh_frame.
In the case of gcc .eh_frame (gcc 3.3, 3.4)
z may be followed by one or more of
L R P.
*/
enum Dwarf_augmentation_type {
aug_empty_string, /* Default empty augmentation string. */
aug_irix_exception_table, /* IRIX plain "z",
for exception handling, IRIX CC compiler.
Proposed z1 z2 ... never implemented. */
aug_gcc_eh_z, /* gcc z augmentation, (including
L R P variations). gcc 3.3 3.4 exception
handling in eh_frame. */
aug_irix_mti_v1, /* IRIX "mti v1" augmentation string. Probably
never in any released SGI-IRIX compiler. */
aug_eh, /* For gcc .eh_frame, "eh" is the string.,
gcc 1,2, egcs. Older values. */
aug_armcc, /* "armcc+" meaning the cfa calculation
is corrected to be standard (output by
Arm C RVCT 3.0 SP1 and later). See
http://sourceware.org/ml/gdb-patches/2006-12/msg00249.html
for details. */
aug_unknown, /* Unknown augmentation, we cannot do much. */
aug_past_last
};
/*
This structure contains all the pertinent info for a Cie. Most
of the fields are taken straight from the definition of a Cie.
Ci_cie_start points to the address (in .debug_frame) where this
Cie begins. Ci_cie_instr_start points to the first byte of the
frame instructions for this Cie. Ci_dbg points to the associated
Dwarf_Debug structure. Ci_initial_table is a pointer to the table
row generated by the instructions for this Cie.
*/
struct Dwarf_Cie_s {
Dwarf_Unsigned ci_length;
char *ci_augmentation;
Dwarf_Small ci_code_alignment_factor;
Dwarf_Sbyte ci_data_alignment_factor;
Dwarf_Small ci_return_address_register;
Dwarf_Small *ci_cie_start;
Dwarf_Small *ci_cie_instr_start;
Dwarf_Debug ci_dbg;
Dwarf_Frame ci_initial_table;
Dwarf_Cie ci_next;
Dwarf_Small ci_length_size;
Dwarf_Small ci_extension_size;
Dwarf_Half ci_cie_version_number;
enum Dwarf_augmentation_type ci_augmentation_type;
/* The following 2 for GNU .eh_frame exception handling
Augmentation Data. Set if ci_augmentation_type
is aug_gcc_eh_z. Zero if unused. */
Dwarf_Unsigned ci_gnu_eh_augmentation_len;
Dwarf_Ptr ci_gnu_eh_augmentation_bytes;
/* These are extracted from the gnu eh_frame
augmentation if the
augmentation begins with 'z'. See Linux LSB documents.
Otherwize these are zero. */
unsigned char ci_gnu_personality_handler_encoding;
unsigned char ci_gnu_lsda_encoding;
unsigned char ci_gnu_fde_begin_encoding;
/* If 'P' augmentation present, is handler addr. Else
is zero. */
Dwarf_Addr ci_gnu_personality_handler_addr;
/* In creating list of cie's (which will become an array)
record the position so fde can get it on fde creation. */
Dwarf_Unsigned ci_index;
Dwarf_Small * ci_section_ptr;
/* DWARF4 adds address size and segment size to the CIE: the .debug_info
section may not always be present to allow libdwarf to
find address_size from the compilation-unit. */
Dwarf_Half ci_address_size;
Dwarf_Half ci_segment_size;
};
/*
This structure contains all the pertinent info for a Fde.
Most of the fields are taken straight from the definition.
fd_cie_index is the index of the Cie associated with this
Fde in the list of Cie's for this debug_frame. Fd_cie
points to the corresponsing Dwarf_Cie structure. Fd_fde_start
points to the start address of the Fde. Fd_fde_instr_start
points to the start of the instructions for this Fde. Fd_dbg
points to the associated Dwarf_Debug structure.
*/
struct Dwarf_Fde_s {
Dwarf_Unsigned fd_length;
Dwarf_Addr fd_cie_offset;
Dwarf_Unsigned fd_cie_index;
Dwarf_Cie fd_cie;
Dwarf_Addr fd_initial_location;
Dwarf_Small *fd_initial_loc_pos;
Dwarf_Addr fd_address_range;
Dwarf_Small *fd_fde_start;
Dwarf_Small *fd_fde_instr_start;
Dwarf_Debug fd_dbg;
/* fd_offset_into_exception_tables is SGI/IRIX exception table
offset. Unused and zero if not IRIX .debug_frame. */
Dwarf_Signed fd_offset_into_exception_tables;
Dwarf_Fde fd_next;
Dwarf_Small fd_length_size;
Dwarf_Small fd_extension_size;
/* So we know from an fde which 'count' of fde-s in
Dwarf_Debug applies: eh or standard. */
Dwarf_Small fd_is_eh;
/* The following 2 for GNU .eh_frame exception handling
Augmentation Data. Set if CIE ci_augmentation_type
is aug_gcc_eh_z. Zero if unused. */
Dwarf_Unsigned fd_gnu_eh_augmentation_len;
Dwarf_Ptr fd_gnu_eh_augmentation_bytes;
Dwarf_Addr fd_gnu_eh_lsda; /* If 'L' augmentation letter
present: is address of the
Language Specific Data Area (LSDA). If not 'L" is zero. */
/* The following 3 are about the Elf section the FDEs come from. */
Dwarf_Small * fd_section_ptr;
Dwarf_Unsigned fd_section_length;
Dwarf_Unsigned fd_section_index;
};
int
_dwarf_frame_address_offsets(Dwarf_Debug dbg, Dwarf_Addr ** addrlist,
Dwarf_Off ** offsetlist,
Dwarf_Signed * returncount,
Dwarf_Error * err);
int
_dwarf_get_fde_list_internal(Dwarf_Debug dbg,
Dwarf_Cie ** cie_data,
Dwarf_Signed * cie_element_count,
Dwarf_Fde ** fde_data,
Dwarf_Signed * fde_element_count,
Dwarf_Small * section_ptr,
Dwarf_Unsigned section_index,
Dwarf_Unsigned section_length,
Dwarf_Unsigned cie_id_value,
int use_gnu_cie_calc, /* If non-zero,
this is gcc eh_frame. */
Dwarf_Error * error);
enum Dwarf_augmentation_type
_dwarf_get_augmentation_type(Dwarf_Debug dbg,
Dwarf_Small *augmentation_string,
int is_gcc_eh_frame);
Dwarf_Unsigned _dwarf_get_return_address_reg(Dwarf_Small *frame_ptr,
int version,
unsigned long *size);
/* Temporary recording of crucial cie/fde prefix data.
* Vastly simplifies some argument lists.
*/
struct cie_fde_prefix_s {
/* cf_start_addr is a pointer to the first byte of this fde/cie
we are reading now. */
Dwarf_Small * cf_start_addr;
Dwarf_Small * cf_addr_after_prefix;
Dwarf_Unsigned cf_length;
int cf_local_length_size;
int cf_local_extension_size;
Dwarf_Unsigned cf_cie_id;
Dwarf_Small * cf_cie_id_addr; /* used for eh_frame calculations. */
/* Simplifies passing around these values to create fde having
these here. */
/* cf_section_ptr is a pointer to the first byte
of the object section the prefix is read from. */
Dwarf_Small * cf_section_ptr;
Dwarf_Unsigned cf_section_index;
Dwarf_Unsigned cf_section_length;
};
int
_dwarf_exec_frame_instr(Dwarf_Bool make_instr,
Dwarf_Frame_Op ** ret_frame_instr,
Dwarf_Bool search_pc,
Dwarf_Addr search_pc_val,
Dwarf_Addr initial_loc,
Dwarf_Small * start_instr_ptr,
Dwarf_Small * final_instr_ptr,
Dwarf_Frame table,
Dwarf_Cie cie,
Dwarf_Debug dbg,
Dwarf_Half reg_num_of_cfa,
Dwarf_Sword * returned_count,
int *returned_error);
int dwarf_read_cie_fde_prefix(Dwarf_Debug dbg,
Dwarf_Small *frame_ptr_in,
Dwarf_Small *section_ptr_in,
Dwarf_Unsigned section_index_in,
Dwarf_Unsigned section_length_in,
struct cie_fde_prefix_s *prefix_out,
Dwarf_Error *error);
int dwarf_create_fde_from_after_start(Dwarf_Debug dbg,
struct cie_fde_prefix_s * prefix,
Dwarf_Small *section_pointer,
Dwarf_Small *frame_ptr,
int use_gnu_cie_calc,
Dwarf_Cie cie_ptr_in,
Dwarf_Fde *fde_ptr_out,
Dwarf_Error *error);
int dwarf_create_cie_from_after_start(Dwarf_Debug dbg,
struct cie_fde_prefix_s *prefix,
Dwarf_Small* section_pointer,
Dwarf_Small* frame_ptr,
Dwarf_Unsigned cie_count,
int use_gnu_cie_calc,
Dwarf_Cie *cie_ptr_out,
Dwarf_Error *error);
int _dwarf_frame_constructor(Dwarf_Debug dbg,void * );
void _dwarf_frame_destructor (void *);

View File

@ -0,0 +1,42 @@
/*
Copyright (C) 2000, 2004 Silicon Graphics, Inc. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it
under the terms of version 2.1 of the GNU Lesser General Public License
as published by the Free Software Foundation.
This program is distributed in the hope that it would be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Further, this software is distributed without any warranty that it is
free of the rightful claim of any third person regarding infringement
or the like. Any license provided herein, whether implied or
otherwise, applies only to this software file. Patent licenses, if
any, provided herein do not apply to combinations of this program with
other software, or any other product whatsoever.
You should have received a copy of the GNU Lesser General Public
License along with this program; if not, write the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston MA 02110-1301,
USA.
Contact information: Silicon Graphics, Inc., 1500 Crittenden Lane,
Mountain View, CA 94043, or:
http://www.sgi.com
For further information regarding this notice, see:
http://oss.sgi.com/projects/GenInfo/NoticeExplan
*/
typedef struct Dwarf_Func_Context_s *Dwarf_Func_Context;
/* struct never completed: see dwarf_global.h */

View File

@ -0,0 +1,124 @@
/*
Copyright (C) 2000,2004,2005 Silicon Graphics, Inc. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it
under the terms of version 2.1 of the GNU Lesser General Public License
as published by the Free Software Foundation.
This program is distributed in the hope that it would be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Further, this software is distributed without any warranty that it is
free of the rightful claim of any third person regarding infringement
or the like. Any license provided herein, whether implied or
otherwise, applies only to this software file. Patent licenses, if
any, provided herein do not apply to combinations of this program with
other software, or any other product whatsoever.
You should have received a copy of the GNU Lesser General Public
License along with this program; if not, write the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston MA 02110-1301,
USA.
Contact information: Silicon Graphics, Inc., 1500 Crittenden Lane,
Mountain View, CA 94043, or:
http://www.sgi.com
For further information regarding this notice, see:
http://oss.sgi.com/projects/GenInfo/NoticeExplan
*/
typedef struct Dwarf_Global_Context_s *Dwarf_Global_Context;
/*
This struct contains header information for a set of pubnames.
Essentially, they contain the context for a set of pubnames
belonging to a compilation-unit.
This is also used for the sgi-specific
weaknames, typenames, varnames, funcnames data:
the structs for those are incomplete and
instances of this are used instead.
Also used for DWARF3 .debug_pubtypes.
*/
struct Dwarf_Global_Context_s {
/* Length in .debug_pubnames (etc) of a set of names for a
compilation-unit. Dwarf_Word pu_length; The value is not made
available outside libdwarf and not used inside, so no need to
record it. */
/* For this context, size of a length. 4 or 8 */
unsigned char pu_length_size;
/* For this CU, size of the extension 0 except for dwarf2 extension
64bit, in which case is 4. */
unsigned char pu_extension_size;
/*
Offset into .debug_info of the compilation-unit header (not DIE)
for this set of pubnames. */
Dwarf_Off pu_offset_of_cu_header;
/* Size of compilation-unit that these pubnames are in. */
Dwarf_Unsigned pu_info_length;
Dwarf_Debug pu_dbg;
};
/* This struct contains information for a single pubname. */
struct Dwarf_Global_s {
/*
Offset from the start of the corresponding compilation-unit of
the DIE for the given pubname CU. */
Dwarf_Off gl_named_die_offset_within_cu;
/* Points to the given pubname. */
Dwarf_Small *gl_name;
/* Context for this pubname. */
Dwarf_Global_Context gl_context;
};
int _dwarf_internal_get_pubnames_like_data(Dwarf_Debug dbg,
Dwarf_Small *
section_data_ptr,
Dwarf_Unsigned
section_length,
Dwarf_Global ** globals,
Dwarf_Signed * return_count,
Dwarf_Error * error,
int context_code,
int global_code,
int length_err_num,
int version_err_num);
void
_dwarf_internal_globals_dealloc( Dwarf_Debug dbg, Dwarf_Global *dwgl,
Dwarf_Signed count,
int context_code,
int global_code,
int list_code);
#ifdef __sgi /* __sgi should only be defined for IRIX/MIPS. */
void _dwarf_fix_up_offset_irix(Dwarf_Debug dbg,
Dwarf_Unsigned *varp,
char *caller_site_name);
#define FIX_UP_OFFSET_IRIX_BUG(ldbg,var,name) _dwarf_fix_up_offset_irix(ldbg,&var,name)
#else
#define FIX_UP_OFFSET_IRIX_BUG(ldbg,var,name)
#endif

View File

@ -0,0 +1,31 @@
/*
Copyright (C) 2010 David Anderson. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it
under the terms of version 2.1 of the GNU Lesser General Public License
as published by the Free Software Foundation.
This program is distributed in the hope that it would be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Further, this software is distributed without any warranty that it is
free of the rightful claim of any third person regarding infringement
or the like. Any license provided herein, whether implied or
otherwise, applies only to this software file. Patent licenses, if
any, provided herein do not apply to combinations of this program with
other software, or any other product whatsoever.
You should have received a copy of the GNU Lesser General Public
License along with this program; if not, write the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston MA 02110-1301,
USA.
*/
void dwarf_harmless_init(struct Dwarf_Harmless_s *dhp,unsigned size);
void dwarf_harmless_cleanout(struct Dwarf_Harmless_s *dhp);

View File

@ -0,0 +1,66 @@
/*
Copyright (C) 2000, 2002, 2004 Silicon Graphics, Inc. All Rights Reserved.
Portions Copyright 2008-2010 David Anderson. All rights reserved.
This program is free software; you can redistribute it and/or modify it
under the terms of version 2.1 of the GNU Lesser General Public License
as published by the Free Software Foundation.
This program is distributed in the hope that it would be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Further, this software is distributed without any warranty that it is
free of the rightful claim of any third person regarding infringement
or the like. Any license provided herein, whether implied or
otherwise, applies only to this software file. Patent licenses, if
any, provided herein do not apply to combinations of this program with
other software, or any other product whatsoever.
You should have received a copy of the GNU Lesser General Public
License along with this program; if not, write the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston MA 02110-1301,
USA.
Contact information: Silicon Graphics, Inc., 1500 Crittenden Lane,
Mountain View, CA 94043, or:
http://www.sgi.com
For further information regarding this notice, see:
http://oss.sgi.com/projects/GenInfo/NoticeExplan
*/
#ifndef DWARF_INCL_H
#define DWARF_INCL_H
#if (!defined(HAVE_RAW_LIBELF_OK) && defined(HAVE_LIBELF_OFF64_OK) )
/* At a certain point libelf.h requires _GNU_SOURCE.
here we assume the criteria in configure determine that
usefully.
*/
#define _GNU_SOURCE 1
#endif
#include "libdwarfdefs.h"
#include <string.h>
#ifdef HAVE_ELF_H
#include <elf.h>
#endif
#include <limits.h>
#include <dwarf.h>
#include <libdwarf.h>
#include "dwarf_base_types.h"
#include "dwarf_alloc.h"
#include "dwarf_opaque.h"
#include "dwarf_error.h"
#include "dwarf_util.h"
#endif /* DWARF_INCL_H */

View File

@ -0,0 +1,331 @@
/*
Copyright (C) 2000, 2004, 2006 Silicon Graphics, Inc. All Rights Reserved.
Portions Copyright (C) 2009-2010 David Anderson. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it
under the terms of version 2.1 of the GNU Lesser General Public License
as published by the Free Software Foundation.
This program is distributed in the hope that it would be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Further, this software is distributed without any warranty that it is
free of the rightful claim of any third person regarding infringement
or the like. Any license provided herein, whether implied or
otherwise, applies only to this software file. Patent licenses, if
any, provided herein do not apply to combinations of this program with
other software, or any other product whatsoever.
You should have received a copy of the GNU Lesser General Public
License along with this program; if not, write the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston MA 02110-1301,
USA.
Contact information: Silicon Graphics, Inc., 1500 Crittenden Lane,
Mountain View, CA 94043, or:
http://www.sgi.com
For further information regarding this notice, see:
http://oss.sgi.com/projects/GenInfo/NoticeExplan
*/
#define DW_EXTENDED_OPCODE 0
/*
This is used as the starting value for an algorithm
to get the minimum difference between 2 values.
UINT_MAX is used as our approximation to infinity.
*/
#define MAX_LINE_DIFF UINT_MAX
/* This is for a sanity check on line
table extended opcodes.
It is entirely arbitrary, and 100 is surely too small if
someone was inserting strings in the opcode. */
#define DW_LNE_LEN_MAX 100
/*
This structure is used to build a list of all the
files that are used in the current compilation unit.
All of the fields execpt fi_next have meanings that
are obvious from section 6.2.4 of the Libdwarf Doc.
*/
struct Dwarf_File_Entry_s {
/* Points to string naming the file. */
Dwarf_Small *fi_file_name;
/*
Index into the list of directories of the directory in which
this file exits. */
Dwarf_Sword fi_dir_index;
/* Time of last modification of the file. */
Dwarf_Unsigned fi_time_last_mod;
/* Length in bytes of the file. */
Dwarf_Unsigned fi_file_length;
/* Pointer for chaining file entries. */
Dwarf_File_Entry fi_next;
};
typedef struct Dwarf_Line_Context_s *Dwarf_Line_Context;
/*
This structure provides the context in which the fields of
a Dwarf_Line structure are interpreted. They come from the
statement program prologue. **Updated by dwarf_srclines in
dwarf_line.c.
*/
struct Dwarf_Line_Context_s {
/*
Points to a chain of entries providing info about source files
for the current set of Dwarf_Line structures. File number
'li_file 1' is last on the list, the first list entry is the
file numbered lc_file_entry_count. The numbering of the file
names matches the dwarf2/3 line table specification file table
and DW_LNE_define_file numbering rules. */
Dwarf_File_Entry lc_file_entries;
/*
Count of number of source files for this set of Dwarf_Line
structures. */
Dwarf_Sword lc_file_entry_count;
/*
Points to the portion of .debug_line section that contains a
list of strings naming the included directories. */
Dwarf_Small *lc_include_directories;
/* Count of the number of included directories. */
Dwarf_Sword lc_include_directories_count;
/* Count of the number of lines for this cu. */
Dwarf_Sword lc_line_count;
/* Points to name of compilation directory. */
Dwarf_Small *lc_compilation_directory;
Dwarf_Debug lc_dbg;
Dwarf_Half lc_version_number; /* DWARF2/3 version number, 2
for DWARF2, 3 for DWARF3. */
};
/*
This structure defines a row of the line table.
All of the fields except li_offset have the exact
same meaning that is defined in Section 6.2.2
of the Libdwarf Document.
li_offset is used by _dwarf_addr_finder() which is called
by rqs(1), an sgi utility for 'moving' shared libraries
as if the static linker (ld) had linked the shared library
at the newly-specified address. Most libdwarf-using
apps will ignore li_offset and _dwarf_addr_finder().
*/
struct Dwarf_Line_s {
Dwarf_Addr li_address; /* pc value of machine instr */
union addr_or_line_s {
struct li_inner_s {
Dwarf_Sword li_file; /* int identifying src file */
/* li_file is a number 1-N, indexing into a conceptual
source file table as described in dwarf2/3 spec line
table doc. (see Dwarf_File_Entry lc_file_entries; and
Dwarf_Sword lc_file_entry_count;) */
Dwarf_Sword li_line; /* source file line number. */
Dwarf_Half li_column; /* source file column number */
Dwarf_Small li_isa;
/* To save space, use bit flags. */
/* indicate start of stmt */
unsigned char li_is_stmt:1;
/* indicate start basic block */
unsigned char li_basic_block:1;
/* first post sequence instr */
unsigned char li_end_sequence:1;
unsigned char li_prologue_end:1;
unsigned char li_epilogue_begin:1;
} li_l_data;
Dwarf_Off li_offset; /* for rqs */
} li_addr_line;
Dwarf_Line_Context li_context; /* assoc Dwarf_Line_Context_s */
};
int _dwarf_line_address_offsets(Dwarf_Debug dbg,
Dwarf_Die die,
Dwarf_Addr ** addrs,
Dwarf_Off ** offs,
Dwarf_Unsigned * returncount,
Dwarf_Error * err);
int _dwarf_internal_srclines(Dwarf_Die die,
Dwarf_Line ** linebuf,
Dwarf_Signed * count,
Dwarf_Bool doaddrs,
Dwarf_Bool dolines, Dwarf_Error * error);
/* The LOP, WHAT_IS_OPCODE stuff is here so it can
be reused in 3 places. Seemed hard to keep
the 3 places the same without an inline func or
a macro.
Handling the line section where the header and the
file being processed do not match (unusual, but
planned for in the design of .debug_line)
is too tricky to recode this several times and keep
it right.
As it is the code starting up line-reading is duplicated
and that is just wrong to do. FIXME!
*/
#define LOP_EXTENDED 1
#define LOP_DISCARD 2
#define LOP_STANDARD 3
#define LOP_SPECIAL 4
#define WHAT_IS_OPCODE(type,opcode,base,opcode_length,line_ptr,highest_std) \
if( (opcode) < (base) ) { \
/* we know we must treat as a standard op \
or a special case. \
*/ \
if((opcode) == DW_EXTENDED_OPCODE) { \
type = LOP_EXTENDED; \
} else if( ((highest_std)+1) >= (base)) { \
/* == Standard case: compile of \
dwarf_line.c and object \
have same standard op codes set. \
\
> Special case: compile of dwarf_line.c\
has things in standard op codes list \
in dwarf.h header not \
in the object: handle this as a standard\
op code in switch below. \
The header special ops overlap the \
object standard ops. \
The new standard op codes will not \
appear in the object. \
*/ \
type = LOP_STANDARD; \
} else { \
/* These are standard opcodes in the object\
** that were not defined in the header \
** at the time dwarf_line.c \
** was compiled. Provides the ability of \
** out-of-date dwarf reader to read newer \
** line table data transparently. \
*/ \
type = LOP_DISCARD; \
} \
\
} else { \
/* Is a special op code. \
*/ \
type = LOP_SPECIAL; \
}
/* The following is from the dwarf definition of 'ubyte'
and is specifically mentioned in section 6.2.5.1, page 54
of the Rev 2.0.0 dwarf specification.
*/
#define MAX_LINE_OP_CODE 255
/* The following structs (Line_Table_File_Entry_s,Line_Table_Prefix_s)
and functions allow refactoring common code into a single
reader routine.
*/
/* There can be zero of more of these needed for 1 line prologue. */
struct Line_Table_File_Entry_s {
Dwarf_Small *lte_filename;
Dwarf_Unsigned lte_directory_index;
Dwarf_Unsigned lte_last_modification_time;
Dwarf_Unsigned lte_length_of_file;
};
/* Data picked up from the line table prologue for a single
CU. */
struct Line_Table_Prefix_s {
/* pf_total_length is the value of the length field for the line
table of this CU. So it does not count the length of itself (the
length value) for consistency with the say lenghts recorded in
DWARF2/3. */
Dwarf_Unsigned pf_total_length;
/* Length of the initial length field itself. */
Dwarf_Half pf_length_field_length;
/* The version is 2 for DWARF2, 3 for DWARF3 */
Dwarf_Half pf_version;
Dwarf_Unsigned pf_prologue_length;
Dwarf_Small pf_minimum_instruction_length;
/* Start and end of this CU line area. pf_line_ptr_start +
pf_total_length + pf_length_field_length == pf_line_ptr_end.
Meaning pf_line_ptr_start is before the length info. */
Dwarf_Small *pf_line_ptr_start;
Dwarf_Small *pf_line_ptr_end;
/* Used to check that decoding of the line prologue is done right. */
Dwarf_Small *pf_line_prologue_start;
Dwarf_Small pf_default_is_stmt;
Dwarf_Sbyte pf_line_base;
Dwarf_Small pf_line_range;
/* Highest std opcode (+1). */
Dwarf_Small pf_opcode_base;
/* pf_opcode_base -1 entries (each a count, normally the value of
each entry is 0 or 1). */
Dwarf_Small *pf_opcode_length_table;
Dwarf_Unsigned pf_include_directories_count;
/* Array of pointers to dir strings. pf_include_directories_count
entriesin the array. */
Dwarf_Small **pf_include_directories;
/* Count of entries in line_table_file_entries array. */
Dwarf_Unsigned pf_files_count;
struct Line_Table_File_Entry_s *pf_line_table_file_entries;
/* The number to treat as standard ops. This is a special
accomodation of gcc using the new standard opcodes but not
updating the version number. It's legal dwarf2, but much better
for the user to understand as dwarf3 when 'it looks ok'. */
Dwarf_Bool pf_std_op_count;
};
void dwarf_init_line_table_prefix(struct Line_Table_Prefix_s *pf);
void dwarf_free_line_table_prefix(struct Line_Table_Prefix_s *pf);
int dwarf_read_line_table_prefix(Dwarf_Debug dbg,
Dwarf_Small * data_start,
Dwarf_Unsigned data_length,
Dwarf_Small ** updated_data_start_out,
struct Line_Table_Prefix_s *prefix_out,
/* The following 2 arguments are solely for warning users
* when there is a surprising 'gap' in the .debug_line info. */
Dwarf_Small ** bogus_bytes_ptr,
Dwarf_Unsigned * bogus_bytes_count,
Dwarf_Error * err,
int * err_count_out);

View File

@ -0,0 +1,46 @@
/*
Copyright (C) 2000, 2004 Silicon Graphics, Inc. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it
under the terms of version 2.1 of the GNU Lesser General Public License
as published by the Free Software Foundation.
This program is distributed in the hope that it would be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Further, this software is distributed without any warranty that it is
free of the rightful claim of any third person regarding infringement
or the like. Any license provided herein, whether implied or
otherwise, applies only to this software file. Patent licenses, if
any, provided herein do not apply to combinations of this program with
other software, or any other product whatsoever.
You should have received a copy of the GNU Lesser General Public
License along with this program; if not, write the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston MA 02110-1301,
USA.
Contact information: Silicon Graphics, Inc., 1500 Crittenden Lane,
Mountain View, CA 94043, or:
http://www.sgi.com
For further information regarding this notice, see:
http://oss.sgi.com/projects/GenInfo/NoticeExplan
*/
typedef struct Dwarf_Loc_Chain_s *Dwarf_Loc_Chain;
struct Dwarf_Loc_Chain_s {
Dwarf_Small lc_atom;
Dwarf_Unsigned lc_number;
Dwarf_Unsigned lc_number2;
Dwarf_Unsigned lc_offset;
Dwarf_Loc_Chain lc_next;
};

View File

@ -0,0 +1,44 @@
/*
Copyright (C) 2000, 2004 Silicon Graphics, Inc. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it
under the terms of version 2.1 of the GNU Lesser General Public License
as published by the Free Software Foundation.
This program is distributed in the hope that it would be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Further, this software is distributed without any warranty that it is
free of the rightful claim of any third person regarding infringement
or the like. Any license provided herein, whether implied or
otherwise, applies only to this software file. Patent licenses, if
any, provided herein do not apply to combinations of this program with
other software, or any other product whatsoever.
You should have received a copy of the GNU Lesser General Public
License along with this program; if not, write the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston MA 02110-1301,
USA.
Contact information: Silicon Graphics, Inc., 1500 Crittenden Lane,
Mountain View, CA 94043, or:
http://www.sgi.com
For further information regarding this notice, see:
http://oss.sgi.com/projects/GenInfo/NoticeExplan
*/
/*
dwarf_macro.h
$Revision: 1.4 $ $Date: 2004/10/28 22:19:14 $
*/

View File

@ -0,0 +1,339 @@
/*
Copyright (C) 2000-2005 Silicon Graphics, Inc. All Rights Reserved.
Portions Copyright (C) 2007-2010 David Anderson. All Rights Reserved.
Portions Copyright (C) 2008-2010 Arxan Technologies, Inc. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it
under the terms of version 2.1 of the GNU Lesser General Public License
as published by the Free Software Foundation.
This program is distributed in the hope that it would be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Further, this software is distributed without any warranty that it is
free of the rightful claim of any third person regarding infringement
or the like. Any license provided herein, whether implied or
otherwise, applies only to this software file. Patent licenses, if
any, provided herein do not apply to combinations of this program with
other software, or any other product whatsoever.
You should have received a copy of the GNU Lesser General Public
License along with this program; if not, write the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston MA 02110-1301,
USA.
Contact information: Silicon Graphics, Inc., 1500 Crittenden Lane,
Mountain View, CA 94043, or:
http://www.sgi.com
For further information regarding this notice, see:
http://oss.sgi.com/projects/GenInfo/NoticeExplan
*/
/* The versions applicable by section are:
DWARF2 DWARF3 DWARF4
.debug_abbrev - - -
.debug_aranges 2 2 2
.debug_frame 1 3 4
.debug_info 2 3 4
.debug_line 2 3 4
.debug_loc - - -
.debug_macinfo - - -
.debug_pubtypes x 2 2
.debug_pubnames 2 2 2
.debug_ranges x - -
.debug_str - - -
.debug_types x x 4
*/
#include <stddef.h>
struct Dwarf_Die_s {
Dwarf_Byte_Ptr di_debug_info_ptr;
Dwarf_Abbrev_List di_abbrev_list;
Dwarf_CU_Context di_cu_context;
int di_abbrev_code;
};
struct Dwarf_Attribute_s {
Dwarf_Half ar_attribute; /* Attribute Value. */
Dwarf_Half ar_attribute_form; /* Attribute Form. */
Dwarf_Half ar_attribute_form_direct;
/* Identical to ar_attribute_form except that if
the original form uleb was DW_FORM_indirect,
ar_attribute_form_direct contains DW_FORM_indirect
but ar_attribute_form contains the true form. */
Dwarf_CU_Context ar_cu_context;
Dwarf_Small *ar_debug_info_ptr;
Dwarf_Attribute ar_next;
};
/*
This structure provides the context for a compilation unit.
Thus, it contains the Dwarf_Debug, cc_dbg, that this cu
belongs to. It contains the information in the compilation
unit header, cc_length, cc_version_stamp, cc_abbrev_offset,
and cc_address_size, in the .debug_info section for that cu.
In addition, it contains the count, cc_count_cu, of the cu
number of that cu in the list of cu's in the .debug_info.
The count starts at 1, ie cc_count_cu is 1 for the first cu,
2 for the second and so on. This struct also contains a
pointer, cc_abbrev_table, to a list of pairs of abbrev code
and a pointer to the start of that abbrev
in the .debug_abbrev section.
Each die will also contain a pointer to such a struct to
record the context for that die.
Notice that a pointer to the CU DIE itself is
Dwarf_Off off2 = cu_context->cc_debug_info_offset;
cu_die_info_ptr = dbg->de_debug_info.dss_data +
off2 + _dwarf_length_of_cu_header(dbg, off2);
**Updated by dwarf_next_cu_header in dwarf_die_deliv.c
*/
struct Dwarf_CU_Context_s {
Dwarf_Debug cc_dbg;
/* The sum of cc_length, cc_length_size, and cc_extension_size
is the total length of the CU including its header. */
Dwarf_Word cc_length;
/* cc_length_size is the size in bytes of an offset.
4 for 32bit dwarf, 8 for 64bit dwarf (whether MIPS/IRIX
64bit dwarf or standard 64bit dwarf using the extension
mechanism). */
Dwarf_Small cc_length_size;
/* cc_extension_size is zero unless this is standard
DWARF3 and later 64bit dwarf using the extension mechanism.
If it is the DWARF3 and later 64bit dwarf cc_extension
size is 4. So for 32bit dwarf and MIPS/IRIX 64bit dwarf
cc_extension_size is zero. */
Dwarf_Small cc_extension_size;
Dwarf_Half cc_version_stamp;
Dwarf_Sword cc_abbrev_offset;
Dwarf_Small cc_address_size;
/* cc_debug_info_offset is the offset in the section
of the CU header of this CU. Dwarf_Word
should be large enough. */
Dwarf_Word cc_debug_info_offset;
Dwarf_Byte_Ptr cc_last_abbrev_ptr;
Dwarf_Hash_Table cc_abbrev_hash_table;
Dwarf_CU_Context cc_next;
/*unsigned char cc_offset_length; */
};
/* Consolidates section-specific data in one place.
Section is an Elf specific term, intended as a general
term (for non-Elf objects some code must synthesize the
values somehow).
Makes adding more section-data much simpler. */
struct Dwarf_Section_s {
Dwarf_Small * dss_data;
Dwarf_Unsigned dss_size;
Dwarf_Word dss_index;
/* dss_addr is the 'section address' which is only
non-zero for a GNU eh section.
Purpose: to handle DW_EH_PE_pcrel encoding. Leaving
it zero is fine for non-elf. */
Dwarf_Addr dss_addr;
Dwarf_Small dss_data_was_malloc;
/* For non-elf, leaving the following fields zero
will mean they are ignored. */
/* dss_link should be zero unless a section has a link
to another (sh_link). Used to access relocation data for
a section (and for symtab section, access its strtab). */
Dwarf_Word dss_link;
/* The following is used when reading .rela sections
(such sections appear in some .o files). */
Dwarf_Half dss_reloc_index; /* Zero means ignore the reloc fields. */
Dwarf_Small * dss_reloc_data;
Dwarf_Unsigned dss_reloc_size;
Dwarf_Addr dss_reloc_addr;
/* dss_reloc_symtab is the sh_link of a .rela to its .symtab, leave
it 0 if non-meaningful. */
Dwarf_Addr dss_reloc_symtab;
/* dss_reloc_link should be zero unless a reloc section has a link
to another (sh_link). Used to access the symtab for relocations
a section. */
Dwarf_Word dss_reloc_link;
/* Pointer to the elf symtab, used for elf .rela. Leave it 0
if not relevant. */
struct Dwarf_Section_s *dss_symtab;
};
/* Overview: if next_to_use== first, no error slots are used.
If next_to_use+1 (mod maxcount) == first the slots are all used
*/
struct Dwarf_Harmless_s {
unsigned dh_maxcount;
unsigned dh_next_to_use;
unsigned dh_first;
unsigned dh_errs_count;
char ** dh_errors;
};
struct Dwarf_Debug_s {
/* All file access methods and support data
are hidden in this structure.
We get a pointer, callers control the lifetime of the
structure and contents. */
struct Dwarf_Obj_Access_Interface_s *de_obj_file;
Dwarf_Handler de_errhand;
Dwarf_Ptr de_errarg;
/*
Context for the compilation_unit just read by a call to
dwarf_next_cu_header. **Updated by dwarf_next_cu_header in
dwarf_die_deliv.c */
Dwarf_CU_Context de_cu_context;
/*
Points to linked list of CU Contexts for the CU's already read.
These are only CU's read by dwarf_next_cu_header(). */
Dwarf_CU_Context de_cu_context_list;
/*
Points to the last CU Context added to the list by
dwarf_next_cu_header(). */
Dwarf_CU_Context de_cu_context_list_end;
/*
This is the list of CU contexts read for dwarf_offdie(). These
may read ahead of dwarf_next_cu_header(). */
Dwarf_CU_Context de_offdie_cu_context;
Dwarf_CU_Context de_offdie_cu_context_end;
/* Offset of last byte of last CU read. */
Dwarf_Word de_info_last_offset;
/*
Number of bytes in the length, and offset field in various
.debug_* sections. It's not very meaningful, and is
only used in one 'approximate' calculation. */
Dwarf_Small de_length_size;
/* number of bytes in a pointer of the target in various .debug_
sections. 4 in 32bit, 8 in MIPS 64, ia64. */
Dwarf_Small de_pointer_size;
/* set at creation of a Dwarf_Debug to say if form_string should be
checked for valid length at every call. 0 means do the check.
non-zero means do not do the check. */
Dwarf_Small de_assume_string_in_bounds;
/*
Dwarf_Alloc_Hdr_s structs used to manage chunks that are
malloc'ed for each allocation type for structs. */
struct Dwarf_Alloc_Hdr_s de_alloc_hdr[ALLOC_AREA_REAL_TABLE_MAX];
#ifdef DWARF_SIMPLE_MALLOC
struct simple_malloc_record_s * de_simple_malloc_base;
#endif
/*
These fields are used to process debug_frame section. **Updated
by dwarf_get_fde_list in dwarf_frame.h */
/*
Points to contiguous block of pointers to Dwarf_Cie_s structs. */
Dwarf_Cie *de_cie_data;
/* Count of number of Dwarf_Cie_s structs. */
Dwarf_Signed de_cie_count;
/* Keep eh (GNU) separate!. */
Dwarf_Cie *de_cie_data_eh;
Dwarf_Signed de_cie_count_eh;
/*
Points to contiguous block of pointers to Dwarf_Fde_s structs. */
Dwarf_Fde *de_fde_data;
/* Count of number of Dwarf_Fde_s structs. */
Dwarf_Signed de_fde_count;
/* Keep eh (GNU) separate!. */
Dwarf_Fde *de_fde_data_eh;
Dwarf_Signed de_fde_count_eh;
struct Dwarf_Section_s de_debug_info;
struct Dwarf_Section_s de_debug_abbrev;
struct Dwarf_Section_s de_debug_line;
struct Dwarf_Section_s de_debug_loc;
struct Dwarf_Section_s de_debug_aranges;
struct Dwarf_Section_s de_debug_macinfo;
struct Dwarf_Section_s de_debug_pubnames;
struct Dwarf_Section_s de_debug_str;
struct Dwarf_Section_s de_debug_frame;
/* gnu: the g++ eh_frame section */
struct Dwarf_Section_s de_debug_frame_eh_gnu;
struct Dwarf_Section_s de_debug_pubtypes; /* DWARF3 .debug_pubtypes */
struct Dwarf_Section_s de_debug_funcnames;
struct Dwarf_Section_s de_debug_typenames; /* SGI IRIX extension essentially
identical to DWARF3 .debug_pubtypes. */
struct Dwarf_Section_s de_debug_varnames;
struct Dwarf_Section_s de_debug_weaknames;
struct Dwarf_Section_s de_debug_ranges;
/* For non-elf, simply leave the following two structs zeroed and
they will be ignored. */
struct Dwarf_Section_s de_elf_symtab;
struct Dwarf_Section_s de_elf_strtab;
void *(*de_copy_word) (void *, const void *, size_t);
unsigned char de_same_endian;
unsigned char de_elf_must_close; /* if non-zero, then
it was dwarf_init (not dwarf_elf_init)
so must elf_end() */
/* Default is DW_FRAME_INITIAL_VALUE from header. */
Dwarf_Half de_frame_rule_initial_value;
/* Default is DW_FRAME_LAST_REG_NUM. */
Dwarf_Half de_frame_reg_rules_entry_count;
Dwarf_Half de_frame_cfa_col_number;
Dwarf_Half de_frame_same_value_number;
Dwarf_Half de_frame_undefined_value_number;
unsigned char de_big_endian_object; /* non-zero if big-endian
object opened. */
struct Dwarf_Harmless_s de_harmless_errors;
};
typedef struct Dwarf_Chain_s *Dwarf_Chain;
struct Dwarf_Chain_s {
void *ch_item;
Dwarf_Chain ch_next;
};
#define CURRENT_VERSION_STAMP 2 /* DWARF2 */
#define CURRENT_VERSION_STAMP3 3 /* DWARF3 */
#define CURRENT_VERSION_STAMP4 4 /* DWARF4 */
/* Size of cu header version stamp field. */
#define CU_VERSION_STAMP_SIZE sizeof(Dwarf_Half)
/* Size of cu header address size field. */
#define CU_ADDRESS_SIZE_SIZE sizeof(Dwarf_Small)
void *_dwarf_memcpy_swap_bytes(void *s1, const void *s2, size_t len);
#define ORIGINAL_DWARF_OFFSET_SIZE 4
#define DISTINGUISHED_VALUE 0xffffffff
#define DISTINGUISHED_VALUE_OFFSET_SIZE 8
/*
We don't load the sections until they are needed. This function is
used to load the section.
*/
int _dwarf_load_section(Dwarf_Debug,
struct Dwarf_Section_s *,
Dwarf_Error *);

View File

@ -0,0 +1,41 @@
/*
Copyright (C) 2000,2004 Silicon Graphics, Inc. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it
under the terms of version 2.1 of the GNU Lesser General Public License
as published by the Free Software Foundation.
This program is distributed in the hope that it would be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Further, this software is distributed without any warranty that it is
free of the rightful claim of any third person regarding infringement
or the like. Any license provided herein, whether implied or
otherwise, applies only to this software file. Patent licenses, if
any, provided herein do not apply to combinations of this program with
other software, or any other product whatsoever.
You should have received a copy of the GNU Lesser General Public
License along with this program; if not, write the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston MA 02110-1301,
USA.
Contact information: Silicon Graphics, Inc., 1500 Crittenden Lane,
Mountain View, CA 94043, or:
http://www.sgi.com
For further information regarding this notice, see:
http://oss.sgi.com/projects/GenInfo/NoticeExplan
*/
typedef struct Dwarf_Type_Context_s *Dwarf_Type_Context;
/* type never completed see dwarf_global.h */

View File

@ -0,0 +1,311 @@
#ifndef DWARF_UTIL_H
#define DWARF_UTIL_H
/*
Copyright (C) 2000,2003,2004 Silicon Graphics, Inc. All Rights Reserved.
Portions Copyright (C) 2007-2010 David Anderson. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it
under the terms of version 2.1 of the GNU Lesser General Public License
as published by the Free Software Foundation.
This program is distributed in the hope that it would be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Further, this software is distributed without any warranty that it is
free of the rightful claim of any third person regarding infringement
or the like. Any license provided herein, whether implied or
otherwise, applies only to this software file. Patent licenses, if
any, provided herein do not apply to combinations of this program with
other software, or any other product whatsoever.
You should have received a copy of the GNU Lesser General Public
License along with this program; if not, write the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston MA 02110-1301,
USA.
Contact information: Silicon Graphics, Inc., 1500 Crittenden Lane,
Mountain View, CA 94043, or:
http://www.sgi.com
For further information regarding this notice, see:
http://oss.sgi.com/projects/GenInfo/NoticeExplan
*/
/* The address of the Free Software Foundation is
Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
Boston, MA 02110-1301, USA.
SGI has moved from the Crittenden Lane address.
*/
/*
Decodes unsigned leb128 encoded numbers.
Make sure ptr is a pointer to a 1-byte type.
In 2003 and earlier this was a hand-inlined
version of _dwarf_decode_u_leb128() which did
not work correctly if Dwarf_Word was 64 bits.
*/
#define DECODE_LEB128_UWORD(ptr, value) \
do { \
Dwarf_Word uleblen; \
value = _dwarf_decode_u_leb128(ptr,&uleblen); \
ptr += uleblen; \
} while (0)
/*
Decodes signed leb128 encoded numbers.
Make sure ptr is a pointer to a 1-byte type.
In 2003 and earlier this was a hand-inlined
version of _dwarf_decode_s_leb128() which did
not work correctly if Dwarf_Word was 64 bits.
*/
#define DECODE_LEB128_SWORD(ptr, value) \
do { \
Dwarf_Word sleblen; \
value = _dwarf_decode_s_leb128(ptr,&sleblen); \
ptr += sleblen; \
} while(0)
/*
Skips leb128_encoded numbers that are guaranteed
to be no more than 4 bytes long. Same for both
signed and unsigned numbers.
*/
#define SKIP_LEB128_WORD(ptr) \
do{ if ((*(ptr++) & 0x80) != 0) { \
if ((*(ptr++) & 0x80) != 0) { \
if ((*(ptr++) & 0x80) != 0) { \
if ((*(ptr++) & 0x80) != 0) { \
} \
} \
} \
} } while (0)
#define CHECK_DIE(die, error_ret_value) \
do {if (die == NULL) { \
_dwarf_error(NULL, error, DW_DLE_DIE_NULL); \
return(error_ret_value); \
} \
if (die->di_cu_context == NULL) { \
_dwarf_error(NULL, error, DW_DLE_DIE_NO_CU_CONTEXT); \
return(error_ret_value); \
} \
if (die->di_cu_context->cc_dbg == NULL) { \
_dwarf_error(NULL, error, DW_DLE_DBG_NULL); \
return(error_ret_value); \
} \
} while (0)
/*
Reads 'source' for 'length' bytes from unaligned addr.
Avoids any constant-in-conditional warnings and
avoids a test in the generated code (for non-const cases,
which are in the majority.)
Uses a temp to avoid the test.
The decl here should avoid any problem of size in the temp.
This code is ENDIAN DEPENDENT
The memcpy args are the endian issue.
*/
typedef Dwarf_Unsigned BIGGEST_UINT;
#ifdef WORDS_BIGENDIAN
#define READ_UNALIGNED(dbg,dest,desttype, source, length) \
do { \
BIGGEST_UINT _ltmp = 0; \
dbg->de_copy_word( (((char *)(&_ltmp)) + sizeof(_ltmp) - length), \
source, length) ; \
dest = (desttype)_ltmp; \
} while (0)
/*
This macro sign-extends a variable depending on the length.
It fills the bytes between the size of the destination and
the length with appropriate padding.
This code is ENDIAN DEPENDENT but dependent only
on host endianness, not object file endianness.
The memcpy args are the issue.
*/
#define SIGN_EXTEND(dest, length) \
do {if (*(Dwarf_Sbyte *)((char *)&dest + sizeof(dest) - length) < 0) {\
memcpy((char *)&dest, "\xff\xff\xff\xff\xff\xff\xff\xff", \
sizeof(dest) - length); \
} \
} while (0)
#else /* LITTLE ENDIAN */
#define READ_UNALIGNED(dbg,dest,desttype, source, length) \
do { \
BIGGEST_UINT _ltmp = 0; \
dbg->de_copy_word( (char *)(&_ltmp) , \
source, length) ; \
dest = (desttype)_ltmp; \
} while (0)
/*
This macro sign-extends a variable depending on the length.
It fills the bytes between the size of the destination and
the length with appropriate padding.
This code is ENDIAN DEPENDENT but dependent only
on host endianness, not object file endianness.
The memcpy args are the issue.
*/
#define SIGN_EXTEND(dest, length) \
do {if (*(Dwarf_Sbyte *)((char *)&dest + (length-1)) < 0) {\
memcpy((char *)&dest+length, \
"\xff\xff\xff\xff\xff\xff\xff\xff", \
sizeof(dest) - length); \
} \
} while (0)
#endif /* ! LITTLE_ENDIAN */
/*
READ_AREA LENGTH reads the length (the older way
of pure 32 or 64 bit
or the new proposed dwarfv2.1 64bit-extension way)
It reads the bits from where rw_src_data_p points to
and updates the rw_src_data_p to point past what was just read.
It updates w_length_size (to the size of an offset, either 4 or 8)
and w_exten_size (set 0 unless this frame has the DWARF3,4 64bit
extension, in which case w_exten_size is set to 4).
r_dbg is just the current dbg pointer.
w_target is the output length field.
r_targtype is the output type. Always Dwarf_Unsigned so far.
*/
/* This one handles the v2.1 64bit extension
and 32bit (and MIPS fixed 64 bit via the
dwarf_init-set r_dbg->de_length_size)..
It does not recognize any but the one distingushed value
(the only one with defined meaning).
It assumes that no CU will have a length
0xffffffxx (32bit length)
or
0xffffffxx xxxxxxxx (64bit length)
which makes possible auto-detection of the extension.
This depends on knowing that only a non-zero length
is legitimate (AFAICT), and for IRIX non-standard -64
dwarf that the first 32 bits of the 64bit offset will be
zero (because the compiler could not handle a truly large
value as of Jan 2003 and because no app has that much debug
info anyway, at least not in the IRIX case).
At present not testing for '64bit elf' here as that
does not seem necessary (none of the 64bit length seems
appropriate unless it's ident[EI_CLASS] == ELFCLASS64).
*/
# define READ_AREA_LENGTH(r_dbg,w_target,r_targtype, \
rw_src_data_p,w_length_size,w_exten_size) \
do { READ_UNALIGNED(r_dbg,w_target,r_targtype, \
rw_src_data_p, ORIGINAL_DWARF_OFFSET_SIZE); \
if(w_target == DISTINGUISHED_VALUE) { \
/* dwarf3 64bit extension */ \
w_length_size = DISTINGUISHED_VALUE_OFFSET_SIZE; \
rw_src_data_p += ORIGINAL_DWARF_OFFSET_SIZE; \
w_exten_size = ORIGINAL_DWARF_OFFSET_SIZE; \
READ_UNALIGNED(r_dbg,w_target,r_targtype, \
rw_src_data_p, DISTINGUISHED_VALUE_OFFSET_SIZE);\
rw_src_data_p += DISTINGUISHED_VALUE_OFFSET_SIZE; \
} else { \
if(w_target == 0 && r_dbg->de_big_endian_object) { \
/* IRIX 64 bit, big endian. This test */ \
/* is not a truly precise test, a precise test */ \
/* would check if the target was IRIX. */ \
READ_UNALIGNED(r_dbg,w_target,r_targtype, \
rw_src_data_p, DISTINGUISHED_VALUE_OFFSET_SIZE); \
w_length_size = DISTINGUISHED_VALUE_OFFSET_SIZE; \
rw_src_data_p += DISTINGUISHED_VALUE_OFFSET_SIZE; \
w_exten_size = 0; \
} else { \
/* standard 32 bit dwarf2/dwarf3 */ \
w_exten_size = 0; \
w_length_size = ORIGINAL_DWARF_OFFSET_SIZE; \
rw_src_data_p += w_length_size; \
} \
} } while(0)
Dwarf_Unsigned
_dwarf_decode_u_leb128(Dwarf_Small * leb128,
Dwarf_Word * leb128_length);
Dwarf_Signed
_dwarf_decode_s_leb128(Dwarf_Small * leb128,
Dwarf_Word * leb128_length);
Dwarf_Unsigned
_dwarf_get_size_of_val(Dwarf_Debug dbg,
Dwarf_Unsigned form,
Dwarf_Half address_size,
Dwarf_Small * val_ptr,
int v_length_size);
struct Dwarf_Hash_Table_Entry_s;
/* This single struct is the base for the hash table.
The intent is that once the total_abbrev_count across
all the entries is greater than 10*current_table_entry_count
one should build a new Dwarf_Hash_Table_Base_s, rehash
all the existing entries, and delete the old table and entries.
(10 is a heuristic, nothing magic about it, but once the
count gets to 30 or 40 times current_table_entry_count
things really slow down a lot. One (500MB) application had
127000 abbreviations in one compilation unit)
The incoming 'code' is an abbrev number and those simply
increase linearly so the hashing is perfect always.
*/
struct Dwarf_Hash_Table_s {
unsigned long tb_table_entry_count;
unsigned long tb_total_abbrev_count;
/* Each table entry is a list of abbreviations. */
struct Dwarf_Hash_Table_Entry_s *tb_entries;
};
/*
This struct is used to build a hash table for the
abbreviation codes for a compile-unit.
*/
struct Dwarf_Hash_Table_Entry_s {
Dwarf_Abbrev_List at_head;
};
Dwarf_Abbrev_List
_dwarf_get_abbrev_for_code(Dwarf_CU_Context cu_context,
Dwarf_Unsigned code);
/* return 1 if string ends before 'endptr' else
** return 0 meaning string is not properly terminated.
** Presumption is the 'endptr' pts to end of some dwarf section data.
*/
int _dwarf_string_valid(void *startptr, void *endptr);
Dwarf_Unsigned _dwarf_length_of_cu_header(Dwarf_Debug,
Dwarf_Unsigned offset);
Dwarf_Unsigned _dwarf_length_of_cu_header_simple(Dwarf_Debug);
int _dwarf_load_debug_info(Dwarf_Debug dbg, Dwarf_Error *error);
void _dwarf_free_abbrev_hash_table_contents(Dwarf_Debug dbg,
struct Dwarf_Hash_Table_s* hash_table);
int _dwarf_get_address_size(Dwarf_Debug dbg, Dwarf_Die die);
#endif /* DWARF_UTIL_H */

View File

@ -0,0 +1,41 @@
/*
Copyright (C) 2000,2004 Silicon Graphics, Inc. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it
under the terms of version 2.1 of the GNU Lesser General Public License
as published by the Free Software Foundation.
This program is distributed in the hope that it would be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Further, this software is distributed without any warranty that it is
free of the rightful claim of any third person regarding infringement
or the like. Any license provided herein, whether implied or
otherwise, applies only to this software file. Patent licenses, if
any, provided herein do not apply to combinations of this program with
other software, or any other product whatsoever.
You should have received a copy of the GNU Lesser General Public
License along with this program; if not, write the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston MA 02110-1301,
USA.
Contact information: Silicon Graphics, Inc., 1500 Crittenden Lane,
Mountain View, CA 94043, or:
http://www.sgi.com
For further information regarding this notice, see:
http://oss.sgi.com/projects/GenInfo/NoticeExplan
*/
typedef struct Dwarf_Var_Context_s *Dwarf_Var_Context;
/* struct never completed: see dwarf_global.h */

View File

@ -0,0 +1,41 @@
/*
Copyright (C) 2000,2004 Silicon Graphics, Inc. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it
under the terms of version 2.1 of the GNU Lesser General Public License
as published by the Free Software Foundation.
This program is distributed in the hope that it would be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Further, this software is distributed without any warranty that it is
free of the rightful claim of any third person regarding infringement
or the like. Any license provided herein, whether implied or
otherwise, applies only to this software file. Patent licenses, if
any, provided herein do not apply to combinations of this program with
other software, or any other product whatsoever.
You should have received a copy of the GNU Lesser General Public
License along with this program; if not, write the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston MA 02110-1301,
USA.
Contact information: Silicon Graphics, Inc., 1500 Crittenden Lane,
Mountain View, CA 94043, or:
http://www.sgi.com
For further information regarding this notice, see:
http://oss.sgi.com/projects/GenInfo/NoticeExplan
*/
typedef struct Dwarf_Weak_Context_s *Dwarf_Weak_Context;
/* struct never completed: see dwarf_global.h */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,91 @@
/*
Copyright (C) 2000,2004 Silicon Graphics, Inc. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it
under the terms of version 2.1 of the GNU Lesser General Public License
as published by the Free Software Foundation.
This program is distributed in the hope that it would be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Further, this software is distributed without any warranty that it is
free of the rightful claim of any third person regarding infringement
or the like. Any license provided herein, whether implied or
otherwise, applies only to this software file. Patent licenses, if
any, provided herein do not apply to combinations of this program with
other software, or any other product whatsoever.
You should have received a copy of the GNU Lesser General Public
License along with this program; if not, write the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston MA 02110-1301,
USA.
Contact information: Silicon Graphics, Inc., 1500 Crittenden Lane,
Mountain View, CA 94043, or:
http://www.sgi.com
For further information regarding this notice, see:
http://oss.sgi.com/projects/GenInfo/NoticeExplan
*/
/* libdwarfdefs.h
*/
#ifndef LIBDWARFDEFS_H
#define LIBDWARFDEFS_H
/* We want __uint32_t and __uint64_t and __int32_t __int64_t
properly defined but not duplicated, since duplicate typedefs
are not legal C.
*/
/*
HAVE___UINT32_T
HAVE___UINT64_T will be set by configure if
our 4 types are predefined in compiler
*/
#if (!defined(HAVE___UINT32_T)) && defined(HAVE___UINT32_T_IN_SGIDEFS_H)
#include <sgidefs.h> /* sgidefs.h defines them */
#define HAVE___UINT32_T 1
#endif
#if (!defined(HAVE___UINT64_T)) && defined(HAVE___UINT64_T_IN_SGIDEFS_H)
#include <sgidefs.h> /* sgidefs.h defines them */
#define HAVE___UINT64_T 1
#endif
#if (!defined(HAVE___UINT32_T)) && \
defined(HAVE_SYS_TYPES_H) && \
defined(HAVE___UINT32_T_IN_SYS_TYPES_H)
# include <sys/types.h>
#define HAVE___UINT32_T 1
#endif
#if (!defined(HAVE___UINT64_T)) && \
defined(HAVE_SYS_TYPES_H) && \
defined(HAVE___UINT64_T_IN_SYS_TYPES_H)
# include <sys/types.h>
#define HAVE___UINT64_T 1
#endif
#ifndef HAVE___UINT32_T
typedef int __int32_t;
typedef unsigned __uint32_t;
#define HAVE___UINT32_T 1
#endif
#ifndef HAVE___UINT64_T
typedef long long __int64_t;
typedef unsigned long long __uint64_t;
#define HAVE___UINT64_T 1
#endif
#endif /* LIBDWARFDEFS_H */

View File

@ -0,0 +1,62 @@
/*
Copyright (C) 2005 Silicon Graphics, Inc. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it
under the terms of version 2.1 of the GNU Lesser General Public License
as published by the Free Software Foundation.
This program is distributed in the hope that it would be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Further, this software is distributed without any warranty that it is
free of the rightful claim of any third person regarding infringement
or the like. Any license provided herein, whether implied or
otherwise, applies only to this software file. Patent licenses, if
any, provided herein do not apply to combinations of this program with
other software, or any other product whatsoever.
You should have received a copy of the GNU Lesser General Public
License along with this program; if not, write the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston MA 02110-1301,
USA.
Contact information: Silicon Graphics, Inc., 1500 Crittenden Lane,
Mountain View, CA 94043, or:
http://www.sgi.com
For further information regarding this notice, see:
http://oss.sgi.com/projects/GenInfo/NoticeExplan
*/
/* malloc_check.h */
/* A simple libdwarf-aware malloc checker.
define WANT_LIBBDWARF_MALLOC_CHECK and rebuild libdwarf
do make a checking-for-alloc-mistakes libdwarf.
NOT recommended for production use.
When defined, also add malloc_check.c to the list of
files in Makefile.
*/
#undef WANT_LIBBDWARF_MALLOC_CHECK
/*#define WANT_LIBBDWARF_MALLOC_CHECK 1 */
#ifdef WANT_LIBBDWARF_MALLOC_CHECK
void dwarf_malloc_check_alloc_data(void * addr,unsigned char code);
void dwarf_malloc_check_dealloc_data(void * addr,unsigned char code);
void dwarf_malloc_check_complete(char *wheremsg); /* called at exit of app */
#else /* !WANT_LIBBDWARF_MALLOC_CHECK */
#define dwarf_malloc_check_alloc_data(a,b) /* nothing */
#define dwarf_malloc_check_dealloc_data(a,b) /* nothing */
#define dwarf_malloc_check_complete(a) /* nothing */
#endif /* WANT_LIBBDWARF_MALLOC_CHECK */

View File

@ -0,0 +1,42 @@
/*
Copyright (C) 2000,2004 Silicon Graphics, Inc. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it
under the terms of version 2.1 of the GNU Lesser General Public License
as published by the Free Software Foundation.
This program is distributed in the hope that it would be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Further, this software is distributed without any warranty that it is
free of the rightful claim of any third person regarding infringement
or the like. Any license provided herein, whether implied or
otherwise, applies only to this software file. Patent licenses, if
any, provided herein do not apply to combinations of this program with
other software, or any other product whatsoever.
You should have received a copy of the GNU Lesser General Public
License along with this program; if not, write the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston MA 02110-1301,
USA.
Contact information: Silicon Graphics, Inc., 1500 Crittenden Lane,
Mountain View, CA 94043, or:
http://www.sgi.com
For further information regarding this notice, see:
http://oss.sgi.com/projects/GenInfo/NoticeExplan
*/
Dwarf_Ptr _dwarf_p_get_alloc(Dwarf_P_Debug, Dwarf_Unsigned);
void _dwarf_p_dealloc(Dwarf_P_Debug dbg, Dwarf_Small * ptr);
void _dwarf_p_dealloc_all(Dwarf_P_Debug dbg);

View File

@ -0,0 +1,62 @@
/*
Copyright (C) 2000,2004 Silicon Graphics, Inc. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it
under the terms of version 2.1 of the GNU Lesser General Public License
as published by the Free Software Foundation.
This program is distributed in the hope that it would be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Further, this software is distributed without any warranty that it is
free of the rightful claim of any third person regarding infringement
or the like. Any license provided herein, whether implied or
otherwise, applies only to this software file. Patent licenses, if
any, provided herein do not apply to combinations of this program with
other software, or any other product whatsoever.
You should have received a copy of the GNU Lesser General Public
License along with this program; if not, write the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston MA 02110-1301,
USA.
Contact information: Silicon Graphics, Inc., 1500 Crittenden Lane,
Mountain View, CA 94043, or:
http://www.sgi.com
For further information regarding this notice, see:
http://oss.sgi.com/projects/GenInfo/NoticeExplan
*/
/*
If ag_end_symbol_index is zero,
ag_length must be known and non-zero.
Deals with length being known costant or fr
assembler output, not known.
*/
struct Dwarf_P_Arange_s {
Dwarf_Addr ag_begin_address; /* known address or for
symbolic assem output,
offset of symbol */
Dwarf_Addr ag_length; /* zero or address or offset */
Dwarf_Unsigned ag_symbol_index;
Dwarf_P_Arange ag_next;
Dwarf_Unsigned ag_end_symbol_index; /* zero or index/id of end
symbol */
Dwarf_Addr ag_end_symbol_offset; /* known address or for
symbolic assem output,
offset of end symbol */
};

View File

@ -0,0 +1,68 @@
/*
Copyright (C) 2000,2004 Silicon Graphics, Inc. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it
under the terms of version 2.1 of the GNU Lesser General Public License
as published by the Free Software Foundation.
This program is distributed in the hope that it would be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Further, this software is distributed without any warranty that it is
free of the rightful claim of any third person regarding infringement
or the like. Any license provided herein, whether implied or
otherwise, applies only to this software file. Patent licenses, if
any, provided herein do not apply to combinations of this program with
other software, or any other product whatsoever.
You should have received a copy of the GNU Lesser General Public
License along with this program; if not, write the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston MA 02110-1301,
USA.
Contact information: Silicon Graphics, Inc., 1500 Crittenden Lane,
Mountain View, CA 94043, or:
http://www.sgi.com
For further information regarding this notice, see:
http://oss.sgi.com/projects/GenInfo/NoticeExplan
*/
/*
This struct holds the abbreviation table, before they are written
on disk. Holds a linked list of abbreviations, each consisting of
a bitmap for attributes and a bitmap for forms
*/
typedef struct Dwarf_P_Abbrev_s *Dwarf_P_Abbrev;
struct Dwarf_P_Abbrev_s {
Dwarf_Unsigned abb_idx; /* index of abbreviation */
Dwarf_Tag abb_tag; /* tag of die */
Dwarf_Ubyte abb_children; /* if children are present */
Dwarf_ufixed *abb_attrs; /* holds names of attrs */
Dwarf_ufixed *abb_forms; /* forms of attributes */
int abb_n_attr; /* num of attrs = # of forms */
Dwarf_P_Abbrev abb_next;
};
/* used in pro_section.c */
int _dwarf_pro_add_AT_fde(Dwarf_P_Debug dbg, Dwarf_P_Die die,
Dwarf_Unsigned offset, Dwarf_Error * error);
int _dwarf_pro_add_AT_stmt_list(Dwarf_P_Debug dbg,
Dwarf_P_Die first_die,
Dwarf_Error * error);
int _dwarf_pro_add_AT_macro_info(Dwarf_P_Debug dbg,
Dwarf_P_Die first_die,
Dwarf_Unsigned offset,
Dwarf_Error * error);

View File

@ -0,0 +1,48 @@
/*
Copyright (C) 2000,2004 Silicon Graphics, Inc. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it
under the terms of version 2.1 of the GNU Lesser General Public License
as published by the Free Software Foundation.
This program is distributed in the hope that it would be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Further, this software is distributed without any warranty that it is
free of the rightful claim of any third person regarding infringement
or the like. Any license provided herein, whether implied or
otherwise, applies only to this software file. Patent licenses, if
any, provided herein do not apply to combinations of this program with
other software, or any other product whatsoever.
You should have received a copy of the GNU Lesser General Public
License along with this program; if not, write the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston MA 02110-1301,
USA.
Contact information: Silicon Graphics, Inc., 1500 Crittenden Lane,
Mountain View, CA 94043, or:
http://www.sgi.com
For further information regarding this notice, see:
http://oss.sgi.com/projects/GenInfo/NoticeExplan
*/
/* Bytes needed to encode a number.
Not a tight bound, just a reasonable bound.
*/
#define ENCODE_SPACE_NEEDED (2*sizeof(Dwarf_Unsigned))
int _dwarf_pro_encode_leb128_nm(Dwarf_Unsigned val, int *nbytes,
char *space, int splen);
int _dwarf_pro_encode_signed_leb128_nm(Dwarf_Signed value, int *nbytes,
char *space, int splen);

View File

@ -0,0 +1,52 @@
/*
Copyright (C) 2000,2004 Silicon Graphics, Inc. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it
under the terms of version 2.1 of the GNU Lesser General Public License
as published by the Free Software Foundation.
This program is distributed in the hope that it would be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Further, this software is distributed without any warranty that it is
free of the rightful claim of any third person regarding infringement
or the like. Any license provided herein, whether implied or
otherwise, applies only to this software file. Patent licenses, if
any, provided herein do not apply to combinations of this program with
other software, or any other product whatsoever.
You should have received a copy of the GNU Lesser General Public
License along with this program; if not, write the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston MA 02110-1301,
USA.
Contact information: Silicon Graphics, Inc., 1500 Crittenden Lane,
Mountain View, CA 94043, or:
http://www.sgi.com
For further information regarding this notice, see:
http://oss.sgi.com/projects/GenInfo/NoticeExplan
*/
/* Handle error passing in the name of the Dwarf_P_Debug
User must supply {} around the macro.
Putting the {} here leads to macro uses that don't look like C.
The error argument to dwarf_error is hard coded here as 'error'
*/
#define DWARF_P_DBG_ERROR(dbg,errval,retval) \
_dwarf_p_error(dbg,error,errval); return(retval);
struct Dwarf_Error_s {
Dwarf_Sword er_errval;
};
void _dwarf_p_error(Dwarf_P_Debug dbg, Dwarf_Error * error,
Dwarf_Word errval);

View File

@ -0,0 +1,45 @@
/*
Copyright (C) 2000,2004 Silicon Graphics, Inc. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it
under the terms of version 2.1 of the GNU Lesser General Public License
as published by the Free Software Foundation.
This program is distributed in the hope that it would be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Further, this software is distributed without any warranty that it is
free of the rightful claim of any third person regarding infringement
or the like. Any license provided herein, whether implied or
otherwise, applies only to this software file. Patent licenses, if
any, provided herein do not apply to combinations of this program with
other software, or any other product whatsoever.
You should have received a copy of the GNU Lesser General Public
License along with this program; if not, write the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston MA 02110-1301,
USA.
Contact information: Silicon Graphics, Inc., 1500 Crittenden Lane,
Mountain View, CA 94043, or:
http://www.sgi.com
For further information regarding this notice, see:
http://oss.sgi.com/projects/GenInfo/NoticeExplan
*/
#define MAXIMUM_LOC_EXPR_LENGTH 20
struct Dwarf_P_Expr_s {
Dwarf_Small ex_byte_stream[MAXIMUM_LOC_EXPR_LENGTH];
Dwarf_P_Debug ex_dbg;
Dwarf_Unsigned ex_next_byte_offset;
Dwarf_Unsigned ex_reloc_sym_index;
Dwarf_Unsigned ex_reloc_offset;
};

View File

@ -0,0 +1,132 @@
/*
Copyright (C) 2000,2004 Silicon Graphics, Inc. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it
under the terms of version 2.1 of the GNU Lesser General Public License
as published by the Free Software Foundation.
This program is distributed in the hope that it would be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Further, this software is distributed without any warranty that it is
free of the rightful claim of any third person regarding infringement
or the like. Any license provided herein, whether implied or
otherwise, applies only to this software file. Patent licenses, if
any, provided herein do not apply to combinations of this program with
other software, or any other product whatsoever.
You should have received a copy of the GNU Lesser General Public
License along with this program; if not, write the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston MA 02110-1301,
USA.
Contact information: Silicon Graphics, Inc., 1500 Crittenden Lane,
Mountain View, CA 94043, or:
http://www.sgi.com
For further information regarding this notice, see:
http://oss.sgi.com/projects/GenInfo/NoticeExplan
*/
/*
Largest register value that can be coded into
the opcode since there are only 6 bits in the
register field.
*/
#define MAX_6_BIT_VALUE 0x3f
/*
This struct holds debug_frame instructions
*/
typedef struct Dwarf_P_Frame_Pgm_s *Dwarf_P_Frame_Pgm;
struct Dwarf_P_Frame_Pgm_s {
Dwarf_Ubyte dfp_opcode; /* opcode - includes reg # */
char *dfp_args; /* operands */
int dfp_nbytes; /* number of bytes in args */
#if 0
Dwarf_Unsigned dfp_sym_index; /* 0 unless reloc needed */
#endif
Dwarf_P_Frame_Pgm dfp_next;
};
/*
This struct has cie related information. Used to gather data
from user program, and later to transform to disk form
*/
struct Dwarf_P_Cie_s {
Dwarf_Ubyte cie_version;
char *cie_aug; /* augmentation */
Dwarf_Ubyte cie_code_align; /* alignment of code */
Dwarf_Sbyte cie_data_align;
Dwarf_Ubyte cie_ret_reg; /* return register # */
char *cie_inst; /* initial instruction */
long cie_inst_bytes;
/* no of init_inst */
Dwarf_P_Cie cie_next;
};
/* producer fields */
struct Dwarf_P_Fde_s {
Dwarf_Unsigned fde_unused1;
/* function/subr die for this fde */
Dwarf_P_Die fde_die;
/* index to asso. cie */
Dwarf_Word fde_cie;
/* Address of first location of the code this frame applies to If
fde_end_symbol non-zero, this represents the offset from the
symbol indicated by fde_r_symidx */
Dwarf_Addr fde_initloc;
/* Relocation symbol for address of the code this frame applies to.
*/
Dwarf_Unsigned fde_r_symidx;
/* Bytes of instr for this fde, if known */
Dwarf_Unsigned fde_addr_range;
/* linked list of instructions we will put in fde. */
Dwarf_P_Frame_Pgm fde_inst;
/* number of instructions in fde */
long fde_n_inst;
/* number of bytes of inst in fde */
long fde_n_bytes;
/* offset into exception table for this function. */
Dwarf_Signed fde_offset_into_exception_tables;
/* The symbol for the exception table elf section. */
Dwarf_Unsigned fde_exception_table_symbol;
/* pointer to last inst */
Dwarf_P_Frame_Pgm fde_last_inst;
Dwarf_P_Fde fde_next;
/* The symbol and offset of the end symbol. When fde_end_symbol is
non-zero we must represent the */
Dwarf_Addr fde_end_symbol_offset;
Dwarf_Unsigned fde_end_symbol;
int fde_uwordb_size;
Dwarf_P_Debug fde_dbg;
/* If fde_block is non-null, then it is the set of instructions.
so we should use it rather than fde_inst. */
Dwarf_Unsigned fde_inst_block_size;
void *fde_block;
};

View File

@ -0,0 +1,94 @@
/*
Copyright (C) 2000,2002,2004 Silicon Graphics, Inc. All Rights Reserved.
Portions Copyright 2002-2010 Sun Microsystems, Inc. All rights reserved.
Portions Copyright 2008-2010 David Anderson. All rights reserved.
This program is free software; you can redistribute it and/or modify it
under the terms of version 2.1 of the GNU Lesser General Public License
as published by the Free Software Foundation.
This program is distributed in the hope that it would be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Further, this software is distributed without any warranty that it is
free of the rightful claim of any third person regarding infringement
or the like. Any license provided herein, whether implied or
otherwise, applies only to this software file. Patent licenses, if
any, provided herein do not apply to combinations of this program with
other software, or any other product whatsoever.
You should have received a copy of the GNU Lesser General Public
License along with this program; if not, write the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston MA 02110-1301,
USA.
Contact information: Silicon Graphics, Inc., 1500 Crittenden Lane,
Mountain View, CA 94043, or:
http://www.sgi.com
For further information regarding this notice, see:
http://oss.sgi.com/projects/GenInfo/NoticeExplan
*/
#ifdef HAVE_ELF_H
#include <elf.h>
#elif defined(HAVE_LIBELF_H)
/* On one platform without elf.h this gets Elf32_Rel
type defined (a required type). */
#include <libelf.h>
#elif defined(HAVE_LIBELF_LIBELF_H)
#include <libelf/libelf.h>
#endif
#if defined(sun)
#include <sys/elf_SPARC.h>
#include <sys/elf_386.h>
#endif
/* The target address is given: the place in the source integer
is to be determined.
*/
#ifdef WORDS_BIGENDIAN
#define WRITE_UNALIGNED(dbg,dest,source, srclength,len_out) \
{ \
dbg->de_copy_word(dest, \
((char *)source) +srclength-len_out, \
len_out) ; \
}
#else /* LITTLE ENDIAN */
#define WRITE_UNALIGNED(dbg,dest,source, srclength,len_out) \
{ \
dbg->de_copy_word( (dest) , \
((char *)source) , \
len_out) ; \
}
#endif
#if defined(sparc) && defined(sun)
#define REL32 Elf32_Rela
#define REL64 Elf64_Rela
#define REL_SEC_PREFIX ".rela"
#else
#define REL32 Elf32_Rel
#define REL64 Elf64_Rel
#define REL_SEC_PREFIX ".rel"
#endif
#include "dwarf.h"
#include "libdwarf.h"
#include "pro_opaque.h"
#include "pro_error.h"
#include "pro_util.h"
#include "pro_encode_nm.h"
#include "pro_alloc.h"

View File

@ -0,0 +1,116 @@
/*
Copyright (C) 2000,2004 Silicon Graphics, Inc. All Rights Reserved.
Portions Copyright 2007-2010 Sun Microsystems, Inc. All rights reserved.
This program is free software; you can redistribute it and/or modify it
under the terms of version 2.1 of the GNU Lesser General Public License
as published by the Free Software Foundation.
This program is distributed in the hope that it would be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Further, this software is distributed without any warranty that it is
free of the rightful claim of any third person regarding infringement
or the like. Any license provided herein, whether implied or
otherwise, applies only to this software file. Patent licenses, if
any, provided herein do not apply to combinations of this program with
other software, or any other product whatsoever.
You should have received a copy of the GNU Lesser General Public
License along with this program; if not, write the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston MA 02110-1301,
USA.
Contact information: Silicon Graphics, Inc., 1500 Crittenden Lane,
Mountain View, CA 94043, or:
http://www.sgi.com
For further information regarding this notice, see:
http://oss.sgi.com/projects/GenInfo/NoticeExplan
*/
#define VERSION 2
#ifdef __i386
#define MIN_INST_LENGTH 1
#else
#define MIN_INST_LENGTH 4
#endif
#define DEFAULT_IS_STMT false
/* line base and range are temporarily defines.
They need to be calculated later */
#define LINE_BASE -1
#define LINE_RANGE 4
#define OPCODE_BASE 10
#define MAX_OPCODE 255
/*
This struct is used to hold entries in the include directories
part of statement prologue.
*/
struct Dwarf_P_Inc_Dir_s {
char *did_name; /* name of directory */
Dwarf_P_Inc_Dir did_next;
};
/*
This struct holds file entries for the statement prologue.
Defined in pro_line.h
*/
struct Dwarf_P_F_Entry_s {
char *dfe_name;
char *dfe_args; /* has dir index, time of modification,
length in bytes. Encodes as leb128 */
int dfe_nbytes; /* number of bytes in args */
Dwarf_P_F_Entry dfe_next;
};
/*
Struct holding line number information for each of the producer
line entries
*/
struct Dwarf_P_Line_s {
/* code address */
Dwarf_Addr dpl_address;
/* file index, index into file entry */
Dwarf_Word dpl_file;
/* line number */
Dwarf_Word dpl_line;
/* column number */
Dwarf_Word dpl_column;
/* whether its a beginning of a stmt */
Dwarf_Ubyte dpl_is_stmt;
/* whether its a beginning of basic blk */
Dwarf_Ubyte dpl_basic_block;
/* used to store opcodes set_address, and end_seq */
Dwarf_Ubyte dpl_opc;
/*
Used only for relocations. Has index of symbol relative to
which relocation has to be done (the S part in S + A) */
Dwarf_Unsigned dpl_r_symidx;
Dwarf_P_Line dpl_next;
};
/*
to initialize state machine registers, definition in
pro_line.c
*/
void _dwarf_pro_reg_init(Dwarf_P_Line);

View File

@ -0,0 +1,40 @@
/*
Copyright (C) 2000,2004 Silicon Graphics, Inc. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it
under the terms of version 2.1 of the GNU Lesser General Public License
as published by the Free Software Foundation.
This program is distributed in the hope that it would be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Further, this software is distributed without any warranty that it is
free of the rightful claim of any third person regarding infringement
or the like. Any license provided herein, whether implied or
otherwise, applies only to this software file. Patent licenses, if
any, provided herein do not apply to combinations of this program with
other software, or any other product whatsoever.
You should have received a copy of the GNU Lesser General Public
License along with this program; if not, write the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston MA 02110-1301,
USA.
Contact information: Silicon Graphics, Inc., 1500 Crittenden Lane,
Mountain View, CA 94043, or:
http://www.sgi.com
For further information regarding this notice, see:
http://oss.sgi.com/projects/GenInfo/NoticeExplan
*/
int _dwarf_pro_transform_macro_info_to_disk(Dwarf_P_Debug dbg,
Dwarf_Error * error);

View File

@ -0,0 +1,484 @@
/*
Copyright (C) 2000,2002,2004 Silicon Graphics, Inc. All Rights Reserved.
Portions Copyright 2002-2010 Sun Microsystems, Inc. All rights reserved.
This program is free software; you can redistribute it and/or modify it
under the terms of version 2.1 of the GNU Lesser General Public License
as published by the Free Software Foundation.
This program is distributed in the hope that it would be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Further, this software is distributed without any warranty that it is
free of the rightful claim of any third person regarding infringement
or the like. Any license provided herein, whether implied or
otherwise, applies only to this software file. Patent licenses, if
any, provided herein do not apply to combinations of this program with
other software, or any other product whatsoever.
You should have received a copy of the GNU Lesser General Public
License along with this program; if not, write the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston MA 02110-1301,
USA.
Contact information: Silicon Graphics, Inc., 1500 Crittenden Lane,
Mountain View, CA 94043, or:
http://www.sgi.com
For further information regarding this notice, see:
http://oss.sgi.com/projects/GenInfo/NoticeExplan
*/
#include <stddef.h>
/*
Sgidefs included to define __uint32_t,
a guaranteed 4-byte quantity.
*/
#include "libdwarfdefs.h"
#define true 1
#define false 0
/* to identify a cie */
#define DW_CIE_ID ~(0x0)
#define DW_CIE_VERSION 1
/*Dwarf_Word is unsigned word usable for index, count in memory */
/*Dwarf_Sword is signed word usable for index, count in memory */
/* The are 32 or 64 bits depending if 64 bit longs or not, which
** fits the ILP32 and LP64 models
** These work equally well with ILP64.
*/
typedef unsigned long Dwarf_Word;
typedef long Dwarf_Sword;
typedef signed char Dwarf_Sbyte;
typedef unsigned char Dwarf_Ubyte;
typedef signed short Dwarf_Shalf;
/*
On any change that makes libdwarf producer
incompatible, increment this number.
1->2->3 ...
*/
#define PRO_VERSION_MAGIC 0xdead1
/* these 2 are fixed sizes which must not vary with the
** ILP32/LP64 model. These two stay at 32 bit.
*/
typedef __uint32_t Dwarf_ufixed;
typedef __int32_t Dwarf_sfixed;
/*
producer:
This struct is used to hold information about all
debug* sections. On creating a new section, section
names and indices are added to this struct
definition in pro_section.h
*/
typedef struct Dwarf_P_Section_Data_s *Dwarf_P_Section_Data;
/*
producer:
This struct is used to hold entries in the include directories
part of statement prologue. Definition in pro_line.h
*/
typedef struct Dwarf_P_Inc_Dir_s *Dwarf_P_Inc_Dir;
/*
producer:
This struct holds file entries for the statement prologue.
Defined in pro_line.h
*/
typedef struct Dwarf_P_F_Entry_s *Dwarf_P_F_Entry;
/*
producer:
This struct holds information for each cie. Defn in pro_frame.h
*/
typedef struct Dwarf_P_Cie_s *Dwarf_P_Cie;
/*
producer:
Struct to hold line number information, different from
Dwarf_Line opaque type.
*/
typedef struct Dwarf_P_Line_s *Dwarf_P_Line;
/*
producer:
Struct to hold information about address ranges.
*/
typedef struct Dwarf_P_Simple_nameentry_s *Dwarf_P_Simple_nameentry;
typedef struct Dwarf_P_Simple_name_header_s *Dwarf_P_Simple_name_header;
typedef struct Dwarf_P_Arange_s *Dwarf_P_Arange;
typedef struct Dwarf_P_Per_Reloc_Sect_s *Dwarf_P_Per_Reloc_Sect;
typedef struct Dwarf_P_Per_Sect_String_Attrs_s *Dwarf_P_Per_Sect_String_Attrs;
/* Defined to get at the elf section numbers and section name
indices in symtab for the dwarf sections
Must match .rel.* names in _dwarf_rel_section_names
exactly.
*/
#define DEBUG_INFO 0
#define DEBUG_LINE 1
#define DEBUG_ABBREV 2
#define DEBUG_FRAME 3
#define DEBUG_ARANGES 4
#define DEBUG_PUBNAMES 5
#define DEBUG_STR 6
#define DEBUG_FUNCNAMES 7
#define DEBUG_TYPENAMES 8
#define DEBUG_VARNAMES 9
#define DEBUG_WEAKNAMES 10
#define DEBUG_MACINFO 11
#define DEBUG_LOC 12
/* number of debug_* sections not including the relocations */
#define NUM_DEBUG_SECTIONS DEBUG_LOC + 1
struct Dwarf_P_Die_s {
Dwarf_Unsigned di_offset; /* offset in debug info */
char *di_abbrev; /* abbreviation */
Dwarf_Word di_abbrev_nbytes; /* # of bytes in abbrev */
Dwarf_Tag di_tag;
Dwarf_P_Die di_parent; /* parent of current die */
Dwarf_P_Die di_child; /* first child */
/* The last child field makes linking up children an O(1) operation,
See pro_die.c. */
Dwarf_P_Die di_last_child;
Dwarf_P_Die di_left; /* left sibling */
Dwarf_P_Die di_right; /* right sibling */
Dwarf_P_Attribute di_attrs; /* list of attributes */
Dwarf_P_Attribute di_last_attr; /* last attribute */
int di_n_attr; /* number of attributes */
Dwarf_P_Debug di_dbg; /* For memory management */
Dwarf_Unsigned di_marker; /* used to attach symbols to dies */
};
/* producer fields */
struct Dwarf_P_Attribute_s {
Dwarf_Half ar_attribute; /* Attribute Value. */
Dwarf_Half ar_attribute_form; /* Attribute Form. */
Dwarf_P_Die ar_ref_die; /* die pointer if form ref */
char *ar_data; /* data, format given by form */
Dwarf_Unsigned ar_nbytes; /* no. of bytes of data */
Dwarf_Unsigned ar_rel_symidx; /* when attribute has a
relocatable value, holds
index of symbol in SYMTAB */
Dwarf_Ubyte ar_rel_type; /* relocation type */
Dwarf_Word ar_rel_offset; /* Offset of relocation within block */
char ar_reloc_len; /* Number of bytes that relocation
applies to. 4 or 8. Unused and may
be 0 if if ar_rel_type is
R_MIPS_NONE */
Dwarf_P_Attribute ar_next;
};
/* A block of .debug_macinfo data: this forms a series of blocks.
** Each macinfo input is compressed immediately and put into
** the current block if room, else a newblock allocated.
** The space allocation is such that the block and the macinfo
** data are one malloc block: free with a pointer to this and the
** mb_data is freed automatically.
** Like the struct hack, but legal ANSI C.
*/
struct dw_macinfo_block_s {
struct dw_macinfo_block_s *mb_next;
unsigned long mb_avail_len;
unsigned long mb_used_len;
unsigned long mb_macinfo_data_space_len;
char *mb_data; /* original malloc ptr. */
};
/* dwarf_sn_kind is for the array of similarly-treated
name -> cu ties
*/
enum dwarf_sn_kind { dwarf_snk_pubname, dwarf_snk_funcname,
dwarf_snk_weakname, dwarf_snk_typename,
dwarf_snk_varname,
dwarf_snk_entrycount /* this one must be last */
};
/* The calls to add a varname etc use a list of
these as the list.
*/
struct Dwarf_P_Simple_nameentry_s {
Dwarf_P_Die sne_die;
char *sne_name;
int sne_name_len;
Dwarf_P_Simple_nameentry sne_next;
};
/* An array of these, each of which heads a list
of Dwarf_P_Simple_nameentry
*/
struct Dwarf_P_Simple_name_header_s {
Dwarf_P_Simple_nameentry sn_head;
Dwarf_P_Simple_nameentry sn_tail;
Dwarf_Signed sn_count;
/* length that will be generated, not counting fixed header or
trailer */
Dwarf_Signed sn_net_len;
};
typedef int (*_dwarf_pro_reloc_name_func_ptr) (Dwarf_P_Debug dbg,
int sec_index,
Dwarf_Unsigned offset,/* r_offset */
Dwarf_Unsigned symidx,
enum Dwarf_Rel_Type type,
int reltarget_length);
typedef int (*_dwarf_pro_reloc_length_func_ptr) (Dwarf_P_Debug dbg,
int sec_index, Dwarf_Unsigned offset,/* r_offset */
Dwarf_Unsigned start_symidx,
Dwarf_Unsigned end_symidx,
enum Dwarf_Rel_Type type,
int reltarget_length);
typedef int (*_dwarf_pro_transform_relocs_func_ptr) (Dwarf_P_Debug dbg,
Dwarf_Signed *
new_sec_count);
/*
Each slot in a block of slots could be:
a binary stream relocation entry (32 or 64bit relocation data)
a SYMBOLIC relocation entry.
During creation sometimes we create multiple chained blocks,
but sometimes we create a single long block.
Before returning reloc data to caller,
we switch to a single, long-enough,
block.
We make counters here Dwarf_Unsigned so that we
get sufficient alignment. Since we use space after
the struct (at malloc time) for user data which
must have Dwarf_Unsigned alignment, this
struct must have that alignment too.
*/
struct Dwarf_P_Relocation_Block_s {
Dwarf_Unsigned rb_slots_in_block; /* slots in block, as created */
Dwarf_Unsigned rb_next_slot_to_use; /* counter, start at 0. */
struct Dwarf_P_Relocation_Block_s *rb_next;
char *rb_where_to_add_next; /* pointer to next slot (might be past
end, depending on
rb_next_slot_to_use) */
char *rb_data; /* data area */
};
/* One of these per potential relocation section
So one per actual dwarf section.
Left zeroed when not used (some sections have
no relocations).
*/
struct Dwarf_P_Per_Reloc_Sect_s {
unsigned long pr_reloc_total_count; /* total number of entries
across all blocks */
unsigned long pr_slots_per_block_to_alloc; /* at Block alloc, this
is the default number of slots to use */
int pr_sect_num_of_reloc_sect; /* sect number returned by
de_callback_func() or de_callback_func_b() call, this is the sect
number of the relocation section. */
/* singly-linked list. add at and ('last') with count of blocks */
struct Dwarf_P_Relocation_Block_s *pr_first_block;
struct Dwarf_P_Relocation_Block_s *pr_last_block;
unsigned long pr_block_count;
};
#define DEFAULT_SLOTS_PER_BLOCK 3
typedef struct memory_list_s {
struct memory_list_s *prev;
struct memory_list_s *next;
} memory_list_t;
struct Dwarf_P_Per_Sect_String_Attrs_s {
int sect_sa_section_number;
unsigned sect_sa_n_alloc;
unsigned sect_sa_n_used;
Dwarf_P_String_Attr sect_sa_list;
};
/* Fields used by producer */
struct Dwarf_P_Debug_s {
/* used to catch dso passing dbg to another DSO with incompatible
version of libdwarf See PRO_VERSION_MAGIC */
int de_version_magic_number;
Dwarf_Handler de_errhand;
Dwarf_Ptr de_errarg;
/* Call back function, used to create .debug* sections. Provided
by user. Only of these used per dbg. */
Dwarf_Callback_Func de_callback_func;
Dwarf_Callback_Func_b de_callback_func_b;
/* Flags from producer_init call */
Dwarf_Unsigned de_flags;
/* This holds information on debug section stream output, including
the stream data */
Dwarf_P_Section_Data de_debug_sects;
/* Pointer to the 'current active' section */
Dwarf_P_Section_Data de_current_active_section;
/* Number of debug data streams globs. */
Dwarf_Word de_n_debug_sect;
/* File entry information, null terminated singly-linked list */
Dwarf_P_F_Entry de_file_entries;
Dwarf_P_F_Entry de_last_file_entry;
Dwarf_Unsigned de_n_file_entries;
/* Has the directories used to search for source files */
Dwarf_P_Inc_Dir de_inc_dirs;
Dwarf_P_Inc_Dir de_last_inc_dir;
Dwarf_Unsigned de_n_inc_dirs;
/* Has all the line number info for the stmt program */
Dwarf_P_Line de_lines;
Dwarf_P_Line de_last_line;
/* List of cie's for the debug unit */
Dwarf_P_Cie de_frame_cies;
Dwarf_P_Cie de_last_cie;
Dwarf_Unsigned de_n_cie;
/* Singly-linked list of fde's for the debug unit */
Dwarf_P_Fde de_frame_fdes;
Dwarf_P_Fde de_last_fde;
Dwarf_Unsigned de_n_fde;
/* First die, leads to all others */
Dwarf_P_Die de_dies;
/* Pointer to list of strings */
char *de_strings;
/* Pointer to chain of aranges */
Dwarf_P_Arange de_arange;
Dwarf_P_Arange de_last_arange;
Dwarf_Sword de_arange_count;
/* macinfo controls. */
/* first points to beginning of the list during creation */
struct dw_macinfo_block_s *de_first_macinfo;
/* current points to the current, unfilled, block */
struct dw_macinfo_block_s *de_current_macinfo;
/* Pointer to the first section, to support reset_section_bytes */
Dwarf_P_Section_Data de_first_debug_sect;
/* handles pubnames, weaknames, etc. See dwarf_sn_kind in
pro_opaque.h */
struct Dwarf_P_Simple_name_header_s
de_simple_name_headers[dwarf_snk_entrycount];
/* relocation data. not all sections will actally have relocation
info, of course */
struct Dwarf_P_Per_Reloc_Sect_s de_reloc_sect[NUM_DEBUG_SECTIONS];
int de_reloc_next_to_return; /* iterator on reloc sections
(SYMBOLIC output) */
/* used in remembering sections */
int de_elf_sects[NUM_DEBUG_SECTIONS]; /* elf sect number of
the section itself, DEBUG_LINE for example */
Dwarf_Unsigned de_sect_name_idx[NUM_DEBUG_SECTIONS]; /* section
name index or handle for the name of the symbol for
DEBUG_LINE for example */
int de_offset_reloc; /* offset reloc type, R_MIPS_32 for
example. Specific to the ABI being
produced. Relocates offset size
field */
int de_exc_reloc; /* reloc type specific to exception
table relocs. */
int de_ptr_reloc; /* standard reloc type, R_MIPS_32 for
example. Specific to the ABI being
produced. relocates pointer size
field */
unsigned char de_offset_size; /* section offset. Here to
avoid test of abi in macro
at run time MIPS -n32 4,
-64 8. */
unsigned char de_pointer_size; /* size of pointer in target.
Here to avoid test of abi in
macro at run time MIPS -n32
4, -64 is 8. */
unsigned char de_is_64bit; /* non-zero if is 64bit. Else 32 bit:
used for passing this info as a flag
*/
unsigned char de_relocation_record_size; /* reloc record size
varies by ABI and
relocation-output
method (stream or
symbolic) */
unsigned char de_64bit_extension; /* non-zero if creating 64 bit
offsets using dwarf2-99
extension proposal */
int de_ar_data_attribute_form; /* data8, data4 abi dependent */
int de_ar_ref_attr_form; /* ref8 ref4 , abi dependent */
/* simple name relocations */
_dwarf_pro_reloc_name_func_ptr de_reloc_name;
/* relocations for a length, requiring a pair of symbols */
_dwarf_pro_reloc_length_func_ptr de_reloc_pair;
_dwarf_pro_transform_relocs_func_ptr de_transform_relocs_to_disk;
/* following used for macro buffers */
unsigned long de_compose_avail;
unsigned long de_compose_used_len;
unsigned char de_same_endian;
void *(*de_copy_word) (void *, const void *, size_t);
/* Add new fields at the END of this struct to preserve some hope
of sensible behavior on dbg passing between DSOs linked with
mismatched libdwarf producer versions. */
Dwarf_P_Marker de_markers; /* pointer to array of markers */
unsigned de_marker_n_alloc;
unsigned de_marker_n_used;
int de_sect_sa_next_to_return; /* Iterator on sring attrib sects */
/* String attributes data of each section. */
struct Dwarf_P_Per_Sect_String_Attrs_s de_sect_string_attr[NUM_DEBUG_SECTIONS];
};
#define CURRENT_VERSION_STAMP 2
Dwarf_Unsigned _dwarf_add_simple_name_entry(Dwarf_P_Debug dbg,
Dwarf_P_Die die,
char *entry_name,
enum dwarf_sn_kind
entrykind,
Dwarf_Error * error);
#define DISTINGUISHED_VALUE 0xffffffff /* 64bit extension flag */

View File

@ -0,0 +1,47 @@
/*
Copyright (C) 2000,2004 Silicon Graphics, Inc. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it
under the terms of version 2.1 of the GNU Lesser General Public License
as published by the Free Software Foundation.
This program is distributed in the hope that it would be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Further, this software is distributed without any warranty that it is
free of the rightful claim of any third person regarding infringement
or the like. Any license provided herein, whether implied or
otherwise, applies only to this software file. Patent licenses, if
any, provided herein do not apply to combinations of this program with
other software, or any other product whatsoever.
You should have received a copy of the GNU Lesser General Public
License along with this program; if not, write the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston MA 02110-1301,
USA.
Contact information: Silicon Graphics, Inc., 1500 Crittenden Lane,
Mountain View, CA 94043, or:
http://www.sgi.com
For further information regarding this notice, see:
http://oss.sgi.com/projects/GenInfo/NoticeExplan
*/
int _dwarf_pro_pre_alloc_n_reloc_slots(Dwarf_P_Debug dbg,
int rel_sec_index,
Dwarf_Unsigned newslots);
int _dwarf_pro_alloc_reloc_slots(Dwarf_P_Debug dbg, int rel_sec_index);
int _dwarf_pro_reloc_get_a_slot(Dwarf_P_Debug dbg,
int base_sec_index,
void **relrec_to_fill);

View File

@ -0,0 +1,63 @@
/*
Copyright (C) 2000,2004 Silicon Graphics, Inc. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it
under the terms of version 2.1 of the GNU Lesser General Public License
as published by the Free Software Foundation.
This program is distributed in the hope that it would be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Further, this software is distributed without any warranty that it is
free of the rightful claim of any third person regarding infringement
or the like. Any license provided herein, whether implied or
otherwise, applies only to this software file. Patent licenses, if
any, provided herein do not apply to combinations of this program with
other software, or any other product whatsoever.
You should have received a copy of the GNU Lesser General Public
License along with this program; if not, write the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston MA 02110-1301,
USA.
Contact information: Silicon Graphics, Inc., 1500 Crittenden Lane,
Mountain View, CA 94043, or:
http://www.sgi.com
For further information regarding this notice, see:
http://oss.sgi.com/projects/GenInfo/NoticeExplan
*/
int _dwarf_pro_reloc_name_stream64(Dwarf_P_Debug dbg, int base_sec_index, Dwarf_Unsigned offset, /* r_offset
of
reloc
*/
Dwarf_Unsigned symidx,
enum Dwarf_Rel_Type,
int reltarget_length);
int _dwarf_pro_reloc_name_stream32(Dwarf_P_Debug dbg, int base_sec_index, Dwarf_Unsigned offset, /* r_offset
of
reloc
*/
Dwarf_Unsigned symidx,
enum Dwarf_Rel_Type,
int reltarget_length);
int _dwarf_pro_reloc_length_stream(Dwarf_P_Debug dbg, int base_sec_index, Dwarf_Unsigned offset, /* r_offset
of
reloc
*/
Dwarf_Unsigned start_symidx,
Dwarf_Unsigned end_symidx,
enum Dwarf_Rel_Type,
int reltarget_length);
int _dwarf_stream_relocs_to_disk(Dwarf_P_Debug dbg,
Dwarf_Signed * new_sec_count);

View File

@ -0,0 +1,55 @@
/*
Copyright (C) 2000,2004 Silicon Graphics, Inc. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it
under the terms of version 2.1 of the GNU Lesser General Public License
as published by the Free Software Foundation.
This program is distributed in the hope that it would be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Further, this software is distributed without any warranty that it is
free of the rightful claim of any third person regarding infringement
or the like. Any license provided herein, whether implied or
otherwise, applies only to this software file. Patent licenses, if
any, provided herein do not apply to combinations of this program with
other software, or any other product whatsoever.
You should have received a copy of the GNU Lesser General Public
License along with this program; if not, write the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston MA 02110-1301,
USA.
Contact information: Silicon Graphics, Inc., 1500 Crittenden Lane,
Mountain View, CA 94043, or:
http://www.sgi.com
For further information regarding this notice, see:
http://oss.sgi.com/projects/GenInfo/NoticeExplan
*/
int _dwarf_pro_reloc_name_symbolic(Dwarf_P_Debug dbg, int base_sec_index, Dwarf_Unsigned offset, /* r_offset
of
reloc
*/
Dwarf_Unsigned symidx,
enum Dwarf_Rel_Type,
int reltarget_length);
int
_dwarf_pro_reloc_length_symbolic(Dwarf_P_Debug dbg, int base_sec_index, Dwarf_Unsigned offset, /* r_offset
of
reloc
*/
Dwarf_Unsigned start_symidx,
Dwarf_Unsigned end_symidx,
enum Dwarf_Rel_Type,
int reltarget_length);
int _dwarf_symbolic_relocs_to_disk(Dwarf_P_Debug dbg,
Dwarf_Signed * new_sec_count);

View File

@ -0,0 +1,112 @@
/*
Copyright (C) 2000,2004 Silicon Graphics, Inc. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it
under the terms of version 2.1 of the GNU Lesser General Public License
as published by the Free Software Foundation.
This program is distributed in the hope that it would be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Further, this software is distributed without any warranty that it is
free of the rightful claim of any third person regarding infringement
or the like. Any license provided herein, whether implied or
otherwise, applies only to this software file. Patent licenses, if
any, provided herein do not apply to combinations of this program with
other software, or any other product whatsoever.
You should have received a copy of the GNU Lesser General Public
License along with this program; if not, write the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston MA 02110-1301,
USA.
Contact information: Silicon Graphics, Inc., 1500 Crittenden Lane,
Mountain View, CA 94043, or:
http://www.sgi.com
For further information regarding this notice, see:
http://oss.sgi.com/projects/GenInfo/NoticeExplan
*/
/* relocation section names */
extern char *_dwarf_rel_section_names[];
/* section names */
extern char *_dwarf_sectnames[];
/* struct to hold relocation entries. Its mantained as a linked
list of relocation structs, and will then be written at as a
whole into the relocation section. Whether its 32 bit or
64 bit will be obtained from Dwarf_Debug pointer.
*/
/*
struct stores a chunk of data pertaining to a section
*/
struct Dwarf_P_Section_Data_s {
int ds_elf_sect_no; /* elf section number */
char *ds_data; /* data contained in section */
unsigned long ds_nbytes; /* bytes of data used so far */
unsigned long ds_orig_alloc; /* bytes allocated originally */
Dwarf_P_Section_Data ds_next; /* next on the list */
};
/* Used to allow a dummy initial struct (which we
drop before it gets used
This must not match any legitimate 'section' number.
*/
#define MAGIC_SECT_NO -3
/* Size of chunk of data allocated in one alloc
Not clear if this is the best size.
Used to be just 4096 for user data, the section data struct
was a separate malloc.
*/
#define CHUNK_SIZE (4096 - sizeof (struct Dwarf_P_Section_Data_s))
/*
chunk alloc routine -
if chunk->ds_data is nil, it will alloc CHUNK_SIZE bytes,
and return pointer to the beginning. If chunk is not nil,
it will see if there's enoungh space for nbytes in current
chunk, if not, add new chunk to linked list, and return
a char * pointer to it. Return null if unsuccessful.
*/
Dwarf_Small *_dwarf_pro_buffer(Dwarf_P_Debug dbg, int sectno,
unsigned long nbytes);
#define GET_CHUNK(dbg,sectno,ptr,nbytes,error) \
{ \
(ptr) = _dwarf_pro_buffer((dbg),(sectno),(nbytes)); \
if ((ptr) == NULL) { \
DWARF_P_DBG_ERROR(dbg,DW_DLE_CHUNK_ALLOC,-1); \
} \
}
int
_dwarf_transform_arange_to_disk(Dwarf_P_Debug dbg,
Dwarf_Error * error);
/* These are for creating ELF section type codes.
*/
#if defined(linux) || defined(__BEOS__) || !defined(SHT_MIPS_DWARF)
/* Intel's SoftSdv accepts only this */
#define SECTION_TYPE SHT_PROGBITS
#else
#define SECTION_TYPE SHT_MIPS_DWARF
#endif

View File

@ -0,0 +1,44 @@
/*
Copyright (C) 2000,2004 Silicon Graphics, Inc. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it
under the terms of version 2.1 of the GNU Lesser General Public License
as published by the Free Software Foundation.
This program is distributed in the hope that it would be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Further, this software is distributed without any warranty that it is
free of the rightful claim of any third person regarding infringement
or the like. Any license provided herein, whether implied or
otherwise, applies only to this software file. Patent licenses, if
any, provided herein do not apply to combinations of this program with
other software, or any other product whatsoever.
You should have received a copy of the GNU Lesser General Public
License along with this program; if not, write the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston MA 02110-1301,
USA.
Contact information: Silicon Graphics, Inc., 1500 Crittenden Lane,
Mountain View, CA 94043, or:
http://www.sgi.com
For further information regarding this notice, see:
http://oss.sgi.com/projects/GenInfo/NoticeExplan
*/
/* pro_types.h */
int _dwarf_transform_simplename_to_disk(Dwarf_P_Debug dbg, enum dwarf_sn_kind entrykind, int section_index, /* in
de_elf_sects
etc
*/
Dwarf_Error * error);

View File

@ -0,0 +1,148 @@
/*
Copyright (C) 2000,2004 Silicon Graphics, Inc. All Rights Reserved.
Portions Copyright 2002-2010 Sun Microsystems, Inc. All rights reserved.
This program is free software; you can redistribute it and/or modify it
under the terms of version 2.1 of the GNU Lesser General Public License
as published by the Free Software Foundation.
This program is distributed in the hope that it would be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Further, this software is distributed without any warranty that it is
free of the rightful claim of any third person regarding infringement
or the like. Any license provided herein, whether implied or
otherwise, applies only to this software file. Patent licenses, if
any, provided herein do not apply to combinations of this program with
other software, or any other product whatsoever.
You should have received a copy of the GNU Lesser General Public
License along with this program; if not, write the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston MA 02110-1301,
USA.
Contact information: Silicon Graphics, Inc., 1500 Crittenden Lane,
Mountain View, CA 94043, or:
http://www.sgi.com
For further information regarding this notice, see:
http://oss.sgi.com/projects/GenInfo/NoticeExplan
*/
#define IS_64BIT(dbg) ((dbg)->de_flags & DW_DLC_SIZE_64 ? 1 : 0)
#define ISA_IA64(dbg) ((dbg)->de_flags & DW_DLC_ISA_IA64 ? 1 : 0)
/* definition of sizes of types, given target machine */
#define sizeof_sbyte(dbg) sizeof(Dwarf_Sbyte)
#define sizeof_ubyte(dbg) sizeof(Dwarf_Ubyte)
#define sizeof_uhalf(dbg) sizeof(Dwarf_Half)
/* certain sizes not defined here, but set in dbg record.
See pro_init.c
*/
/* Computes amount of padding necessary to align n to a k-boundary. */
/* Important: Assumes n, k both GREATER than zero. */
#define PADDING(n, k) ( (k)-1 - ((n)-1)%(k) )
/* The following defines are only important for users of the
** producer part of libdwarf, and such should have these
** defined correctly (as necessary)
** by the #include <elf.h> done in pro_incl.h
** before the #include "pro_util.h".
** For others producer macros do not matter so 0 is a usable value, and
** zero values let compilation succeed on more non-MIPS architectures.
** A better approach would be welcome.
*/
/* R_MIPS* are #define so #ifndef works */
/* R_IA_64* are not necessarily #define (might be enum) so #ifndef
is useless, we use the configure script generating
HAVE_R_IA_64_DIR32LSB and HAVE_R_IA64_DIR32LSB.
*/
#ifndef R_MIPS_64
#define R_MIPS_64 0
#endif
#ifndef R_MIPS_32
#define R_MIPS_32 0
#endif
#ifndef R_MIPS_SCN_DISP
#define R_MIPS_SCN_DISP 0
#endif
/* R_IA_64_DIR32LSB came before the now-standard R_IA64_DIR32LSB
(etc) was defined. This now deals with either form,
preferring the new form if available. */
#ifdef HAVE_R_IA64_DIR32LSB
#define DWARF_PRO_R_IA64_DIR32LSB R_IA64_DIR32LSB
#define DWARF_PRO_R_IA64_DIR64LSB R_IA64_DIR64LSB
#define DWARF_PRO_R_IA64_SEGREL64LSB R_IA64_SEGREL64LSB
#define DWARF_PRO_R_IA64_SEGREL32LSB R_IA64_SEGREL32LSB
#endif
#if defined(HAVE_R_IA_64_DIR32LSB) && !defined(HAVE_R_IA64_DIR32LSB)
#define DWARF_PRO_R_IA64_DIR32LSB R_IA_64_DIR32LSB
#define DWARF_PRO_R_IA64_DIR64LSB R_IA_64_DIR64LSB
#define DWARF_PRO_R_IA64_SEGREL64LSB R_IA_64_SEGREL64LSB
#define DWARF_PRO_R_IA64_SEGREL32LSB R_IA_64_SEGREL32LSB
#endif
#if !defined(HAVE_R_IA_64_DIR32LSB) && !defined(HAVE_R_IA64_DIR32LSB)
#define DWARF_PRO_R_IA64_DIR32LSB 0
#define DWARF_PRO_R_IA64_DIR64LSB 0
#define DWARF_PRO_R_IA64_SEGREL64LSB 0
#define DWARF_PRO_R_IA64_SEGREL32LSB 0
#endif
/*
* The default "I don't know" value can't be zero.
* Because that's the sentinel value that means "no relocation".
* In order to use this library in 'symbolic relocation mode we
* don't care if this value is the right relocation value,
* only that it's non-NULL. So at the end, we define it
* to something sensible.
*/
#if defined(sun)
#if defined(sparc)
#define Get_REL64_isa(dbg) (R_SPARC_UA64)
#define Get_REL32_isa(dbg) (R_SPARC_UA32)
#define Get_REL_SEGREL_isa(dbg) (R_SPARC_NONE) /* I don't know! */
#else /* i386 */
#define Get_REL64_isa(dbg) (R_386_32) /* Any non-zero value is ok */
#define Get_REL32_isa(dbg) (R_386_32)
#define Get_REL_SEGREL_isa(dbg) (R_386_NONE) /* I don't know! */
#endif /* sparc || i386 */
#else /* !sun */
#ifdef HAVE_SYS_IA64_ELF_H
#define Get_REL64_isa(dbg) (ISA_IA64(dbg) ? \
DWARF_PRO_R_IA64_DIR64LSB : R_MIPS_64)
#define Get_REL32_isa(dbg) (ISA_IA64(dbg) ? \
DWARF_PRO_R_IA64_DIR32LSB : R_MIPS_32)
/* ia64 uses 32bit dwarf offsets for sections */
#define Get_REL_SEGREL_isa(dbg) (ISA_IA64(dbg) ? \
DWARF_PRO_R_IA64_SEGREL32LSB : R_MIPS_SCN_DISP)
#else /* HAVE_SYS_IA64_ELF_H */
#if !defined(linux) && !defined(__BEOS__)
#define Get_REL64_isa(dbg) (R_MIPS_64)
#define Get_REL32_isa(dbg) (R_MIPS_32)
#define Get_REL_SEGREL_isa(dbg) (R_MIPS_SCN_DISP)
#else
#define Get_REL64_isa(dbg) (1)
#define Get_REL32_isa(dbg) (1) /* these are used on linux */
#define Get_REL_SEGREL_isa(dbg) (1) /* non zero values, see comments above */
#endif
#endif /* HAVE_SYS_IA64_ELF_H */
#endif /* !sun */

View File

@ -0,0 +1,95 @@
/*
byteswap.h - functions and macros for byte swapping.
Copyright (C) 1995 - 2001 Michael Riepe
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/* @(#) $Id: byteswap.h,v 1.7 2008/05/23 08:15:34 michael Exp $ */
#ifndef _BYTESWAP_H
#define _BYTESWAP_H
#define lu(from,i,s) (((__libelf_u32_t)((unsigned char*)(from))[i])<<(s))
#define li(from,i,s) (((__libelf_i32_t)(( signed char*)(from))[i])<<(s))
#define __load_u16L(from) ((__libelf_u32_t) \
(lu(from,1,8) | lu(from,0,0)))
#define __load_u16M(from) ((__libelf_u32_t) \
(lu(from,0,8) | lu(from,1,0)))
#define __load_i16L(from) ((__libelf_i32_t) \
(li(from,1,8) | lu(from,0,0)))
#define __load_i16M(from) ((__libelf_i32_t) \
(li(from,0,8) | lu(from,1,0)))
#define __load_u32L(from) ((__libelf_u32_t) \
(lu(from,3,24) | lu(from,2,16) | lu(from,1,8) | lu(from,0,0)))
#define __load_u32M(from) ((__libelf_u32_t) \
(lu(from,0,24) | lu(from,1,16) | lu(from,2,8) | lu(from,3,0)))
#define __load_i32L(from) ((__libelf_i32_t) \
(li(from,3,24) | lu(from,2,16) | lu(from,1,8) | lu(from,0,0)))
#define __load_i32M(from) ((__libelf_i32_t) \
(li(from,0,24) | lu(from,1,16) | lu(from,2,8) | lu(from,3,0)))
#define su(to,i,v,s) (((char*)(to))[i]=((__libelf_u32_t)(v)>>(s)))
#define si(to,i,v,s) (((char*)(to))[i]=((__libelf_i32_t)(v)>>(s)))
#define __store_u16L(to,v) \
(su(to,1,v,8), su(to,0,v,0))
#define __store_u16M(to,v) \
(su(to,0,v,8), su(to,1,v,0))
#define __store_i16L(to,v) \
(si(to,1,v,8), si(to,0,v,0))
#define __store_i16M(to,v) \
(si(to,0,v,8), si(to,1,v,0))
#define __store_u32L(to,v) \
(su(to,3,v,24), su(to,2,v,16), su(to,1,v,8), su(to,0,v,0))
#define __store_u32M(to,v) \
(su(to,0,v,24), su(to,1,v,16), su(to,2,v,8), su(to,3,v,0))
#define __store_i32L(to,v) \
(si(to,3,v,24), si(to,2,v,16), si(to,1,v,8), si(to,0,v,0))
#define __store_i32M(to,v) \
(si(to,0,v,24), si(to,1,v,16), si(to,2,v,8), si(to,3,v,0))
#if __LIBELF64
/*
* conversion functions from swap64.c
*/
extern __libelf_u64_t _elf_load_u64L(const unsigned char *from);
extern __libelf_u64_t _elf_load_u64M(const unsigned char *from);
extern __libelf_i64_t _elf_load_i64L(const unsigned char *from);
extern __libelf_i64_t _elf_load_i64M(const unsigned char *from);
extern void _elf_store_u64L(unsigned char *to, __libelf_u64_t v);
extern void _elf_store_u64M(unsigned char *to, __libelf_u64_t v);
extern void _elf_store_i64L(unsigned char *to, __libelf_u64_t v);
extern void _elf_store_i64M(unsigned char *to, __libelf_u64_t v);
/*
* aliases for existing conversion code
*/
#define __load_u64L _elf_load_u64L
#define __load_u64M _elf_load_u64M
#define __load_i64L _elf_load_i64L
#define __load_i64M _elf_load_i64M
#define __store_u64L _elf_store_u64L
#define __store_u64M _elf_store_u64M
#define __store_i64L _elf_store_i64L
#define __store_i64M _elf_store_i64M
#endif /* __LIBELF64 */
#endif /* _BYTESWAP_H */

View File

@ -0,0 +1,996 @@
/*
* elf_repl.h - public header file for systems that lack it.
* Copyright (C) 1995 - 2006 Michael Riepe
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/* @(#) $Id: elf_repl.h,v 1.22 2009/11/01 13:04:19 michael Exp $ */
/*
* NEVER INCLUDE THIS FILE DIRECTLY - USE <libelf.h> INSTEAD!
*/
#ifndef _ELF_REPL_H
#define _ELF_REPL_H
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/*
* Scalar data types
*/
typedef __libelf_u32_t Elf32_Addr;
typedef __libelf_u16_t Elf32_Half;
typedef __libelf_u32_t Elf32_Off;
typedef __libelf_i32_t Elf32_Sword;
typedef __libelf_u32_t Elf32_Word;
#define ELF32_FSZ_ADDR 4
#define ELF32_FSZ_HALF 2
#define ELF32_FSZ_OFF 4
#define ELF32_FSZ_SWORD 4
#define ELF32_FSZ_WORD 4
#if __LIBELF64
typedef __libelf_u64_t Elf64_Addr;
typedef __libelf_u16_t Elf64_Half;
typedef __libelf_u64_t Elf64_Off;
typedef __libelf_i32_t Elf64_Sword;
typedef __libelf_u32_t Elf64_Word;
typedef __libelf_i64_t Elf64_Sxword;
typedef __libelf_u64_t Elf64_Xword;
#define ELF64_FSZ_ADDR 8
#define ELF64_FSZ_HALF 2
#define ELF64_FSZ_OFF 8
#define ELF64_FSZ_SWORD 4
#define ELF64_FSZ_WORD 4
#define ELF64_FSZ_SXWORD 8
#define ELF64_FSZ_XWORD 8
/*
* Blame Sun for this...
*/
typedef __libelf_u64_t Elf64_Lword;
typedef __libelf_u64_t Elf32_Lword;
#endif /* __LIBELF64 */
/*
* ELF header
*/
#define EI_NIDENT 16
typedef struct {
unsigned char e_ident[EI_NIDENT];
Elf32_Half e_type;
Elf32_Half e_machine;
Elf32_Word e_version;
Elf32_Addr e_entry;
Elf32_Off e_phoff;
Elf32_Off e_shoff;
Elf32_Word e_flags;
Elf32_Half e_ehsize;
Elf32_Half e_phentsize;
Elf32_Half e_phnum;
Elf32_Half e_shentsize;
Elf32_Half e_shnum;
Elf32_Half e_shstrndx;
} Elf32_Ehdr;
#if __LIBELF64
typedef struct {
unsigned char e_ident[EI_NIDENT];
Elf64_Half e_type;
Elf64_Half e_machine;
Elf64_Word e_version;
Elf64_Addr e_entry;
Elf64_Off e_phoff;
Elf64_Off e_shoff;
Elf64_Word e_flags;
Elf64_Half e_ehsize;
Elf64_Half e_phentsize;
Elf64_Half e_phnum;
Elf64_Half e_shentsize;
Elf64_Half e_shnum;
Elf64_Half e_shstrndx;
} Elf64_Ehdr;
#endif /* __LIBELF64 */
/*
* e_ident
*/
#define EI_MAG0 0
#define EI_MAG1 1
#define EI_MAG2 2
#define EI_MAG3 3
#define EI_CLASS 4
#define EI_DATA 5
#define EI_VERSION 6
#define EI_OSABI 7
#define EI_ABIVERSION 8
#define EI_PAD 9
#define ELFMAG0 0x7f
#define ELFMAG1 'E'
#define ELFMAG2 'L'
#define ELFMAG3 'F'
#define ELFMAG "\177ELF"
#define SELFMAG 4
/*
* e_ident[EI_CLASS]
*/
#define ELFCLASSNONE 0
#define ELFCLASS32 1
#define ELFCLASS64 2
#define ELFCLASSNUM 3
/*
* e_ident[EI_DATA]
*/
#define ELFDATANONE 0
#define ELFDATA2LSB 1
#define ELFDATA2MSB 2
#define ELFDATANUM 3
/*
* e_ident[EI_OSABI]
*/
#define ELFOSABI_NONE 0 /* No extensions or unspecified */
#define ELFOSABI_SYSV ELFOSABI_NONE
#define ELFOSABI_HPUX 1 /* Hewlett-Packard HP-UX */
#define ELFOSABI_NETBSD 2 /* NetBSD */
#define ELFOSABI_LINUX 3 /* Linux */
#define ELFOSABI_SOLARIS 6 /* Sun Solaris */
#define ELFOSABI_AIX 7 /* AIX */
#define ELFOSABI_IRIX 8 /* IRIX */
#define ELFOSABI_FREEBSD 9 /* FreeBSD */
#define ELFOSABI_TRU64 10 /* Compaq TRU64 UNIX */
#define ELFOSABI_MODESTO 11 /* Novell Modesto */
#define ELFOSABI_OPENBSD 12 /* Open BSD */
#define ELFOSABI_OPENVMS 13 /* Open VMS */
#define ELFOSABI_NSK 14 /* Hewlett-Packard Non-Stop Kernel */
#define ELFOSABI_AROS 15 /* Amiga Research OS */
/* these are probably obsolete: */
#define ELFOSABI_ARM 97 /* ARM */
#define ELFOSABI_STANDALONE 255 /* standalone (embedded) application */
/*
* e_type
*/
#define ET_NONE 0
#define ET_REL 1
#define ET_EXEC 2
#define ET_DYN 3
#define ET_CORE 4
#define ET_NUM 5
#define ET_LOOS 0xfe00
#define ET_HIOS 0xfeff
#define ET_LOPROC 0xff00
#define ET_HIPROC 0xffff
/*
* e_machine
*/
#define EM_NONE 0 /* No machine */
#define EM_M32 1 /* AT&T WE 32100 */
#define EM_SPARC 2 /* SPARC */
#define EM_386 3 /* Intel 80386 */
#define EM_68K 4 /* Motorola 68000 */
#define EM_88K 5 /* Motorola 88000 */
#define EM_486 6 /* Intel i486 (DO NOT USE THIS ONE) */
#define EM_860 7 /* Intel 80860 */
#define EM_MIPS 8 /* MIPS I Architecture */
#define EM_S370 9 /* IBM System/370 Processor */
#define EM_MIPS_RS3_LE 10 /* MIPS RS3000 Little-endian */
#define EM_SPARC64 11 /* SPARC 64-bit */
#define EM_PARISC 15 /* Hewlett-Packard PA-RISC */
#define EM_VPP500 17 /* Fujitsu VPP500 */
#define EM_SPARC32PLUS 18 /* Enhanced instruction set SPARC */
#define EM_960 19 /* Intel 80960 */
#define EM_PPC 20 /* PowerPC */
#define EM_PPC64 21 /* 64-bit PowerPC */
#define EM_S390 22 /* IBM System/390 Processor */
#define EM_V800 36 /* NEC V800 */
#define EM_FR20 37 /* Fujitsu FR20 */
#define EM_RH32 38 /* TRW RH-32 */
#define EM_RCE 39 /* Motorola RCE */
#define EM_ARM 40 /* Advanced RISC Machines ARM */
#define EM_ALPHA 41 /* Digital Alpha */
#define EM_SH 42 /* Hitachi SH */
#define EM_SPARCV9 43 /* SPARC Version 9 */
#define EM_TRICORE 44 /* Siemens TriCore embedded processor */
#define EM_ARC 45 /* Argonaut RISC Core, Argonaut Technologies Inc. */
#define EM_H8_300 46 /* Hitachi H8/300 */
#define EM_H8_300H 47 /* Hitachi H8/300H */
#define EM_H8S 48 /* Hitachi H8S */
#define EM_H8_500 49 /* Hitachi H8/500 */
#define EM_IA_64 50 /* Intel IA-64 processor architecture */
#define EM_MIPS_X 51 /* Stanford MIPS-X */
#define EM_COLDFIRE 52 /* Motorola ColdFire */
#define EM_68HC12 53 /* Motorola M68HC12 */
#define EM_MMA 54 /* Fujitsu MMA Multimedia Accelerator */
#define EM_PCP 55 /* Siemens PCP */
#define EM_NCPU 56 /* Sony nCPU embedded RISC processor */
#define EM_NDR1 57 /* Denso NDR1 microprocessor */
#define EM_STARCORE 58 /* Motorola Star*Core processor */
#define EM_ME16 59 /* Toyota ME16 processor */
#define EM_ST100 60 /* STMicroelectronics ST100 processor */
#define EM_TINYJ 61 /* Advanced Logic Corp. TinyJ embedded processor family */
#define EM_X86_64 62 /* AMD x86-64 architecture */
#define EM_AMD64 EM_X86_64
#define EM_PDSP 63 /* Sony DSP Processor */
#define EM_FX66 66 /* Siemens FX66 microcontroller */
#define EM_ST9PLUS 67 /* STMicroelectronics ST9+ 8/16 bit microcontroller */
#define EM_ST7 68 /* STMicroelectronics ST7 8-bit microcontroller */
#define EM_68HC16 69 /* Motorola MC68HC16 Microcontroller */
#define EM_68HC11 70 /* Motorola MC68HC11 Microcontroller */
#define EM_68HC08 71 /* Motorola MC68HC08 Microcontroller */
#define EM_68HC05 72 /* Motorola MC68HC05 Microcontroller */
#define EM_SVX 73 /* Silicon Graphics SVx */
#define EM_ST19 74 /* STMicroelectronics ST19 8-bit microcontroller */
#define EM_VAX 75 /* Digital VAX */
#define EM_CRIS 76 /* Axis Communications 32-bit embedded processor */
#define EM_JAVELIN 77 /* Infineon Technologies 32-bit embedded processor */
#define EM_FIREPATH 78 /* Element 14 64-bit DSP Processor */
#define EM_ZSP 79 /* LSI Logic 16-bit DSP Processor */
#define EM_MMIX 80 /* Donald Knuth's educational 64-bit processor */
#define EM_HUANY 81 /* Harvard University machine-independent object files */
#define EM_PRISM 82 /* SiTera Prism */
#define EM_AVR 83 /* Atmel AVR 8-bit microcontroller */
#define EM_FR30 84 /* Fujitsu FR30 */
#define EM_D10V 85 /* Mitsubishi D10V */
#define EM_D30V 86 /* Mitsubishi D30V */
#define EM_V850 87 /* NEC v850 */
#define EM_M32R 88 /* Mitsubishi M32R */
#define EM_MN10300 89 /* Matsushita MN10300 */
#define EM_MN10200 90 /* Matsushita MN10200 */
#define EM_PJ 91 /* picoJava */
#define EM_OPENRISC 92 /* OpenRISC 32-bit embedded processor */
#define EM_ARC_A5 93 /* ARC Cores Tangent-A5 */
#define EM_XTENSA 94 /* Tensilica Xtensa Architecture */
#define EM_VIDEOCORE 95 /* Alphamosaic VideoCore processor */
#define EM_TMM_GPP 96 /* Thompson Multimedia General Purpose Processor */
#define EM_NS32K 97 /* National Semiconductor 32000 series */
#define EM_TPC 98 /* Tenor Network TPC processor */
#define EM_SNP1K 99 /* Trebia SNP 1000 processor */
#define EM_ST200 100 /* STMicroelectronics (www.st.com) ST200 microcontroller */
#define EM_IP2K 101 /* Ubicom IP2xxx microcontroller family */
#define EM_MAX 102 /* MAX Processor */
#define EM_CR 103 /* National Semiconductor CompactRISC microprocessor */
#define EM_F2MC16 104 /* Fujitsu F2MC16 */
#define EM_MSP430 105 /* Texas Instruments embedded microcontroller msp430 */
#define EM_BLACKFIN 106 /* Analog Devices Blackfin (DSP) processor */
#define EM_SE_C33 107 /* S1C33 Family of Seiko Epson processors */
#define EM_SEP 108 /* Sharp embedded microprocessor */
#define EM_ARCA 109 /* Arca RISC Microprocessor */
#define EM_UNICORE 110 /* Microprocessor series from PKU-Unity Ltd. and MPRC of Peking University */
#define EM_NUM 111
/*
* e_ident[EI_VERSION], e_version
*/
#define EV_NONE 0
#define EV_CURRENT 1
#define EV_NUM 2
/*
* Section header
*/
typedef struct {
Elf32_Word sh_name;
Elf32_Word sh_type;
Elf32_Word sh_flags;
Elf32_Addr sh_addr;
Elf32_Off sh_offset;
Elf32_Word sh_size;
Elf32_Word sh_link;
Elf32_Word sh_info;
Elf32_Word sh_addralign;
Elf32_Word sh_entsize;
} Elf32_Shdr;
#if __LIBELF64
typedef struct {
Elf64_Word sh_name;
Elf64_Word sh_type;
Elf64_Xword sh_flags;
Elf64_Addr sh_addr;
Elf64_Off sh_offset;
Elf64_Xword sh_size;
Elf64_Word sh_link;
Elf64_Word sh_info;
Elf64_Xword sh_addralign;
Elf64_Xword sh_entsize;
} Elf64_Shdr;
#endif /* __LIBELF64 */
/*
* Special section indices
*/
#define SHN_UNDEF 0
#define SHN_LORESERVE 0xff00
#define SHN_LOPROC 0xff00
#define SHN_HIPROC 0xff1f
#define SHN_LOOS 0xff20
#define SHN_HIOS 0xff3f
#define SHN_ABS 0xfff1
#define SHN_COMMON 0xfff2
#define SHN_XINDEX 0xffff
#define SHN_HIRESERVE 0xffff
/*
* sh_type
*/
#define SHT_NULL 0
#define SHT_PROGBITS 1
#define SHT_SYMTAB 2
#define SHT_STRTAB 3
#define SHT_RELA 4
#define SHT_HASH 5
#define SHT_DYNAMIC 6
#define SHT_NOTE 7
#define SHT_NOBITS 8
#define SHT_REL 9
#define SHT_SHLIB 10
#define SHT_DYNSYM 11
#define SHT_INIT_ARRAY 14
#define SHT_FINI_ARRAY 15
#define SHT_PREINIT_ARRAY 16
#define SHT_GROUP 17
#define SHT_SYMTAB_SHNDX 18
#define SHT_NUM 19
#define SHT_LOOS 0x60000000
#define SHT_HIOS 0x6fffffff
#define SHT_LOPROC 0x70000000
#define SHT_HIPROC 0x7fffffff
#define SHT_LOUSER 0x80000000
#define SHT_HIUSER 0xffffffff
/*
* Solaris extensions
*/
#define SHT_LOSUNW 0x6ffffff4
#define SHT_SUNW_dof 0x6ffffff4
#define SHT_SUNW_cap 0x6ffffff5
#define SHT_SUNW_SIGNATURE 0x6ffffff6
#define SHT_SUNW_ANNOTATE 0x6ffffff7
#define SHT_SUNW_DEBUGSTR 0x6ffffff8
#define SHT_SUNW_DEBUG 0x6ffffff9
#define SHT_SUNW_move 0x6ffffffa
#define SHT_SUNW_COMDAT 0x6ffffffb
#define SHT_SUNW_syminfo 0x6ffffffc
#define SHT_SUNW_verdef 0x6ffffffd
#define SHT_SUNW_verneed 0x6ffffffe
#define SHT_SUNW_versym 0x6fffffff
#define SHT_HISUNW 0x6fffffff
#define SHT_SPARC_GOTDATA 0x70000000
#define SHT_AMD64_UNWIND 0x70000001
/*
* GNU extensions
*/
#define SHT_GNU_verdef 0x6ffffffd
#define SHT_GNU_verneed 0x6ffffffe
#define SHT_GNU_versym 0x6fffffff
/*
* sh_flags
*/
#define SHF_WRITE 0x1
#define SHF_ALLOC 0x2
#define SHF_EXECINSTR 0x4
#define SHF_MERGE 0x10
#define SHF_STRINGS 0x20
#define SHF_INFO_LINK 0x40
#define SHF_LINK_ORDER 0x80
#define SHF_OS_NONCONFORMING 0x100
#define SHF_GROUP 0x200
#define SHF_TLS 0x400
#define SHF_MASKOS 0x0ff00000
#define SHF_MASKPROC 0xf0000000
/*
* Solaris extensions
*/
#define SHF_AMD64_LARGE 0x10000000
#define SHF_ORDERED 0x40000000
#define SHF_EXCLUDE 0x80000000
/*
* Section group flags
*/
#define GRP_COMDAT 0x1
#define GRP_MASKOS 0x0ff00000
#define GRP_MASKPROC 0xf0000000
/*
* Symbol table
*/
typedef struct {
Elf32_Word st_name;
Elf32_Addr st_value;
Elf32_Word st_size;
unsigned char st_info;
unsigned char st_other;
Elf32_Half st_shndx;
} Elf32_Sym;
#if __LIBELF64
typedef struct {
Elf64_Word st_name;
unsigned char st_info;
unsigned char st_other;
Elf64_Half st_shndx;
Elf64_Addr st_value;
Elf64_Xword st_size;
} Elf64_Sym;
#endif /* __LIBELF64 */
/*
* Special symbol indices
*/
#define STN_UNDEF 0
/*
* Macros for manipulating st_info
*/
#define ELF32_ST_BIND(i) ((i)>>4)
#define ELF32_ST_TYPE(i) ((i)&0xf)
#define ELF32_ST_INFO(b,t) (((b)<<4)+((t)&0xf))
#if __LIBELF64
#define ELF64_ST_BIND(i) ((i)>>4)
#define ELF64_ST_TYPE(i) ((i)&0xf)
#define ELF64_ST_INFO(b,t) (((b)<<4)+((t)&0xf))
#endif /* __LIBELF64 */
/*
* Symbol binding
*/
#define STB_LOCAL 0
#define STB_GLOBAL 1
#define STB_WEAK 2
#define STB_NUM 3
#define STB_LOOS 10
#define STB_HIOS 12
#define STB_LOPROC 13
#define STB_HIPROC 15
/*
* Symbol types
*/
#define STT_NOTYPE 0
#define STT_OBJECT 1
#define STT_FUNC 2
#define STT_SECTION 3
#define STT_FILE 4
#define STT_COMMON 5
#define STT_TLS 6
#define STT_NUM 7
#define STT_LOOS 10
#define STT_HIOS 12
#define STT_LOPROC 13
#define STT_HIPROC 15
/*
* Macros for manipulating st_other
*/
#define ELF32_ST_VISIBILITY(o) ((o)&0x3)
#if __LIBELF64
#define ELF64_ST_VISIBILITY(o) ((o)&0x3)
#endif /* __LIBELF64 */
/*
* Symbol visibility
*/
#define STV_DEFAULT 0
#define STV_INTERNAL 1
#define STV_HIDDEN 2
#define STV_PROTECTED 3
/*
* Relocation
*/
typedef struct {
Elf32_Addr r_offset;
Elf32_Word r_info;
} Elf32_Rel;
typedef struct {
Elf32_Addr r_offset;
Elf32_Word r_info;
Elf32_Sword r_addend;
} Elf32_Rela;
#if __LIBELF64
typedef struct {
Elf64_Addr r_offset;
Elf64_Xword r_info;
} Elf64_Rel;
typedef struct {
Elf64_Addr r_offset;
Elf64_Xword r_info;
Elf64_Sxword r_addend;
} Elf64_Rela;
#endif /* __LIBELF64 */
/*
* Macros for manipulating r_info
*/
#define ELF32_R_SYM(i) ((i)>>8)
#define ELF32_R_TYPE(i) ((unsigned char)(i))
#define ELF32_R_INFO(s,t) (((s)<<8)+(unsigned char)(t))
#if __LIBELF64
#define ELF64_R_SYM(i) ((Elf64_Xword)(i)>>32)
#define ELF64_R_TYPE(i) ((i)&0xffffffffL)
#define ELF64_R_INFO(s,t) (((Elf64_Xword)(s)<<32)+((t)&0xffffffffL))
#endif /* __LIBELF64 */
/*
* Note entry header
*/
typedef struct {
Elf32_Word n_namesz; /* name size */
Elf32_Word n_descsz; /* descriptor size */
Elf32_Word n_type; /* descriptor type */
} Elf32_Nhdr;
#if __LIBELF64
/* Solaris and GNU use this layout. Be compatible. */
/* XXX: Latest ELF specs say it's 64-bit!!! */
typedef struct {
Elf64_Word n_namesz; /* name size */
Elf64_Word n_descsz; /* descriptor size */
Elf64_Word n_type; /* descriptor type */
} Elf64_Nhdr;
#endif /* __LIBELF64 */
/*
* Well-known descriptor types for ET_CORE files
*/
#define NT_PRSTATUS 1
#define NT_PRFPREG 2
#define NT_PRPSINFO 3
/*
* Program header
*/
typedef struct {
Elf32_Word p_type;
Elf32_Off p_offset;
Elf32_Addr p_vaddr;
Elf32_Addr p_paddr;
Elf32_Word p_filesz;
Elf32_Word p_memsz;
Elf32_Word p_flags;
Elf32_Word p_align;
} Elf32_Phdr;
#if __LIBELF64
typedef struct {
Elf64_Word p_type;
Elf64_Word p_flags;
Elf64_Off p_offset;
Elf64_Addr p_vaddr;
Elf64_Addr p_paddr;
Elf64_Xword p_filesz;
Elf64_Xword p_memsz;
Elf64_Xword p_align;
} Elf64_Phdr;
#endif /* __LIBELF64 */
/*
* Special numbers
*/
#define PN_XNUM 0xffff
/*
* p_type
*/
#define PT_NULL 0
#define PT_LOAD 1
#define PT_DYNAMIC 2
#define PT_INTERP 3
#define PT_NOTE 4
#define PT_SHLIB 5
#define PT_PHDR 6
#define PT_TLS 7
#define PT_NUM 8
#define PT_LOOS 0x60000000
#define PT_HIOS 0x6fffffff
#define PT_LOPROC 0x70000000
#define PT_HIPROC 0x7fffffff
/*
* Solaris extensions
*/
#define PT_SUNW_UNWIND 0x6464e550
#define PT_LOSUNW 0x6ffffffa
#define PT_SUNWBSS 0x6ffffffa
#define PT_SUNWSTACK 0x6ffffffb
#define PT_SUNWDTRACE 0x6ffffffc
#define PT_SUNWCAP 0x6ffffffd
#define PT_HISUNW 0x6fffffff
/*
* p_flags
*/
#define PF_X 0x1
#define PF_W 0x2
#define PF_R 0x4
#define PF_MASKOS 0x0ff00000
#define PF_MASKPROC 0xf0000000
/*
* Dynamic structure
*/
typedef struct {
Elf32_Sword d_tag;
union {
Elf32_Word d_val;
Elf32_Addr d_ptr;
} d_un;
} Elf32_Dyn;
#if __LIBELF64
typedef struct {
Elf64_Sxword d_tag;
union {
Elf64_Xword d_val;
Elf64_Addr d_ptr;
} d_un;
} Elf64_Dyn;
#endif /* __LIBELF64 */
/*
* Dynamic array tags
*/
/* d_un exec shared */
#define DT_NULL 0 /* ign. mand. mand. */
#define DT_NEEDED 1 /* d_val opt. opt. */
#define DT_PLTRELSZ 2 /* d_val opt. opt. */
#define DT_PLTGOT 3 /* d_ptr opt. opt. */
#define DT_HASH 4 /* d_ptr mand. mand. */
#define DT_STRTAB 5 /* d_ptr mand. mand. */
#define DT_SYMTAB 6 /* d_ptr mand. mand. */
#define DT_RELA 7 /* d_ptr mand. opt. */
#define DT_RELASZ 8 /* d_val mand. opt. */
#define DT_RELAENT 9 /* d_val mand. opt. */
#define DT_STRSZ 10 /* d_val mand. mand. */
#define DT_SYMENT 11 /* d_val mand. mand. */
#define DT_INIT 12 /* d_ptr opt. opt. */
#define DT_FINI 13 /* d_ptr opt. opt. */
#define DT_SONAME 14 /* d_val ign. opt. */
#define DT_RPATH 15 /* d_val opt. ign. */
#define DT_SYMBOLIC 16 /* ign. ign. opt. */
#define DT_REL 17 /* d_ptr mand. opt. */
#define DT_RELSZ 18 /* d_val mand. opt. */
#define DT_RELENT 19 /* d_val mand. opt. */
#define DT_PLTREL 20 /* d_val opt. opt. */
#define DT_DEBUG 21 /* d_ptr opt. ign. */
#define DT_TEXTREL 22 /* ign. opt. opt. */
#define DT_JMPREL 23 /* d_ptr opt. opt. */
#define DT_BIND_NOW 24 /* ign. opt. opt. */
#define DT_INIT_ARRAY 25 /* d_ptr opt. opt. */
#define DT_FINI_ARRAY 26 /* d_ptr opt. opt. */
#define DT_INIT_ARRAYSZ 27 /* d_val opt. opt. */
#define DT_FINI_ARRAYSZ 28 /* d_val opt. opt. */
#define DT_RUNPATH 29 /* d_val opt. opt. */
#define DT_FLAGS 30 /* d_val opt. opt. */
#define DT_ENCODING 32 /* odd/even encoding rule starts here */
#define DT_PREINIT_ARRAY 32 /* d_ptr opt. ign. */
#define DT_PREINIT_ARRAYSZ 33 /* d_val opt. ign. */
#define DT_NUM 34
#define DT_LOOS 0x6000000D
#define DT_HIOS 0x6ffff000
#define DT_LOPROC 0x70000000
#define DT_HIPROC 0x7fffffff
/*
* DT_FLAGS values
*/
#define DF_ORIGIN 0x1
#define DF_SYMBOLIC 0x2
#define DF_TEXTREL 0x4
#define DF_BIND_NOW 0x8
#define DF_STATIC_TLS 0x10
/*
* Solaris extensions
*/
#define DT_VALRNGLO 0x6ffffd00
#define DT_CHECKSUM 0x6ffffdf8
#define DT_PLTPADSZ 0x6ffffdf9
#define DT_MOVEENT 0x6ffffdfa
#define DT_MOVESZ 0x6ffffdfb
#define DT_FEATURE_1 0x6ffffdfc
#define DT_POSFLAG_1 0x6ffffdfd
#define DT_SYMINSZ 0x6ffffdfe
#define DT_SYMINENT 0x6ffffdff
#define DT_VALRNGHI 0x6ffffdff
#define DT_ADDRRNGLO 0x6ffffe00
#define DT_CONFIG 0x6ffffefa
#define DT_DEPAUDIT 0x6ffffefb
#define DT_AUDIT 0x6ffffefc
#define DT_PLTPAD 0x6ffffefd
#define DT_MOVETAB 0x6ffffefe
#define DT_SYMINFO 0x6ffffeff
#define DT_ADDRRNGHI 0x6ffffeff
#define DT_RELACOUNT 0x6ffffff9
#define DT_RELCOUNT 0x6ffffffa
#define DT_FLAGS_1 0x6ffffffb
#define DT_VERDEF 0x6ffffffc
#define DT_VERDEFNUM 0x6ffffffd
#define DT_VERNEED 0x6ffffffe
#define DT_VERNEEDNUM 0x6fffffff
#define DT_AUXILIARY 0x7ffffffd
#define DT_USED 0x7ffffffe
#define DT_FILTER 0x7fffffff
/*
* GNU extensions
*/
#define DT_VERSYM 0x6ffffff0
/*
* DT_FEATURE_1 values
*/
#define DTF_1_PARINIT 0x1
#define DTF_1_CONFEXP 0x2
/*
* DT_POSFLAG_1 values
*/
#define DF_P1_LAZYLOAD 0x1
#define DF_P1_GROUPPERM 0x2
/*
* DT_FLAGS_1 values
*/
#define DF_1_NOW 0x00000001
#define DF_1_GLOBAL 0x00000002
#define DF_1_GROUP 0x00000004
#define DF_1_NODELETE 0x00000008
#define DF_1_LOADFLTR 0x00000010
#define DF_1_INITFIRST 0x00000020
#define DF_1_NOOPEN 0x00000040
#define DF_1_ORIGIN 0x00000080
#define DF_1_DIRECT 0x00000100
#define DF_1_TRANS 0x00000200
#define DF_1_INTERPOSE 0x00000400
#define DF_1_NODEFLIB 0x00000800
#define DF_1_NODUMP 0x00001000
#define DF_1_CONFALT 0x00002000
#define DF_1_ENDFILTEE 0x00004000
#define DF_1_DISPRELDNE 0x00008000
#define DF_1_DISPRELPND 0x00010000
/*
* Syminfo structure
*/
typedef struct {
Elf32_Half si_boundto;
Elf32_Half si_flags;
} Elf32_Syminfo;
#if __LIBELF64
typedef struct {
Elf64_Half si_boundto;
Elf64_Half si_flags;
} Elf64_Syminfo;
#endif /* __LIBELF64 */
/*
* Syminfo version (stored in unused first entry)
*/
#define SYMINFO_NONE 0
#define SYMINFO_CURRENT 1
#define SYMINFO_NUM 2
/*
* si_boundto special values
*/
#define SYMINFO_BT_LOWRESERVE 0xff00
#define SYMINFO_BT_PARENT 0xfffe /* bound to parent */
#define SYMINFO_BT_SELF 0xffff /* bound to self */
/*
* si_flags
*/
#define SYMINFO_FLG_DIRECT 0x01 /* bound to an object */
#define SYMINFO_FLG_PASSTHRU 0x02 /* pass-thru symbol */
#define SYMINFO_FLG_COPY 0x04 /* result of a copy relocation */
#define SYMINFO_FLG_LAZYLOAD 0x08 /* bound to lazy-loaded object */
/*
* Version definitions
*/
typedef struct {
Elf32_Half vd_version;
Elf32_Half vd_flags;
Elf32_Half vd_ndx;
Elf32_Half vd_cnt;
Elf32_Word vd_hash;
Elf32_Word vd_aux;
Elf32_Word vd_next;
} Elf32_Verdef;
typedef struct {
Elf32_Word vda_name;
Elf32_Word vda_next;
} Elf32_Verdaux;
typedef struct {
Elf32_Half vn_version;
Elf32_Half vn_cnt;
Elf32_Word vn_file;
Elf32_Word vn_aux;
Elf32_Word vn_next;
} Elf32_Verneed;
typedef struct {
Elf32_Word vna_hash;
Elf32_Half vna_flags;
Elf32_Half vna_other;
Elf32_Word vna_name;
Elf32_Word vna_next;
} Elf32_Vernaux;
typedef Elf32_Half Elf32_Versym;
#if __LIBELF64
typedef struct {
Elf64_Half vd_version;
Elf64_Half vd_flags;
Elf64_Half vd_ndx;
Elf64_Half vd_cnt;
Elf64_Word vd_hash;
Elf64_Word vd_aux;
Elf64_Word vd_next;
} Elf64_Verdef;
typedef struct {
Elf64_Word vda_name;
Elf64_Word vda_next;
} Elf64_Verdaux;
typedef struct {
Elf64_Half vn_version;
Elf64_Half vn_cnt;
Elf64_Word vn_file;
Elf64_Word vn_aux;
Elf64_Word vn_next;
} Elf64_Verneed;
typedef struct {
Elf64_Word vna_hash;
Elf64_Half vna_flags;
Elf64_Half vna_other;
Elf64_Word vna_name;
Elf64_Word vna_next;
} Elf64_Vernaux;
typedef Elf64_Half Elf64_Versym;
#endif /* __LIBELF64 */
/*
* vd_version
*/
#define VER_DEF_NONE 0
#define VER_DEF_CURRENT 1
#define VER_DEF_NUM 2
/*
* vn_version
*/
#define VER_NEED_NONE 0
#define VER_NEED_CURRENT 1
#define VER_NEED_NUM 2
/*
* vd_flags / vna_flags
*/
#define VER_FLG_BASE 0x1 /* vd_flags only */
#define VER_FLG_WEAK 0x2
/*
* Elf*_Versym special values
*/
#define VER_NDX_LOCAL 0
#define VER_NDX_GLOBAL 1
/*
* Solaris extensions
*/
/*
* Move section
*/
#if __LIBELF64
typedef struct {
Elf32_Lword m_value;
Elf32_Word m_info;
Elf32_Word m_poffset;
Elf32_Half m_repeat;
Elf32_Half m_stride;
} Elf32_Move;
typedef struct {
Elf64_Lword m_value;
Elf64_Xword m_info;
Elf64_Xword m_poffset;
Elf64_Half m_repeat;
Elf64_Half m_stride;
} Elf64_Move;
#define ELF32_M_SYM(info) ((info)>>8)
#define ELF32_M_SIZE(info) ((unsigned char)(info))
#define ELF32_M_INFO(sym, sz) (((sym)<<8)+(unsigned char)(sz))
#define ELF64_M_SYM(info) ((Elf64_Xword)(info)>>8)
#define ELF64_M_SIZE(info) ((unsigned char)(info))
#define ELF64_M_INFO(sym, sz) (((Elf64_Xword)(sym)<<8)+(unsigned char)(sz))
#endif /* __LIBELF64 */
/*
* Capabilities
*/
typedef struct {
Elf32_Word c_tag;
union {
Elf32_Word c_val;
Elf32_Addr c_ptr;
} c_un;
} Elf32_Cap;
#if __LIBELF64
typedef struct {
Elf64_Xword c_tag;
union {
Elf64_Xword c_val;
Elf64_Addr c_ptr;
} c_un;
} Elf64_Cap;
#endif /* __LIBELF64 */
#define CA_SUNW_NULL 0 /* c_un ignored */
#define CA_SUNW_HW_1 1 /* c_un.c_val */
#define CA_SUNW_SF_1 2 /* c_un.c_val */
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* _ELF_REPL_H */

View File

@ -0,0 +1,100 @@
/*
* errors.h - exhaustive list of all error codes and messages for libelf.
* Copyright (C) 1995 - 2003, 2006 Michael Riepe
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/* @(#) $Id: errors.h,v 1.18 2008/05/23 08:15:34 michael Exp $ */
/* dummy for xgettext */
#define _(str) str
__err__(ERROR_OK, _("no error"))
__err__(ERROR_UNKNOWN, _("unknown error"))
__err__(ERROR_INTERNAL, _("Internal error: unknown reason"))
__err__(ERROR_UNIMPLEMENTED, _("Internal error: not implemented"))
__err__(ERROR_WRONLY, _("Request error: cntl(ELF_C_FDREAD) on write-only file"))
__err__(ERROR_INVALID_CMD, _("Request error: invalid ELF_C_* argument"))
__err__(ERROR_FDDISABLED, _("Request error: file descriptor disabled"))
__err__(ERROR_NOTARCHIVE, _("Request error: not an archive"))
__err__(ERROR_BADOFF, _("Request error: offset out of range"))
__err__(ERROR_UNKNOWN_VERSION, _("Request error: unknown ELF version"))
__err__(ERROR_CMDMISMATCH, _("Request error: ELF_C_* argument does not match"))
__err__(ERROR_MEMBERWRITE, _("Request error: archive member begin() for writing"))
__err__(ERROR_FDMISMATCH, _("Request error: archive/member file descriptor mismatch"))
__err__(ERROR_NOTELF, _("Request error: not an ELF file"))
__err__(ERROR_CLASSMISMATCH, _("Request error: class file/memory mismatch"))
__err__(ERROR_UNKNOWN_TYPE, _("Request error: invalid ELF_T_* argument"))
__err__(ERROR_UNKNOWN_ENCODING, _("Request error: unknown data encoding"))
__err__(ERROR_DST2SMALL, _("Request error: destination buffer too small"))
__err__(ERROR_NULLBUF, _("Request error: d_buf is NULL"))
__err__(ERROR_UNKNOWN_CLASS, _("Request error: unknown ELF class"))
__err__(ERROR_ELFSCNMISMATCH, _("Request error: section does not belong to file"))
__err__(ERROR_NOSUCHSCN, _("Request error: no section at index"))
__err__(ERROR_NULLSCN, _("Request error: can't manipulate null section"))
__err__(ERROR_SCNDATAMISMATCH, _("Request error: data does not belong to section"))
__err__(ERROR_NOSTRTAB, _("Request error: no string table"))
__err__(ERROR_BADSTROFF, _("Request error: string table offset out of range"))
__err__(ERROR_RDONLY, _("Request error: update(ELF_C_WRITE) on read-only file"))
__err__(ERROR_IO_SEEK, _("I/O error: seek"))
__err__(ERROR_IO_2BIG, _("I/O error: file too big for memory"))
__err__(ERROR_IO_READ, _("I/O error: raw read"))
__err__(ERROR_IO_GETSIZE, _("I/O error: get file size"))
__err__(ERROR_IO_WRITE, _("I/O error: output write"))
__err__(ERROR_IO_TRUNC, _("I/O error: can't truncate output file"))
__err__(ERROR_VERSION_UNSET, _("Sequence error: must set ELF version first"))
__err__(ERROR_NOEHDR, _("Sequence error: must create ELF header first"))
__err__(ERROR_OUTSIDE, _("Format error: reference outside file"))
__err__(ERROR_TRUNC_ARHDR, _("Format error: archive header truncated"))
__err__(ERROR_ARFMAG, _("Format error: archive fmag"))
__err__(ERROR_ARHDR, _("Format error: archive header"))
__err__(ERROR_TRUNC_MEMBER, _("Format error: archive member truncated"))
__err__(ERROR_SIZE_ARSYMTAB, _("Format error: archive symbol table size"))
__err__(ERROR_ARSTRTAB, _("Format error: archive string table"))
__err__(ERROR_ARSPECIAL, _("Format error: archive special name unknown"))
__err__(ERROR_TRUNC_EHDR, _("Format error: ELF header truncated"))
__err__(ERROR_TRUNC_PHDR, _("Format error: program header table truncated"))
__err__(ERROR_TRUNC_SHDR, _("Format error: section header table truncated"))
__err__(ERROR_TRUNC_SCN, _("Format error: data region truncated"))
__err__(ERROR_ALIGN_PHDR, _("Format error: program header table alignment"))
__err__(ERROR_ALIGN_SHDR, _("Format error: section header table alignment"))
__err__(ERROR_VERDEF_FORMAT, _("Format error: bad parameter in Verdef record"))
__err__(ERROR_VERDEF_VERSION, _("Format error: unknown Verdef version"))
__err__(ERROR_VERNEED_FORMAT, _("Format error: bad parameter in Verneed record"))
__err__(ERROR_VERNEED_VERSION, _("Format error: unknown Verneed version"))
__err__(ERROR_EHDR_SHNUM, _("Format error: bad e_shnum value"))
__err__(ERROR_EHDR_SHENTSIZE, _("Format error: bad e_shentsize value"))
__err__(ERROR_EHDR_PHENTSIZE, _("Format error: bad e_phentsize value"))
__err__(ERROR_UNTERM, _("Format error: unterminated string in string table"))
__err__(ERROR_SCN2SMALL, _("Layout error: section size too small for data"))
__err__(ERROR_SCN_OVERLAP, _("Layout error: overlapping sections"))
__err__(ERROR_MEM_ELF, _("Memory error: elf descriptor"))
__err__(ERROR_MEM_ARSYMTAB, _("Memory error: archive symbol table"))
__err__(ERROR_MEM_ARHDR, _("Memory error: archive member header"))
__err__(ERROR_MEM_EHDR, _("Memory error: ELF header"))
__err__(ERROR_MEM_PHDR, _("Memory error: program header table"))
__err__(ERROR_MEM_SHDR, _("Memory error: section header table"))
__err__(ERROR_MEM_SCN, _("Memory error: section descriptor"))
__err__(ERROR_MEM_SCNDATA, _("Memory error: section data"))
__err__(ERROR_MEM_OUTBUF, _("Memory error: output file space"))
__err__(ERROR_MEM_TEMPORARY, _("Memory error: temporary buffer"))
__err__(ERROR_BADVALUE, _("GElf error: value out of range"))
__err__(ERROR_BADINDEX, _("GElf error: index out of range"))
__err__(ERROR_BADTYPE, _("GElf error: type mismatch"))
__err__(ERROR_MEM_SYM, _("GElf error: not enough memory for GElf_Sym"))
__err__(ERROR_MEM_DYN, _("GElf error: not enough memory for GElf_Dyn"))
__err__(ERROR_MEM_RELA, _("GElf error: not enough memory for GElf_Rela"))
__err__(ERROR_MEM_REL, _("GElf error: not enough memory for GElf_Rel"))

View File

@ -0,0 +1,334 @@
/*
ext_types.h - external representation of ELF data types.
Copyright (C) 1995 - 1998 Michael Riepe
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/* @(#) $Id: ext_types.h,v 1.9 2008/05/23 08:15:34 michael Exp $ */
#ifndef _EXT_TYPES_H
#define _EXT_TYPES_H
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/*
* Scalar data types
*/
typedef unsigned char __ext_Elf32_Addr [ELF32_FSZ_ADDR];
typedef unsigned char __ext_Elf32_Half [ELF32_FSZ_HALF];
typedef unsigned char __ext_Elf32_Off [ELF32_FSZ_OFF];
typedef unsigned char __ext_Elf32_Sword [ELF32_FSZ_SWORD];
typedef unsigned char __ext_Elf32_Word [ELF32_FSZ_WORD];
#if __LIBELF64
typedef unsigned char __ext_Elf32_Lword [8];
typedef unsigned char __ext_Elf64_Addr [ELF64_FSZ_ADDR];
typedef unsigned char __ext_Elf64_Half [ELF64_FSZ_HALF];
typedef unsigned char __ext_Elf64_Off [ELF64_FSZ_OFF];
typedef unsigned char __ext_Elf64_Sword [ELF64_FSZ_SWORD];
typedef unsigned char __ext_Elf64_Word [ELF64_FSZ_WORD];
typedef unsigned char __ext_Elf64_Sxword[ELF64_FSZ_SXWORD];
typedef unsigned char __ext_Elf64_Xword [ELF64_FSZ_XWORD];
typedef unsigned char __ext_Elf64_Lword [8];
#endif /* __LIBELF64 */
/*
* ELF header
*/
typedef struct {
unsigned char e_ident[EI_NIDENT];
__ext_Elf32_Half e_type;
__ext_Elf32_Half e_machine;
__ext_Elf32_Word e_version;
__ext_Elf32_Addr e_entry;
__ext_Elf32_Off e_phoff;
__ext_Elf32_Off e_shoff;
__ext_Elf32_Word e_flags;
__ext_Elf32_Half e_ehsize;
__ext_Elf32_Half e_phentsize;
__ext_Elf32_Half e_phnum;
__ext_Elf32_Half e_shentsize;
__ext_Elf32_Half e_shnum;
__ext_Elf32_Half e_shstrndx;
} __ext_Elf32_Ehdr;
#if __LIBELF64
typedef struct {
unsigned char e_ident[EI_NIDENT];
__ext_Elf64_Half e_type;
__ext_Elf64_Half e_machine;
__ext_Elf64_Word e_version;
__ext_Elf64_Addr e_entry;
__ext_Elf64_Off e_phoff;
__ext_Elf64_Off e_shoff;
__ext_Elf64_Word e_flags;
__ext_Elf64_Half e_ehsize;
__ext_Elf64_Half e_phentsize;
__ext_Elf64_Half e_phnum;
__ext_Elf64_Half e_shentsize;
__ext_Elf64_Half e_shnum;
__ext_Elf64_Half e_shstrndx;
} __ext_Elf64_Ehdr;
#endif /* __LIBELF64 */
/*
* Section header
*/
typedef struct {
__ext_Elf32_Word sh_name;
__ext_Elf32_Word sh_type;
__ext_Elf32_Word sh_flags;
__ext_Elf32_Addr sh_addr;
__ext_Elf32_Off sh_offset;
__ext_Elf32_Word sh_size;
__ext_Elf32_Word sh_link;
__ext_Elf32_Word sh_info;
__ext_Elf32_Word sh_addralign;
__ext_Elf32_Word sh_entsize;
} __ext_Elf32_Shdr;
#if __LIBELF64
typedef struct {
__ext_Elf64_Word sh_name;
__ext_Elf64_Word sh_type;
__ext_Elf64_Xword sh_flags;
__ext_Elf64_Addr sh_addr;
__ext_Elf64_Off sh_offset;
__ext_Elf64_Xword sh_size;
__ext_Elf64_Word sh_link;
__ext_Elf64_Word sh_info;
__ext_Elf64_Xword sh_addralign;
__ext_Elf64_Xword sh_entsize;
} __ext_Elf64_Shdr;
#endif /* __LIBELF64 */
/*
* Symbol table
*/
typedef struct {
__ext_Elf32_Word st_name;
__ext_Elf32_Addr st_value;
__ext_Elf32_Word st_size;
unsigned char st_info;
unsigned char st_other;
__ext_Elf32_Half st_shndx;
} __ext_Elf32_Sym;
#if __LIBELF64
typedef struct {
__ext_Elf64_Word st_name;
unsigned char st_info;
unsigned char st_other;
__ext_Elf64_Half st_shndx;
__ext_Elf64_Addr st_value;
__ext_Elf64_Xword st_size;
} __ext_Elf64_Sym;
#endif /* __LIBELF64 */
/*
* Relocation
*/
typedef struct {
__ext_Elf32_Addr r_offset;
__ext_Elf32_Word r_info;
} __ext_Elf32_Rel;
typedef struct {
__ext_Elf32_Addr r_offset;
__ext_Elf32_Word r_info;
__ext_Elf32_Sword r_addend;
} __ext_Elf32_Rela;
#if __LIBELF64
typedef struct {
__ext_Elf64_Addr r_offset;
#if __LIBELF64_IRIX
__ext_Elf64_Word r_sym;
unsigned char r_ssym;
unsigned char r_type3;
unsigned char r_type2;
unsigned char r_type;
#else /* __LIBELF64_IRIX */
__ext_Elf64_Xword r_info;
#endif /* __LIBELF64_IRIX */
} __ext_Elf64_Rel;
typedef struct {
__ext_Elf64_Addr r_offset;
#if __LIBELF64_IRIX
__ext_Elf64_Word r_sym;
unsigned char r_ssym;
unsigned char r_type3;
unsigned char r_type2;
unsigned char r_type;
#else /* __LIBELF64_IRIX */
__ext_Elf64_Xword r_info;
#endif /* __LIBELF64_IRIX */
__ext_Elf64_Sxword r_addend;
} __ext_Elf64_Rela;
#endif /* __LIBELF64 */
/*
* Program header
*/
typedef struct {
__ext_Elf32_Word p_type;
__ext_Elf32_Off p_offset;
__ext_Elf32_Addr p_vaddr;
__ext_Elf32_Addr p_paddr;
__ext_Elf32_Word p_filesz;
__ext_Elf32_Word p_memsz;
__ext_Elf32_Word p_flags;
__ext_Elf32_Word p_align;
} __ext_Elf32_Phdr;
#if __LIBELF64
typedef struct {
__ext_Elf64_Word p_type;
__ext_Elf64_Word p_flags;
__ext_Elf64_Off p_offset;
__ext_Elf64_Addr p_vaddr;
__ext_Elf64_Addr p_paddr;
__ext_Elf64_Xword p_filesz;
__ext_Elf64_Xword p_memsz;
__ext_Elf64_Xword p_align;
} __ext_Elf64_Phdr;
#endif /* __LIBELF64 */
/*
* Dynamic structure
*/
typedef struct {
__ext_Elf32_Sword d_tag;
union {
__ext_Elf32_Word d_val;
__ext_Elf32_Addr d_ptr;
} d_un;
} __ext_Elf32_Dyn;
#if __LIBELF64
typedef struct {
__ext_Elf64_Sxword d_tag;
union {
__ext_Elf64_Xword d_val;
__ext_Elf64_Addr d_ptr;
} d_un;
} __ext_Elf64_Dyn;
#endif /* __LIBELF64 */
/*
* Version definitions
*/
typedef struct {
__ext_Elf32_Half vd_version;
__ext_Elf32_Half vd_flags;
__ext_Elf32_Half vd_ndx;
__ext_Elf32_Half vd_cnt;
__ext_Elf32_Word vd_hash;
__ext_Elf32_Word vd_aux;
__ext_Elf32_Word vd_next;
} __ext_Elf32_Verdef;
typedef struct {
__ext_Elf32_Word vda_name;
__ext_Elf32_Word vda_next;
} __ext_Elf32_Verdaux;
typedef struct {
__ext_Elf32_Half vn_version;
__ext_Elf32_Half vn_cnt;
__ext_Elf32_Word vn_file;
__ext_Elf32_Word vn_aux;
__ext_Elf32_Word vn_next;
} __ext_Elf32_Verneed;
typedef struct {
__ext_Elf32_Word vna_hash;
__ext_Elf32_Half vna_flags;
__ext_Elf32_Half vna_other;
__ext_Elf32_Word vna_name;
__ext_Elf32_Word vna_next;
} __ext_Elf32_Vernaux;
#if __LIBELF64
typedef struct {
__ext_Elf64_Half vd_version;
__ext_Elf64_Half vd_flags;
__ext_Elf64_Half vd_ndx;
__ext_Elf64_Half vd_cnt;
__ext_Elf64_Word vd_hash;
__ext_Elf64_Word vd_aux;
__ext_Elf64_Word vd_next;
} __ext_Elf64_Verdef;
typedef struct {
__ext_Elf64_Word vda_name;
__ext_Elf64_Word vda_next;
} __ext_Elf64_Verdaux;
typedef struct {
__ext_Elf64_Half vn_version;
__ext_Elf64_Half vn_cnt;
__ext_Elf64_Word vn_file;
__ext_Elf64_Word vn_aux;
__ext_Elf64_Word vn_next;
} __ext_Elf64_Verneed;
typedef struct {
__ext_Elf64_Word vna_hash;
__ext_Elf64_Half vna_flags;
__ext_Elf64_Half vna_other;
__ext_Elf64_Word vna_name;
__ext_Elf64_Word vna_next;
} __ext_Elf64_Vernaux;
#endif /* __LIBELF64 */
/*
* Move section
*/
#if __LIBELF64
typedef struct {
__ext_Elf32_Lword m_value;
__ext_Elf32_Word m_info;
__ext_Elf32_Word m_poffset;
__ext_Elf32_Half m_repeat;
__ext_Elf32_Half m_stride;
} __ext_Elf32_Move;
typedef struct {
__ext_Elf64_Lword m_value;
__ext_Elf64_Xword m_info;
__ext_Elf64_Xword m_poffset;
__ext_Elf64_Half m_repeat;
__ext_Elf64_Half m_stride;
} __ext_Elf64_Move;
#endif /* __LIBELF64 */
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* _EXT_TYPES_H */

View File

@ -0,0 +1,155 @@
/*
* gelf.h - public header file for libelf.
* Copyright (C) 2000 - 2006 Michael Riepe
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/* @(#) $Id: gelf.h,v 1.16 2008/05/23 08:15:34 michael Exp $ */
#ifndef _GELF_H
#define _GELF_H
#if __LIBELF_INTERNAL__
#include <libelf.h>
#else /* __LIBELF_INTERNAL__ */
#include <libelf/libelf.h>
#endif /* __LIBELF_INTERNAL__ */
#if __LIBELF_NEED_LINK_H
#include <link.h>
#elif __LIBELF_NEED_SYS_LINK_H
#include <sys/link.h>
#endif /* __LIBELF_NEED_LINK_H */
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#ifndef __P
# if (__STDC__ + 0) || defined(__cplusplus) || defined(_WIN32)
# define __P(args) args
# else /* __STDC__ || defined(__cplusplus) */
# define __P(args) ()
# endif /* __STDC__ || defined(__cplusplus) */
#endif /* __P */
#if !__LIBELF64
#error "GElf is not supported on this system."
#else /* __LIBELF64 */
typedef Elf64_Addr GElf_Addr;
typedef Elf64_Half GElf_Half;
typedef Elf64_Off GElf_Off;
typedef Elf64_Sword GElf_Sword;
typedef Elf64_Word GElf_Word;
typedef Elf64_Sxword GElf_Sxword;
typedef Elf64_Xword GElf_Xword;
typedef Elf64_Ehdr GElf_Ehdr;
typedef Elf64_Phdr GElf_Phdr;
typedef Elf64_Shdr GElf_Shdr;
typedef Elf64_Dyn GElf_Dyn;
typedef Elf64_Rel GElf_Rel;
typedef Elf64_Rela GElf_Rela;
typedef Elf64_Sym GElf_Sym;
/*
* Symbol versioning
*/
#if __LIBELF_SYMBOL_VERSIONS
typedef Elf64_Verdef GElf_Verdef;
typedef Elf64_Verneed GElf_Verneed;
typedef Elf64_Verdaux GElf_Verdaux;
typedef Elf64_Vernaux GElf_Vernaux;
#endif /* __LIBELF_SYMBOL_VERSIONS */
/*
* These types aren't implemented (yet)
*
typedef Elf64_Move GElf_Move;
typedef Elf64_Syminfo GElf_Syminfo;
*/
/*
* Generic macros
*/
#define GELF_ST_BIND ELF64_ST_BIND
#define GELF_ST_TYPE ELF64_ST_TYPE
#define GELF_ST_INFO ELF64_ST_INFO
#define GELF_R_TYPE ELF64_R_TYPE
#define GELF_R_SYM ELF64_R_SYM
#define GELF_R_INFO ELF64_R_INFO
/*
* Function declarations
*/
extern int gelf_getclass __P((Elf *__elf));
extern size_t gelf_fsize __P((Elf *__elf, Elf_Type __type, size_t __count, unsigned __ver));
extern Elf_Data *gelf_xlatetof __P((Elf *__elf, Elf_Data *__dst, const Elf_Data *__src, unsigned __encode));
extern Elf_Data *gelf_xlatetom __P((Elf *__elf, Elf_Data *__dst, const Elf_Data *__src, unsigned __encode));
extern GElf_Ehdr *gelf_getehdr __P((Elf *__elf, GElf_Ehdr *__dst));
extern int gelf_update_ehdr __P((Elf *__elf, GElf_Ehdr *__src));
extern unsigned long gelf_newehdr __P((Elf *__elf, int __elfclass));
extern GElf_Phdr *gelf_getphdr __P((Elf *__elf, int ndx, GElf_Phdr *__dst));
extern int gelf_update_phdr __P((Elf *__elf, int ndx, GElf_Phdr *__src));
extern unsigned long gelf_newphdr __P((Elf *__elf, size_t __phnum));
extern GElf_Shdr *gelf_getshdr __P((Elf_Scn *__scn, GElf_Shdr *__dst));
extern int gelf_update_shdr __P((Elf_Scn *__scn, GElf_Shdr *__src));
extern GElf_Dyn *gelf_getdyn __P((Elf_Data *__src, int __ndx, GElf_Dyn *__dst));
extern int gelf_update_dyn __P((Elf_Data *__dst, int __ndx, GElf_Dyn *__src));
extern GElf_Rel *gelf_getrel __P((Elf_Data *__src, int __ndx, GElf_Rel *__dst));
extern int gelf_update_rel __P((Elf_Data *__dst, int __ndx, GElf_Rel *__src));
extern GElf_Rela *gelf_getrela __P((Elf_Data *__src, int __ndx, GElf_Rela *__dst));
extern int gelf_update_rela __P((Elf_Data *__dst, int __ndx, GElf_Rela *__src));
extern GElf_Sym *gelf_getsym __P((Elf_Data *__src, int __ndx, GElf_Sym *__dst));
extern int gelf_update_sym __P((Elf_Data *__dst, int __ndx, GElf_Sym *__src));
extern long gelf_checksum __P((Elf *__elf));
/*
* These functions aren't implemented (yet)
*
extern GElf_Move *gelf_getmove __P((Elf_Data *__src, int __ndx, GElf_Move *__src));
extern int gelf_update_move __P((Elf_Data *__dst, int __ndx, GElf_Move *__src));
*
extern GElf_Syminfo* gelf_getsyminfo __P((Elf_Data *__src, int __ndx, GElf_Syminfo *__dst));
extern int gelf_update_syminfo __P((Elf_Data *__dst, int __ndx, GElf_Syminfo *__src));
*/
/*
* Extensions (not available in other versions of libelf)
*/
extern size_t gelf_msize __P((Elf *__elf, Elf_Type __type, size_t __count, unsigned __ver));
#endif /* __LIBELF64 */
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* _GELF_H */

View File

@ -0,0 +1,305 @@
/*
* libelf.h - public header file for libelf.
* Copyright (C) 1995 - 2008 Michael Riepe
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/* @(#) $Id: libelf.h,v 1.29 2009/07/07 17:57:43 michael Exp $ */
#ifndef _LIBELF_H
#define _LIBELF_H
#include <stddef.h> /* for size_t */
#include <sys/types.h>
#if __LIBELF_INTERNAL__
#include <sys_elf.h>
#else /* __LIBELF_INTERNAL__ */
#include <libelf/sys_elf.h>
#endif /* __LIBELF_INTERNAL__ */
#if defined __GNUC__ && !defined __cplusplus
#define DEPRECATED __attribute__((deprecated))
#else
#define DEPRECATED /* nothing */
#endif
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#ifndef __P
# if (__STDC__ + 0) || defined(__cplusplus) || defined(_WIN32)
# define __P(args) args
# else /* __STDC__ || defined(__cplusplus) */
# define __P(args) ()
# endif /* __STDC__ || defined(__cplusplus) */
#endif /* __P */
/*
* Commands
*/
typedef enum {
ELF_C_NULL = 0, /* must be first, 0 */
ELF_C_READ,
ELF_C_WRITE,
ELF_C_CLR,
ELF_C_SET,
ELF_C_FDDONE,
ELF_C_FDREAD,
ELF_C_RDWR,
ELF_C_NUM /* must be last */
} Elf_Cmd;
/*
* Flags
*/
#define ELF_F_DIRTY 0x1
#define ELF_F_LAYOUT 0x4
/*
* Allow sections to overlap when ELF_F_LAYOUT is in effect.
* Note that this flag ist NOT portable, and that it may render
* the output file unusable. Use with extreme caution!
*/
#define ELF_F_LAYOUT_OVERLAP 0x10000000
/*
* File types
*/
typedef enum {
ELF_K_NONE = 0, /* must be first, 0 */
ELF_K_AR,
ELF_K_COFF,
ELF_K_ELF,
ELF_K_NUM /* must be last */
} Elf_Kind;
/*
* Data types
*/
typedef enum {
ELF_T_BYTE = 0, /* must be first, 0 */
ELF_T_ADDR,
ELF_T_DYN,
ELF_T_EHDR,
ELF_T_HALF,
ELF_T_OFF,
ELF_T_PHDR,
ELF_T_RELA,
ELF_T_REL,
ELF_T_SHDR,
ELF_T_SWORD,
ELF_T_SYM,
ELF_T_WORD,
/*
* New stuff for 64-bit.
*
* Most implementations add ELF_T_SXWORD after ELF_T_SWORD
* which breaks binary compatibility with earlier versions.
* If this causes problems for you, contact me.
*/
ELF_T_SXWORD,
ELF_T_XWORD,
/*
* Symbol versioning. Sun broke binary compatibility (again!),
* but I won't.
*/
ELF_T_VDEF,
ELF_T_VNEED,
ELF_T_NUM /* must be last */
} Elf_Type;
/*
* Elf descriptor
*/
typedef struct Elf Elf;
/*
* Section descriptor
*/
typedef struct Elf_Scn Elf_Scn;
/*
* Archive member header
*/
typedef struct {
char* ar_name;
time_t ar_date;
long ar_uid;
long ar_gid;
unsigned long ar_mode;
off_t ar_size;
char* ar_rawname;
} Elf_Arhdr;
/*
* Archive symbol table
*/
typedef struct {
char* as_name;
size_t as_off;
unsigned long as_hash;
} Elf_Arsym;
/*
* Data descriptor
*/
typedef struct {
void* d_buf;
Elf_Type d_type;
size_t d_size;
off_t d_off;
size_t d_align;
unsigned d_version;
} Elf_Data;
/*
* Function declarations
*/
extern Elf *elf_begin __P((int __fd, Elf_Cmd __cmd, Elf *__ref));
extern Elf *elf_memory __P((char *__image, size_t __size));
extern int elf_cntl __P((Elf *__elf, Elf_Cmd __cmd));
extern int elf_end __P((Elf *__elf));
extern const char *elf_errmsg __P((int __err));
extern int elf_errno __P((void));
extern void elf_fill __P((int __fill));
extern unsigned elf_flagdata __P((Elf_Data *__data, Elf_Cmd __cmd,
unsigned __flags));
extern unsigned elf_flagehdr __P((Elf *__elf, Elf_Cmd __cmd,
unsigned __flags));
extern unsigned elf_flagelf __P((Elf *__elf, Elf_Cmd __cmd,
unsigned __flags));
extern unsigned elf_flagphdr __P((Elf *__elf, Elf_Cmd __cmd,
unsigned __flags));
extern unsigned elf_flagscn __P((Elf_Scn *__scn, Elf_Cmd __cmd,
unsigned __flags));
extern unsigned elf_flagshdr __P((Elf_Scn *__scn, Elf_Cmd __cmd,
unsigned __flags));
extern size_t elf32_fsize __P((Elf_Type __type, size_t __count,
unsigned __ver));
extern Elf_Arhdr *elf_getarhdr __P((Elf *__elf));
extern Elf_Arsym *elf_getarsym __P((Elf *__elf, size_t *__ptr));
extern off_t elf_getbase __P((Elf *__elf));
extern Elf_Data *elf_getdata __P((Elf_Scn *__scn, Elf_Data *__data));
extern Elf32_Ehdr *elf32_getehdr __P((Elf *__elf));
extern char *elf_getident __P((Elf *__elf, size_t *__ptr));
extern Elf32_Phdr *elf32_getphdr __P((Elf *__elf));
extern Elf_Scn *elf_getscn __P((Elf *__elf, size_t __index));
extern Elf32_Shdr *elf32_getshdr __P((Elf_Scn *__scn));
extern unsigned long elf_hash __P((const unsigned char *__name));
extern Elf_Kind elf_kind __P((Elf *__elf));
extern size_t elf_ndxscn __P((Elf_Scn *__scn));
extern Elf_Data *elf_newdata __P((Elf_Scn *__scn));
extern Elf32_Ehdr *elf32_newehdr __P((Elf *__elf));
extern Elf32_Phdr *elf32_newphdr __P((Elf *__elf, size_t __count));
extern Elf_Scn *elf_newscn __P((Elf *__elf));
extern Elf_Cmd elf_next __P((Elf *__elf));
extern Elf_Scn *elf_nextscn __P((Elf *__elf, Elf_Scn *__scn));
extern size_t elf_rand __P((Elf *__elf, size_t __offset));
extern Elf_Data *elf_rawdata __P((Elf_Scn *__scn, Elf_Data *__data));
extern char *elf_rawfile __P((Elf *__elf, size_t *__ptr));
extern char *elf_strptr __P((Elf *__elf, size_t __section, size_t __offset));
extern off_t elf_update __P((Elf *__elf, Elf_Cmd __cmd));
extern unsigned elf_version __P((unsigned __ver));
extern Elf_Data *elf32_xlatetof __P((Elf_Data *__dst, const Elf_Data *__src,
unsigned __encode));
extern Elf_Data *elf32_xlatetom __P((Elf_Data *__dst, const Elf_Data *__src,
unsigned __encode));
/*
* Additional functions found on Solaris
*/
extern long elf32_checksum __P((Elf *__elf));
#if __LIBELF64
/*
* 64-bit ELF functions
* Not available on all platforms
*/
extern Elf64_Ehdr *elf64_getehdr __P((Elf *__elf));
extern Elf64_Ehdr *elf64_newehdr __P((Elf *__elf));
extern Elf64_Phdr *elf64_getphdr __P((Elf *__elf));
extern Elf64_Phdr *elf64_newphdr __P((Elf *__elf, size_t __count));
extern Elf64_Shdr *elf64_getshdr __P((Elf_Scn *__scn));
extern size_t elf64_fsize __P((Elf_Type __type, size_t __count,
unsigned __ver));
extern Elf_Data *elf64_xlatetof __P((Elf_Data *__dst, const Elf_Data *__src,
unsigned __encode));
extern Elf_Data *elf64_xlatetom __P((Elf_Data *__dst, const Elf_Data *__src,
unsigned __encode));
/*
* Additional functions found on Solaris
*/
extern long elf64_checksum __P((Elf *__elf));
#endif /* __LIBELF64 */
/*
* ELF format extensions
*
* These functions return 0 on failure, 1 on success. Since other
* implementations of libelf may behave differently (there was quite
* some confusion about the correct values), they are now officially
* deprecated and should be replaced with the three new functions below.
*/
DEPRECATED extern int elf_getphnum __P((Elf *__elf, size_t *__resultp));
DEPRECATED extern int elf_getshnum __P((Elf *__elf, size_t *__resultp));
DEPRECATED extern int elf_getshstrndx __P((Elf *__elf, size_t *__resultp));
/*
* Replacement functions (return -1 on failure, 0 on success).
*/
extern int elf_getphdrnum __P((Elf *__elf, size_t *__resultp));
extern int elf_getshdrnum __P((Elf *__elf, size_t *__resultp));
extern int elf_getshdrstrndx __P((Elf *__elf, size_t *__resultp));
/*
* Convenience functions
*
* elfx_update_shstrndx is elf_getshstrndx's counterpart.
* It should be used to set the e_shstrndx member.
* There is no update function for e_shnum or e_phnum
* because libelf handles them internally.
*/
extern int elfx_update_shstrndx __P((Elf *__elf, size_t __index));
/*
* Experimental extensions:
*
* elfx_movscn() moves section `__scn' directly after section `__after'.
* elfx_remscn() removes section `__scn'. Both functions update
* the section indices; elfx_remscn() also adjusts the ELF header's
* e_shnum member. The application is responsible for updating other
* data (in particular, e_shstrndx and the section headers' sh_link and
* sh_info members).
*
* elfx_movscn() returns the new index of the moved section.
* elfx_remscn() returns the original index of the removed section.
* A return value of zero indicates an error.
*/
extern size_t elfx_movscn __P((Elf *__elf, Elf_Scn *__scn, Elf_Scn *__after));
extern size_t elfx_remscn __P((Elf *__elf, Elf_Scn *__scn));
/*
* elf_delscn() is obsolete. Please use elfx_remscn() instead.
*/
extern size_t elf_delscn __P((Elf *__elf, Elf_Scn *__scn));
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* _LIBELF_H */

View File

@ -0,0 +1,48 @@
/*
* nlist.h - public header file for nlist(3).
* Copyright (C) 1995 - 2006 Michael Riepe
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/* @(#) $Id: nlist.h,v 1.10 2008/05/23 08:15:35 michael Exp $ */
#ifndef _NLIST_H
#define _NLIST_H
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
struct nlist {
char* n_name;
long n_value;
short n_scnum;
unsigned short n_type;
char n_sclass;
char n_numaux;
};
#if (__STDC__ + 0) || defined(__cplusplus) || defined(_WIN32)
extern int nlist(const char *__filename, struct nlist *__nl);
#else /* __STDC__ || defined(__cplusplus) */
extern int nlist();
#endif /* __STDC__ || defined(__cplusplus) */
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* _NLIST_H */

View File

@ -0,0 +1,130 @@
/*
* lib/sys_elf.h.w32 - internal configuration file for W32 port
* Copyright (C) 2004 - 2006 Michael Riepe
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* @(#) $Id: sys_elf.h.w32,v 1.2 2006/09/07 15:55:42 michael Exp $
*/
/*
* DO NOT USE THIS IN APPLICATIONS - #include <libelf.h> INSTEAD!
*/
/* Define to `<elf.h>' or `<sys/elf.h>' if one of them is present */
#undef __LIBELF_HEADER_ELF_H
/* Define if Elf32_Dyn is declared in <link.h> */
#undef __LIBELF_NEED_LINK_H
/* Define if Elf32_Dyn is declared in <sys/link.h> */
#undef __LIBELF_NEED_SYS_LINK_H
/* Define if you want 64-bit support (and your system supports it) */
#define __LIBELF64 1
/* Define if you want 64-bit support, and are running IRIX */
#undef __LIBELF64_IRIX
/* Define if you want 64-bit support, and are running Linux */
#undef __LIBELF64_LINUX
/* Define if you want symbol versioning (and your system supports it) */
#define __LIBELF_SYMBOL_VERSIONS 1
/* Define to a 64-bit signed integer type if one exists */
#define __libelf_i64_t __int64
/* Define to a 64-bit unsigned integer type if one exists */
#define __libelf_u64_t unsigned __int64
/* Define to a 32-bit signed integer type if one exists */
#define __libelf_i32_t int
/* Define to a 32-bit unsigned integer type if one exists */
#define __libelf_u32_t unsigned int
/* Define to a 16-bit signed integer type if one exists */
#define __libelf_i16_t short int
/* Define to a 16-bit unsigned integer type if one exists */
#define __libelf_u16_t unsigned short int
/*
* Ok, now get the correct instance of elf.h...
*/
#ifdef __LIBELF_HEADER_ELF_H
# include __LIBELF_HEADER_ELF_H
#else /* __LIBELF_HEADER_ELF_H */
# if __LIBELF_INTERNAL__
# include <elf_repl.h>
# else /* __LIBELF_INTERNAL__ */
# include <libelf/elf_repl.h>
# endif /* __LIBELF_INTERNAL__ */
#endif /* __LIBELF_HEADER_ELF_H */
/*
* On some systems, <elf.h> is severely broken. Try to fix it.
*/
#ifdef __LIBELF_HEADER_ELF_H
# ifndef ELF32_FSZ_ADDR
# define ELF32_FSZ_ADDR 4
# define ELF32_FSZ_HALF 2
# define ELF32_FSZ_OFF 4
# define ELF32_FSZ_SWORD 4
# define ELF32_FSZ_WORD 4
# endif /* ELF32_FSZ_ADDR */
# ifndef STN_UNDEF
# define STN_UNDEF 0
# endif /* STN_UNDEF */
# if __LIBELF64
# ifndef ELF64_FSZ_ADDR
# define ELF64_FSZ_ADDR 8
# define ELF64_FSZ_HALF 2
# define ELF64_FSZ_OFF 8
# define ELF64_FSZ_SWORD 4
# define ELF64_FSZ_WORD 4
# define ELF64_FSZ_SXWORD 8
# define ELF64_FSZ_XWORD 8
# endif /* ELF64_FSZ_ADDR */
# ifndef ELF64_ST_BIND
# define ELF64_ST_BIND(i) ((i)>>4)
# define ELF64_ST_TYPE(i) ((i)&0xf)
# define ELF64_ST_INFO(b,t) (((b)<<4)+((t)&0xf))
# endif /* ELF64_ST_BIND */
# ifndef ELF64_R_SYM
# define ELF64_R_SYM(i) ((Elf64_Xword)(i)>>32)
# define ELF64_R_TYPE(i) ((i)&0xffffffffL)
# define ELF64_R_INFO(s,t) (((Elf64_Xword)(s)<<32)+((t)&0xffffffffL))
# endif /* ELF64_R_SYM */
# if __LIBELF64_LINUX
typedef __libelf_u64_t Elf64_Addr;
typedef __libelf_u16_t Elf64_Half;
typedef __libelf_u64_t Elf64_Off;
typedef __libelf_i32_t Elf64_Sword;
typedef __libelf_u32_t Elf64_Word;
typedef __libelf_i64_t Elf64_Sxword;
typedef __libelf_u64_t Elf64_Xword;
# endif /* __LIBELF64_LINUX */
# endif /* __LIBELF64 */
#endif /* __LIBELF_HEADER_ELF_H */

View File

@ -0,0 +1,241 @@
/*
* verdef.h - copy versioning information.
* Copyright (C) 2001 - 2006 Michael Riepe
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef lint
static const char verdef_h_rcsid[] = "@(#) $Id: verdef.h,v 1.13 2008/05/23 08:15:35 michael Exp $";
#endif /* lint */
#if VER_DEF_CURRENT != 1
#error libelf currently does not support VER_DEF_CURRENT != 1
#endif /* VER_DEF_CURRENT != 1 */
#if TOFILE
static void
__store_verdaux(verdaux_ftype *dst, const verdaux_mtype *src, unsigned enc) {
if (enc == ELFDATA2LSB) {
__store_u32L(dst->vda_name, src->vda_name);
__store_u32L(dst->vda_next, src->vda_next);
}
else {
__store_u32M(dst->vda_name, src->vda_name);
__store_u32M(dst->vda_next, src->vda_next);
}
}
static void
__store_verdef(verdef_ftype *dst, const verdef_mtype *src, unsigned enc) {
if (enc == ELFDATA2LSB) {
__store_u16L(dst->vd_version, src->vd_version);
__store_u16L(dst->vd_flags, src->vd_flags);
__store_u16L(dst->vd_ndx, src->vd_ndx);
__store_u16L(dst->vd_cnt, src->vd_cnt);
__store_u32L(dst->vd_hash, src->vd_hash);
__store_u32L(dst->vd_aux, src->vd_aux);
__store_u32L(dst->vd_next, src->vd_next);
}
else {
__store_u16M(dst->vd_version, src->vd_version);
__store_u16M(dst->vd_flags, src->vd_flags);
__store_u16M(dst->vd_ndx, src->vd_ndx);
__store_u16M(dst->vd_cnt, src->vd_cnt);
__store_u32M(dst->vd_hash, src->vd_hash);
__store_u32M(dst->vd_aux, src->vd_aux);
__store_u32M(dst->vd_next, src->vd_next);
}
}
typedef verdaux_mtype verdaux_stype;
typedef verdaux_ftype verdaux_dtype;
typedef verdef_mtype verdef_stype;
typedef verdef_ftype verdef_dtype;
typedef align_mtype verdef_atype;
#define copy_verdaux_srctotmp(d, s, e) (*(d) = *(s))
#define copy_verdaux_tmptodst(d, s, e) __store_verdaux((d), (s), (e))
#define copy_verdef_srctotmp(d, s, e) (*(d) = *(s))
#define copy_verdef_tmptodst(d, s, e) __store_verdef((d), (s), (e))
#define translator_suffix _tof
#else /* TOFILE */
static void
__load_verdaux(verdaux_mtype *dst, const verdaux_ftype *src, unsigned enc) {
if (enc == ELFDATA2LSB) {
dst->vda_name = __load_u32L(src->vda_name);
dst->vda_next = __load_u32L(src->vda_next);
}
else {
dst->vda_name = __load_u32M(src->vda_name);
dst->vda_next = __load_u32M(src->vda_next);
}
}
static void
__load_verdef(verdef_mtype *dst, const verdef_ftype *src, unsigned enc) {
if (enc == ELFDATA2LSB) {
dst->vd_version = __load_u16L(src->vd_version);
dst->vd_flags = __load_u16L(src->vd_flags);
dst->vd_ndx = __load_u16L(src->vd_ndx);
dst->vd_cnt = __load_u16L(src->vd_cnt);
dst->vd_hash = __load_u32L(src->vd_hash);
dst->vd_aux = __load_u32L(src->vd_aux);
dst->vd_next = __load_u32L(src->vd_next);
}
else {
dst->vd_version = __load_u16M(src->vd_version);
dst->vd_flags = __load_u16M(src->vd_flags);
dst->vd_ndx = __load_u16M(src->vd_ndx);
dst->vd_cnt = __load_u16M(src->vd_cnt);
dst->vd_hash = __load_u32M(src->vd_hash);
dst->vd_aux = __load_u32M(src->vd_aux);
dst->vd_next = __load_u32M(src->vd_next);
}
}
typedef verdaux_ftype verdaux_stype;
typedef verdaux_mtype verdaux_dtype;
typedef verdef_ftype verdef_stype;
typedef verdef_mtype verdef_dtype;
typedef align_ftype verdef_atype;
#define copy_verdaux_srctotmp(d, s, e) __load_verdaux((d), (s), (e))
#define copy_verdaux_tmptodst(d, s, e) (*(d) = *(s))
#define copy_verdef_srctotmp(d, s, e) __load_verdef((d), (s), (e))
#define copy_verdef_tmptodst(d, s, e) (*(d) = *(s))
#define translator_suffix _tom
#endif /* TOFILE */
#define cat3(a,b,c) a##b##c
#define xlt3(p,e,s) cat3(p,e,s)
#define xltprefix(x) xlt3(x,_,class_suffix)
#define translator(x,e) xlt3(xltprefix(_elf_##x),e,translator_suffix)
static size_t
xlt_verdef(unsigned char *dst, const unsigned char *src, size_t n, unsigned enc) {
size_t off;
if (sizeof(verdef_stype) != sizeof(verdef_dtype)
|| sizeof(verdaux_stype) != sizeof(verdaux_dtype)) {
/* never happens for ELF v1 and Verneed v1 */
seterr(ERROR_UNIMPLEMENTED);
return (size_t)-1;
}
/* size translation shortcut */
if (dst == NULL) {
return n;
}
if (src == NULL) {
seterr(ERROR_NULLBUF);
return (size_t)-1;
}
off = 0;
while (off + sizeof(verdef_stype) <= n) {
const verdef_stype *svd;
verdef_dtype *dvd;
verdef_mtype vd;
size_t acount;
size_t aoff;
/*
* check for proper alignment
*/
if (off % sizeof(verdef_atype)) {
seterr(ERROR_VERDEF_FORMAT);
return (size_t)-1;
}
/*
* copy and check src
*/
svd = (verdef_stype*)(src + off);
dvd = (verdef_dtype*)(dst + off);
copy_verdef_srctotmp(&vd, svd, enc);
if (vd.vd_version < 1
|| vd.vd_version > VER_DEF_CURRENT) {
seterr(ERROR_VERDEF_VERSION);
return (size_t)-1;
}
if (vd.vd_cnt < 1
|| vd.vd_aux == 0) {
seterr(ERROR_VERDEF_FORMAT);
return (size_t)-1;
}
copy_verdef_tmptodst(dvd, &vd, enc);
/*
* copy aux array
*/
aoff = off + vd.vd_aux;
for (acount = 0; acount < vd.vd_cnt; acount++) {
const verdaux_stype *svda;
verdaux_dtype *dvda;
verdaux_mtype vda;
/*
* are we still inside the buffer limits?
*/
if (aoff + sizeof(verdaux_stype) > n) {
break;
}
/*
* check for proper alignment
*/
if (aoff % sizeof(verdef_atype)) {
seterr(ERROR_VERDEF_FORMAT);
return (size_t)-1;
}
/*
* copy and check src
*/
svda = (verdaux_stype*)(src + aoff);
dvda = (verdaux_dtype*)(dst + aoff);
copy_verdaux_srctotmp(&vda, svda, enc);
copy_verdaux_tmptodst(dvda, &vda, enc);
/*
* advance to next verdaux
*/
if (vda.vda_next == 0) {
/* end of list */
break;
}
aoff += vda.vda_next;
}
/*
* advance to next verdef
*/
if (vd.vd_next == 0) {
/* end of list */
break;
}
off += vd.vd_next;
}
return n;
}
size_t
translator(verdef,L11)(unsigned char *dst, const unsigned char *src, size_t n) {
return xlt_verdef(dst, src, n, ELFDATA2LSB);
}
size_t
translator(verdef,M11)(unsigned char *dst, const unsigned char *src, size_t n) {
return xlt_verdef(dst, src, n, ELFDATA2MSB);
}

View File

@ -0,0 +1,245 @@
/*
* verneed.h - copy versioning information.
* Copyright (C) 2001 - 2006 Michael Riepe
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef lint
static const char verneed_h_rcsid[] = "@(#) $Id: verneed.h,v 1.13 2008/05/23 08:15:35 michael Exp $";
#endif /* lint */
#if VER_NEED_CURRENT != 1
#error libelf currently does not support VER_NEED_CURRENT != 1
#endif /* VER_NEED_CURRENT != 1 */
#if TOFILE
static void
__store_vernaux(vernaux_ftype *dst, const vernaux_mtype *src, unsigned enc) {
if (enc == ELFDATA2LSB) {
__store_u32L(dst->vna_hash, src->vna_hash);
__store_u16L(dst->vna_flags, src->vna_flags);
__store_u16L(dst->vna_other, src->vna_other);
__store_u32L(dst->vna_name, src->vna_name);
__store_u32L(dst->vna_next, src->vna_next);
}
else {
__store_u32M(dst->vna_hash, src->vna_hash);
__store_u16M(dst->vna_flags, src->vna_flags);
__store_u16M(dst->vna_other, src->vna_other);
__store_u32M(dst->vna_name, src->vna_name);
__store_u32M(dst->vna_next, src->vna_next);
}
}
static void
__store_verneed(verneed_ftype *dst, const verneed_mtype *src, unsigned enc) {
if (enc == ELFDATA2LSB) {
__store_u16L(dst->vn_version, src->vn_version);
__store_u16L(dst->vn_cnt, src->vn_cnt);
__store_u32L(dst->vn_file, src->vn_file);
__store_u32L(dst->vn_aux, src->vn_aux);
__store_u32L(dst->vn_next, src->vn_next);
}
else {
__store_u16M(dst->vn_version, src->vn_version);
__store_u16M(dst->vn_cnt, src->vn_cnt);
__store_u32M(dst->vn_file, src->vn_file);
__store_u32M(dst->vn_aux, src->vn_aux);
__store_u32M(dst->vn_next, src->vn_next);
}
}
typedef vernaux_mtype vernaux_stype;
typedef vernaux_ftype vernaux_dtype;
typedef verneed_mtype verneed_stype;
typedef verneed_ftype verneed_dtype;
typedef align_mtype verneed_atype;
#define copy_vernaux_srctotmp(d, s, e) (*(d) = *(s))
#define copy_vernaux_tmptodst(d, s, e) __store_vernaux((d), (s), (e))
#define copy_verneed_srctotmp(d, s, e) (*(d) = *(s))
#define copy_verneed_tmptodst(d, s, e) __store_verneed((d), (s), (e))
#define translator_suffix _tof
#else /* TOFILE */
static void
__load_vernaux(vernaux_mtype *dst, const vernaux_ftype *src, unsigned enc) {
if (enc == ELFDATA2LSB) {
dst->vna_hash = __load_u32L(src->vna_hash);
dst->vna_flags = __load_u16L(src->vna_flags);
dst->vna_other = __load_u16L(src->vna_other);
dst->vna_name = __load_u32L(src->vna_name);
dst->vna_next = __load_u32L(src->vna_next);
}
else {
dst->vna_hash = __load_u32M(src->vna_hash);
dst->vna_flags = __load_u16M(src->vna_flags);
dst->vna_other = __load_u16M(src->vna_other);
dst->vna_name = __load_u32M(src->vna_name);
dst->vna_next = __load_u32M(src->vna_next);
}
}
static void
__load_verneed(verneed_mtype *dst, const verneed_ftype *src, unsigned enc) {
if (enc == ELFDATA2LSB) {
dst->vn_version = __load_u16L(src->vn_version);
dst->vn_cnt = __load_u16L(src->vn_cnt);
dst->vn_file = __load_u32L(src->vn_file);
dst->vn_aux = __load_u32L(src->vn_aux);
dst->vn_next = __load_u32L(src->vn_next);
}
else {
dst->vn_version = __load_u16M(src->vn_version);
dst->vn_cnt = __load_u16M(src->vn_cnt);
dst->vn_file = __load_u32M(src->vn_file);
dst->vn_aux = __load_u32M(src->vn_aux);
dst->vn_next = __load_u32M(src->vn_next);
}
}
typedef vernaux_ftype vernaux_stype;
typedef vernaux_mtype vernaux_dtype;
typedef verneed_ftype verneed_stype;
typedef verneed_mtype verneed_dtype;
typedef align_ftype verneed_atype;
#define copy_vernaux_srctotmp(d, s, e) __load_vernaux((d), (s), (e))
#define copy_vernaux_tmptodst(d, s, e) (*(d) = *(s))
#define copy_verneed_srctotmp(d, s, e) __load_verneed((d), (s), (e))
#define copy_verneed_tmptodst(d, s, e) (*(d) = *(s))
#define translator_suffix _tom
#endif /* TOFILE */
#define cat3(a,b,c) a##b##c
#define xlt3(p,e,s) cat3(p,e,s)
#define xltprefix(x) xlt3(x,_,class_suffix)
#define translator(x,e) xlt3(xltprefix(_elf_##x),e,translator_suffix)
static size_t
xlt_verneed(unsigned char *dst, const unsigned char *src, size_t n, unsigned enc) {
size_t off;
if (sizeof(verneed_stype) != sizeof(verneed_dtype)
|| sizeof(vernaux_stype) != sizeof(vernaux_dtype)) {
/* never happens for ELF v1 and Verneed v1 */
seterr(ERROR_UNIMPLEMENTED);
return (size_t)-1;
}
/* size translation shortcut */
if (dst == NULL) {
return n;
}
if (src == NULL) {
seterr(ERROR_NULLBUF);
return (size_t)-1;
}
off = 0;
while (off + sizeof(verneed_stype) <= n) {
const verneed_stype *svn;
verneed_dtype *dvn;
verneed_mtype vn;
size_t acount;
size_t aoff;
/*
* check for proper alignment
*/
if (off % sizeof(verneed_atype)) {
seterr(ERROR_VERNEED_FORMAT);
return (size_t)-1;
}
/*
* copy and check src
*/
svn = (verneed_stype*)(src + off);
dvn = (verneed_dtype*)(dst + off);
copy_verneed_srctotmp(&vn, svn, enc);
if (vn.vn_version < 1
|| vn.vn_version > VER_NEED_CURRENT) {
seterr(ERROR_VERNEED_VERSION);
return (size_t)-1;
}
if (vn.vn_cnt < 1
|| vn.vn_aux == 0) {
seterr(ERROR_VERNEED_FORMAT);
return (size_t)-1;
}
copy_verneed_tmptodst(dvn, &vn, enc);
/*
* copy aux array
*/
aoff = off + vn.vn_aux;
for (acount = 0; acount < vn.vn_cnt; acount++) {
const vernaux_stype *svna;
vernaux_dtype *dvna;
vernaux_mtype vna;
/*
* are we still inside the buffer limits?
*/
if (aoff + sizeof(vernaux_stype) > n) {
break;
}
/*
* check for proper alignment
*/
if (aoff % sizeof(verneed_atype)) {
seterr(ERROR_VERNEED_FORMAT);
return (size_t)-1;
}
/*
* copy and check src
*/
svna = (vernaux_stype*)(src + aoff);
dvna = (vernaux_dtype*)(dst + aoff);
copy_vernaux_srctotmp(&vna, svna, enc);
copy_vernaux_tmptodst(dvna, &vna, enc);
/*
* advance to next vernaux
*/
if (vna.vna_next == 0) {
/* end of list */
break;
}
aoff += vna.vna_next;
}
/*
* advance to next verneed
*/
if (vn.vn_next == 0) {
/* end of list */
break;
}
off += vn.vn_next;
}
return n;
}
size_t
translator(verneed,L11)(unsigned char *dst, const unsigned char *src, size_t n) {
return xlt_verneed(dst, src, n, ELFDATA2LSB);
}
size_t
translator(verneed,M11)(unsigned char *dst, const unsigned char *src, size_t n) {
return xlt_verneed(dst, src, n, ELFDATA2MSB);
}

Binary file not shown.

View File

@ -106,6 +106,102 @@
#include "aviout.h"
#include "soundView.h"
//#include <libelf/libelf.h>
//#include <libelf/gelf.h>
//#include <sys/types.h>
//#include <sys/stat.h>
//#include <fcntl.h>
//#include <io.h>
//void testelf()
//{
// //http://webcache.googleusercontent.com/search?q=cache:XeQF6AILcrkJ:chris.rohlf.googlepages.com/libelf-howto.c+libelf+example&cd=2&hl=en&ct=clnk&gl=us
//Elf32_Ehdr *elf_header; /* ELF header */
//Elf *elf; /* Our Elf pointer for libelf */
//Elf_Scn *scn; /* Section Descriptor */
//Elf_Data *edata; /* Data Descriptor */
//GElf_Sym sym; /* Symbol */
//GElf_Shdr shdr; /* Section Header */
//int fd; // File Descriptor
//const char* file = "d:\\devkitPro\\examples\\nds\\hello_world\\hello_world.elf";
//struct stat elf_stats; // fstat struct
//char *base_ptr; // ptr to our object in memory
//#define ERR -1
// if((fd = open(file, O_RDWR)) == ERR)
// {
// printf("couldnt open %s\n", file);
// return;
// }
// if((fstat(fd, &elf_stats)))
// {
// printf("could not fstat %s\n", file);
// close(fd);
// return ;
// }
// if((base_ptr = (char *) malloc(elf_stats.st_size)) == NULL)
// {
// printf("could not malloc\n");
// close(fd);
// return ;
// }
// if((read(fd, base_ptr, elf_stats.st_size)) < elf_stats.st_size)
// {
// printf("could not read %s\n", file);
// free(base_ptr);
// close(fd);
// return ;
// }
// /* Check libelf version first */
// if(elf_version(EV_CURRENT) == EV_NONE)
// {
// printf("WARNING Elf Library is out of date!\n");
// }
//elf_header = (Elf32_Ehdr *) base_ptr; // point elf_header at our object in memory
//elf = elf_begin(fd, ELF_C_READ, NULL); // Initialize 'elf' pointer to our file descriptor
///* Iterate through section headers */
//while((scn = elf_nextscn(elf, scn)) != 0)
//{
// gelf_getshdr(scn, &shdr);
// // print the section header type
// printf("Type: ");
// switch(shdr.sh_type)
// {
// case SHT_NULL: printf( "SHT_NULL\t"); break;
// case SHT_PROGBITS: printf( "SHT_PROGBITS"); break;
// case SHT_SYMTAB: printf( "SHT_SYMTAB"); break;
// case SHT_STRTAB: printf( "SHT_STRTAB"); break;
// case SHT_RELA: printf( "SHT_RELA\t"); break;
// case SHT_HASH: printf( "SHT_HASH\t"); break;
// case SHT_DYNAMIC: printf( "SHT_DYNAMIC"); break;
// case SHT_NOTE: printf( "SHT_NOTE\t"); break;
// case SHT_NOBITS: printf( "SHT_NOBITS"); break;
// case SHT_REL: printf( "SHT_REL\t"); break;
// case SHT_SHLIB: printf( "SHT_SHLIB"); break;
// case SHT_DYNSYM: printf( "SHT_DYNSYM"); break;
// case SHT_INIT_ARRAY: printf( "SHT_INIT_ARRAY"); break;
// case SHT_FINI_ARRAY: printf( "SHT_FINI_ARRAY"); break;
// case SHT_PREINIT_ARRAY: printf( "SHT_PREINIT_ARRAY"); break;
// case SHT_GROUP: printf( "SHT_GROUP"); break;
// case SHT_SYMTAB_SHNDX: printf( "SHT_SYMTAB_SHNDX"); break;
// case SHT_NUM: printf( "SHT_NUM\t"); break;
// case SHT_LOOS: printf( "SHT_LOOS\t"); break;
// case SHT_GNU_verdef: printf( "SHT_GNU_verdef"); break;
// case SHT_GNU_verneed: printf( "SHT_VERNEED"); break;
// case SHT_GNU_versym: printf( "SHT_GNU_versym"); break;
// default: printf( "(none) "); break;
// }
// // print the section header flags
// printf("\t(");
// if(shdr.sh_flags & SHF_WRITE) { printf("W"); }
// if(shdr.sh_flags & SHF_ALLOC) { printf("A"); }
// if(shdr.sh_flags & SHF_EXECINSTR) { printf("X"); }
// if(shdr.sh_flags & SHF_STRINGS) { printf("S"); }
// printf(")\t");
// // the shdr name is in a string table, libelf uses elf_strptr() to find it
// // using the e_shstrndx value from the elf_header
// printf("%s\n", elf_strptr(elf, elf_header->e_shstrndx, shdr.sh_name));
//}
//}
using namespace std;
#ifdef EXPERIMENTAL_WIFI_COMM
@ -2817,6 +2913,8 @@ int WINAPI WinMain (HINSTANCE hThisInstance,
int nFunsterStil)
{
// testelf();
TIMECAPS tc;
if (timeGetDevCaps(&tc, sizeof(TIMECAPS))== TIMERR_NOERROR)
{