1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 20:51:52 +01:00

[MachO] Pad section data to pointer size bytes

https://reviews.llvm.org/D74273

Pad macho section data to pointer size bytes, so that relocation
table and symbol table following section data will be pointer size
aligned.

Patch by pguo.
This commit is contained in:
Aditya Nandakumar 2020-02-11 14:51:49 -08:00
parent 973208ded7
commit d71f33d6b3
3 changed files with 5 additions and 5 deletions

View File

@ -831,11 +831,11 @@ uint64_t MachObjectWriter::writeObject(MCAssembler &Asm,
SectionDataFileSize = std::max(SectionDataFileSize, Address + FileSize);
}
// The section data is padded to 4 bytes.
// The section data is padded to pointer size bytes.
//
// FIXME: Is this machine dependent?
unsigned SectionDataPadding =
offsetToAlignment(SectionDataFileSize, Align(4));
offsetToAlignment(SectionDataFileSize, is64Bit() ? Align(8) : Align(4));
SectionDataFileSize += SectionDataPadding;
// Write the prolog, starting with the header and load command...

View File

@ -147,7 +147,7 @@ L3:
// CHECK: Size: 0x5E
// CHECK: Offset: 384
// CHECK: Alignment: 0
// CHECK: RelocationOffset: 0x26C
// CHECK: RelocationOffset: 0x270
// CHECK: RelocationCount: 12
// CHECK: Type: Regular (0x0)
// CHECK: Attributes [ (0x800004)
@ -174,7 +174,7 @@ L3:
// CHECK: Size: 0x8E
// CHECK: Offset: 478
// CHECK: Alignment: 0
// CHECK: RelocationOffset: 0x2CC
// CHECK: RelocationOffset: 0x2D0
// CHECK: RelocationCount: 16
// CHECK: Type: Regular (0x0)
// CHECK: Attributes [ (0x4)

View File

@ -298,7 +298,7 @@ Lt0_x = Lt0_a - Lt0_b
// CHECK-X86_64: Size: 0x38
// CHECK-X86_64: Offset: 385
// CHECK-X86_64: Alignment: 0
// CHECK-X86_64: RelocationOffset: 0x1BC
// CHECK-X86_64: RelocationOffset: 0x1C0
// CHECK-X86_64: RelocationCount: 9
// CHECK-X86_64: Type: Regular (0x0)
// CHECK-X86_64: Attributes [ (0x0)