diff --git a/llvm/lib/MC/MachObjectWriter.cpp b/llvm/lib/MC/MachObjectWriter.cpp --- a/llvm/lib/MC/MachObjectWriter.cpp +++ b/llvm/lib/MC/MachObjectWriter.cpp @@ -831,11 +831,11 @@ 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... diff --git a/llvm/test/MC/MachO/darwin-x86_64-diff-relocs.s b/llvm/test/MC/MachO/darwin-x86_64-diff-relocs.s --- a/llvm/test/MC/MachO/darwin-x86_64-diff-relocs.s +++ b/llvm/test/MC/MachO/darwin-x86_64-diff-relocs.s @@ -147,7 +147,7 @@ // 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 @@ // 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) diff --git a/llvm/test/MC/MachO/variable-exprs.s b/llvm/test/MC/MachO/variable-exprs.s --- a/llvm/test/MC/MachO/variable-exprs.s +++ b/llvm/test/MC/MachO/variable-exprs.s @@ -298,7 +298,7 @@ // 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)