diff options
author | Daniel Dunbar <daniel@zuster.org> | 2010-03-29 23:56:40 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2010-03-29 23:56:40 +0000 |
commit | 1de558b71f710a00e391fb9a88a6481b8918e207 (patch) | |
tree | 29fac73fd680f99317c3d1be6d978c0901e07cea /lib/MC/MachObjectWriter.cpp | |
parent | 201f5f039f25921b459263e4fb71e3dc4925ecf0 (diff) |
MC/Mach-O/x86_64: Support @GOTPCREL on symbols, even for non-PCrel relocations!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99853 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/MC/MachObjectWriter.cpp')
-rw-r--r-- | lib/MC/MachObjectWriter.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/MC/MachObjectWriter.cpp b/lib/MC/MachObjectWriter.cpp index 194be6e471..e073eb5a0d 100644 --- a/lib/MC/MachObjectWriter.cpp +++ b/lib/MC/MachObjectWriter.cpp @@ -612,9 +612,16 @@ public: } } } else { - if (Modifier == MCSymbolRefExpr::VK_GOT) + if (Modifier == MCSymbolRefExpr::VK_GOT) { Type = RIT_X86_64_GOT; - else if (Modifier != MCSymbolRefExpr::VK_None) + } else if (Modifier == MCSymbolRefExpr::VK_GOTPCREL) { + // GOTPCREL is allowed as a modifier on non-PCrel instructions, in + // which case all we do is set the PCrel bit in the relocation entry; + // this is used with exception handling, for example. The source is + // required to include any necessary offset directly. + Type = RIT_X86_64_GOT; + IsPCRel = 1; + } else if (Modifier != MCSymbolRefExpr::VK_None) llvm_report_error("unsupported symbol modifier in relocation"); else Type = RIT_X86_64_Unsigned; |