aboutsummaryrefslogtreecommitdiffstats
path: root/lib/MC
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2010-03-29 23:56:40 +0000
committerDaniel Dunbar <daniel@zuster.org>2010-03-29 23:56:40 +0000
commit1de558b71f710a00e391fb9a88a6481b8918e207 (patch)
tree29fac73fd680f99317c3d1be6d978c0901e07cea /lib/MC
parent201f5f039f25921b459263e4fb71e3dc4925ecf0 (diff)
downloadexternal_llvm-1de558b71f710a00e391fb9a88a6481b8918e207.zip
external_llvm-1de558b71f710a00e391fb9a88a6481b8918e207.tar.gz
external_llvm-1de558b71f710a00e391fb9a88a6481b8918e207.tar.bz2
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')
-rw-r--r--lib/MC/MachObjectWriter.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/MC/MachObjectWriter.cpp b/lib/MC/MachObjectWriter.cpp
index 194be6e..e073eb5 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;