mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-02-09 13:55:22 +00:00
MC/Mach-O: PCrel relocations weren't using the right base address, they are
relative to the fragment address, not its offset. This was masked by the text section normally being at address 0. llvm-svn: 98420
This commit is contained in:
parent
33c92a1a88
commit
e8b67adb94
@ -1024,7 +1024,7 @@ bool MCAssembler::EvaluateFixup(const MCAsmLayout &Layout, MCAsmFixup &Fixup,
|
||||
}
|
||||
|
||||
if (IsPCRel)
|
||||
Value -= DF->getOffset() + Fixup.Offset;
|
||||
Value -= DF->getAddress() + Fixup.Offset;
|
||||
|
||||
return IsResolved;
|
||||
}
|
||||
|
14
test/MC/MachO/reloc-pcrel-offset.s
Normal file
14
test/MC/MachO/reloc-pcrel-offset.s
Normal file
@ -0,0 +1,14 @@
|
||||
// RUN: llvm-mc -n -triple i386-apple-darwin9 %s -filetype=obj -o - | macho-dump --dump-section-data | FileCheck %s
|
||||
|
||||
// CHECK: # Relocation 0
|
||||
// CHECK: (('word-0', 0x1),
|
||||
// CHECK: ('word-1', 0x5000002)),
|
||||
// CHECK-NEXT: ])
|
||||
// CHECK: ('_section_data', '\xe8\xfb\xff\xff\xff')
|
||||
|
||||
.data
|
||||
.long 0
|
||||
|
||||
.text
|
||||
_a:
|
||||
call _a
|
Loading…
x
Reference in New Issue
Block a user