diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp index 2c362e7f4287..71d774bb0e22 100644 --- a/lld/ELF/Writer.cpp +++ b/lld/ELF/Writer.cpp @@ -1187,7 +1187,8 @@ template void Writer::assignAddresses() { 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; diff --git a/lld/test/ELF/basic-mips.s b/lld/test/ELF/basic-mips.s index 7b2ef564f1ce..75c44ef3da32 100644 --- a/lld/test/ELF/basic-mips.s +++ b/lld/test/ELF/basic-mips.s @@ -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) diff --git a/lld/test/ELF/basic-ppc.s b/lld/test/ELF/basic-ppc.s index 90acd8d8ddac..1dc58227eaff 100644 --- a/lld/test/ELF/basic-ppc.s +++ b/lld/test/ELF/basic-ppc.s @@ -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) diff --git a/lld/test/ELF/basic32.s b/lld/test/ELF/basic32.s index f4f9c410a048..0ec73eee9665 100644 --- a/lld/test/ELF/basic32.s +++ b/lld/test/ELF/basic32.s @@ -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)