[lld] r260102 - Fix the alignment of PT_PHDR.
Rafael Espindola via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 8 07:33:53 PST 2016
Author: rafael
Date: Mon Feb 8 09:33:53 2016
New Revision: 260102
URL: http://llvm.org/viewvc/llvm-project?rev=260102&view=rev
Log:
Fix the alignment of PT_PHDR.
We were claiming it was aligned to 8 bytes even on 32 bit files, which
is not the case.
Modified:
lld/trunk/ELF/Writer.cpp
lld/trunk/test/ELF/basic-mips.s
lld/trunk/test/ELF/basic-ppc.s
lld/trunk/test/ELF/basic32.s
Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=260102&r1=260101&r2=260102&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Mon Feb 8 09:33:53 2016
@@ -1187,7 +1187,8 @@ template <class ELFT> void Writer<ELFT>:
size_t PhdrSize = sizeof(Elf_Phdr) * Phdrs.size();
// The first phdr entry is PT_PHDR which describes the program header itself.
- setPhdr(&Phdrs[0], PT_PHDR, PF_R, FileOff, VA, PhdrSize, /*Align=*/8);
+ setPhdr(&Phdrs[0], PT_PHDR, PF_R, FileOff, VA, PhdrSize,
+ /*Align=*/sizeof(uintX_t));
FileOff += PhdrSize;
VA += PhdrSize;
Modified: lld/trunk/test/ELF/basic-mips.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/basic-mips.s?rev=260102&r1=260101&r2=260102&view=diff
==============================================================================
--- lld/trunk/test/ELF/basic-mips.s (original)
+++ lld/trunk/test/ELF/basic-mips.s Mon Feb 8 09:33:53 2016
@@ -216,7 +216,7 @@ __start:
# CHECK-NEXT: Flags [ (0x4)
# CHECK-NEXT: PF_R (0x4)
# CHECK-NEXT: ]
-# CHECK-NEXT: Alignment: 8
+# CHECK-NEXT: Alignment: 4
# CHECK-NEXT: }
# CHECK-NEXT: ProgramHeader {
# CHECK-NEXT: Type: PT_LOAD (0x1)
Modified: lld/trunk/test/ELF/basic-ppc.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/basic-ppc.s?rev=260102&r1=260101&r2=260102&view=diff
==============================================================================
--- lld/trunk/test/ELF/basic-ppc.s (original)
+++ lld/trunk/test/ELF/basic-ppc.s Mon Feb 8 09:33:53 2016
@@ -215,7 +215,7 @@
// CHECK-NEXT: Flags [ (0x4)
// CHECK-NEXT: PF_R (0x4)
// CHECK-NEXT: ]
-// CHECK-NEXT: Alignment: 8
+// CHECK-NEXT: Alignment: 4
// CHECK-NEXT: }
// CHECK-NEXT: ProgramHeader {
// CHECK-NEXT: Type: PT_LOAD (0x1)
Modified: lld/trunk/test/ELF/basic32.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/basic32.s?rev=260102&r1=260101&r2=260102&view=diff
==============================================================================
--- lld/trunk/test/ELF/basic32.s (original)
+++ lld/trunk/test/ELF/basic32.s Mon Feb 8 09:33:53 2016
@@ -120,7 +120,7 @@ _start:
# CHECK-NEXT: Flags [ (0x4)
# CHECK-NEXT: PF_R (0x4)
# CHECK-NEXT: ]
-# CHECK-NEXT: Alignment: 8
+# CHECK-NEXT: Alignment: 4
# CHECK-NEXT: }
# CHECK-NEXT: ProgramHeader {
# CHECK-NEXT: Type: PT_LOAD (0x1)
More information about the llvm-commits
mailing list