Fix the alignment of the section headers.

Thanks a lot to Rui for noticing it.

llvm-svn: 244711
This commit is contained in:
Rafael Espindola 2015-08-12 01:45:28 +00:00
parent 4ec3e13c91
commit 91009b3856
5 changed files with 6 additions and 4 deletions

View File

@ -185,6 +185,8 @@ template <class ELFT> void Writer<ELFT>::assignAddresses() {
FileOff += StrTabBuilder.data().size();
NumSections++;
FileOff += OffsetToAlignment(FileOff, ELFT::Is64Bits ? 8 : 4);
// Add space for section headers.
SectionHeaderOff = FileOff;
FileOff += NumSections * sizeof(Elf_Shdr_Impl<ELFT>);

View File

@ -25,7 +25,7 @@ _start:
# CHECK-NEXT: Version: 1
# CHECK-NEXT: Entry: 0x401000
# CHECK-NEXT: ProgramHeaderOffset: 0x40
# CHECK-NEXT: SectionHeaderOffset: 0x102A
# CHECK-NEXT: SectionHeaderOffset: 0x1030
# CHECK-NEXT: Flags [ (0x0)
# CHECK-NEXT: ]
# CHECK-NEXT: HeaderSize: 64

View File

@ -25,7 +25,7 @@ _start:
# CHECK-NEXT: Version: 1
# CHECK-NEXT: Entry: 0x401000
# CHECK-NEXT: ProgramHeaderOffset: 0x34
# CHECK-NEXT: SectionHeaderOffset: 0x102A
# CHECK-NEXT: SectionHeaderOffset: 0x102C
# CHECK-NEXT: Flags [ (0x0)
# CHECK-NEXT: ]
# CHECK-NEXT: HeaderSize: 52

View File

@ -25,7 +25,7 @@ _start:
# CHECK-NEXT: Version: 1
# CHECK-NEXT: Entry: 0x401000
# CHECK-NEXT: ProgramHeaderOffset: 0x34
# CHECK-NEXT: SectionHeaderOffset: 0x102A
# CHECK-NEXT: SectionHeaderOffset: 0x102C
# CHECK-NEXT: Flags [ (0x0)
# CHECK-NEXT: ]
# CHECK-NEXT: HeaderSize: 52

View File

@ -30,7 +30,7 @@ _start:
# CHECK-NEXT: Version: 1
# CHECK-NEXT: Entry: 0x401000
# CHECK-NEXT: ProgramHeaderOffset: 0x40
# CHECK-NEXT: SectionHeaderOffset: 0x1047
# CHECK-NEXT: SectionHeaderOffset: 0x1048
# CHECK-NEXT: Flags [ (0x0)
# CHECK-NEXT: ]
# CHECK-NEXT: HeaderSize: 64