From ed600e64f34ef88c1471799d7be580dee1d4b753 Mon Sep 17 00:00:00 2001 From: Serge Lamikhov-Center Date: Sun, 21 Apr 2013 16:27:43 +0300 Subject: [PATCH] Ticket #10: Fix section type SHT_NOBITS file_size calculation --- ELFIO.sln | 10 ++- elf_examples/ls.readelf | 2 +- elfio/elfio.hpp | 2 +- examples/writer/writer.vcxproj | 85 ++++++++++++++++++++++++++ examples/writer/writer.vcxproj.filters | 22 +++++++ examples/writer/writer.vcxproj.user | 7 +++ 6 files changed, 124 insertions(+), 4 deletions(-) create mode 100644 examples/writer/writer.vcxproj create mode 100644 examples/writer/writer.vcxproj.filters create mode 100644 examples/writer/writer.vcxproj.user diff --git a/ELFIO.sln b/ELFIO.sln index e6bc855..ebad862 100644 --- a/ELFIO.sln +++ b/ELFIO.sln @@ -1,10 +1,12 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 11 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ELFDump", "examples\ELFDump\ELFDump.vcxproj", "{CBAA735F-E237-4976-909F-2349920ED871}" +# Visual Studio 2012 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ELFDump", "examples\elfdump\ELFDump.vcxproj", "{CBAA735F-E237-4976-909F-2349920ED871}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ELFIOTest", "ELFIOTest\ELFIOTest.vcxproj", "{FC8A3379-B8AA-4C32-804F-F8C43AFBC2A1}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "writer", "examples\writer\writer.vcxproj", "{4E5A96DB-F6E9-4EEE-90BE-67B722DA8C84}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 @@ -19,6 +21,10 @@ Global {FC8A3379-B8AA-4C32-804F-F8C43AFBC2A1}.Debug|Win32.Build.0 = Debug|Win32 {FC8A3379-B8AA-4C32-804F-F8C43AFBC2A1}.Release|Win32.ActiveCfg = Release|Win32 {FC8A3379-B8AA-4C32-804F-F8C43AFBC2A1}.Release|Win32.Build.0 = Release|Win32 + {4E5A96DB-F6E9-4EEE-90BE-67B722DA8C84}.Debug|Win32.ActiveCfg = Debug|Win32 + {4E5A96DB-F6E9-4EEE-90BE-67B722DA8C84}.Debug|Win32.Build.0 = Debug|Win32 + {4E5A96DB-F6E9-4EEE-90BE-67B722DA8C84}.Release|Win32.ActiveCfg = Release|Win32 + {4E5A96DB-F6E9-4EEE-90BE-67B722DA8C84}.Release|Win32.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/elf_examples/ls.readelf b/elf_examples/ls.readelf index a6e1b1a..f4380d1 100644 --- a/elf_examples/ls.readelf +++ b/elf_examples/ls.readelf @@ -264,7 +264,7 @@ Relocation section '.rela.plt' at offset 0x15f8 contains 105 entries: 000000619338 006800000007 R_X86_64_JUMP_SLO 0000000000000000 __ctype_b_loc + 0 000000619340 006900000007 R_X86_64_JUMP_SLO 0000000000000000 __sprintf_chk + 0 -The decoding of unwind sections for machine type Advanced Micro Devices X86-64 is not currently supported. +There are no unwind sections in this file. Symbol table '.dynsym' contains 121 entries: Num: Value Size Type Bind Vis Ndx Name diff --git a/elfio/elfio.hpp b/elfio/elfio.hpp index 2a42a66..cb9180f 100644 --- a/elfio/elfio.hpp +++ b/elfio/elfio.hpp @@ -469,7 +469,7 @@ class elfio current_file_pos += segment_align - current_file_pos % segment_align; } - Elf_Xword current_data_pos = current_file_pos; + Elf_Xword current_data_pos = current_file_pos; Elf_Xword add_to_memory_size = 0; // Write segment's data for ( unsigned int j = 0; j get_sections_num(); ++j ) { diff --git a/examples/writer/writer.vcxproj b/examples/writer/writer.vcxproj new file mode 100644 index 0000000..94a6381 --- /dev/null +++ b/examples/writer/writer.vcxproj @@ -0,0 +1,85 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {4E5A96DB-F6E9-4EEE-90BE-67B722DA8C84} + Win32Proj + writer + + + + Application + true + v110 + Unicode + + + Application + false + v110 + true + Unicode + + + + + + + + + + + + + true + + + false + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + $(SolutionDir) + + + Console + true + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + + + Console + true + true + true + + + + + + + + + \ No newline at end of file diff --git a/examples/writer/writer.vcxproj.filters b/examples/writer/writer.vcxproj.filters new file mode 100644 index 0000000..c3d5827 --- /dev/null +++ b/examples/writer/writer.vcxproj.filters @@ -0,0 +1,22 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Source Files + + + \ No newline at end of file diff --git a/examples/writer/writer.vcxproj.user b/examples/writer/writer.vcxproj.user new file mode 100644 index 0000000..28f7c38 --- /dev/null +++ b/examples/writer/writer.vcxproj.user @@ -0,0 +1,7 @@ + + + + $(OutDir) + WindowsLocalDebugger + + \ No newline at end of file