[mach-o] use the addend in GOT-based relocations.

These are used to reference typeinfo data in the exception table section, for
example.

llvm-svn: 220916
This commit is contained in:
Tim Northover 2014-10-30 18:01:07 +00:00
parent c572e92c76
commit 516e983dd4
2 changed files with 5 additions and 3 deletions

View File

@ -364,7 +364,7 @@ ArchHandler_x86_64::getReferenceInfo(const Relocation &reloc,
case ripRel32Got:
if (E ec = atomFromSymbolIndex(reloc.symbol, target))
return ec;
*addend = 0;
*addend = *(little32_t *)fixupContent;
return std::error_code();
case pointer64:
if (E ec = atomFromSymbolIndex(reloc.symbol, target))

View File

@ -35,8 +35,8 @@ sections:
attributes: [ S_ATTR_PURE_INSTRUCTIONS, S_ATTR_SOME_INSTRUCTIONS ]
address: 0x0000000000000000
content: [ 0xE8, 0x00, 0x00, 0x00, 0x00, 0xE8, 0x04, 0x00,
0x00, 0x00, 0x48, 0x8B, 0x05, 0x00, 0x00, 0x00,
0x00, 0xFF, 0x35, 0x00, 0x00, 0x00, 0x00, 0x8B,
0x00, 0x00, 0x48, 0x8B, 0x05, 0x04, 0x00, 0x00,
0x00, 0xFF, 0x35, 0x04, 0x00, 0x00, 0x00, 0x8B,
0x05, 0x00, 0x00, 0x00, 0x00, 0x8B, 0x05, 0x04,
0x00, 0x00, 0x00, 0xC6, 0x05, 0xFF, 0xFF, 0xFF,
0xFF, 0x12, 0x66, 0xC7, 0x05, 0xFE, 0xFF, 0xFF,
@ -138,9 +138,11 @@ undefined-symbols:
# CHECK: - kind: ripRel32GotLoad
# CHECK: offset: 13
# CHECK: target: _foo
# CHECK: addend: 4
# CHECK: - kind: ripRel32Got
# CHECK: offset: 19
# CHECK: target: _foo
# CHECK: addend: 4
# CHECK: - kind: ripRel32
# CHECK: offset: 25
# CHECK: target: _foo