diff options
author | Evan Cheng <evan.cheng@apple.com> | 2007-12-22 09:40:20 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2007-12-22 09:40:20 +0000 |
commit | aabe38bf0c773dffed5c12a35e894915418af512 (patch) | |
tree | efcc3165fb64519ff1784903112d725c8682d5d2 /lib/Target/X86/X86JITInfo.cpp | |
parent | a9ab84666927e2ecb79bc7cba6c0df0c88c03912 (diff) | |
download | llvm-aabe38bf0c773dffed5c12a35e894915418af512.tar.gz llvm-aabe38bf0c773dffed5c12a35e894915418af512.tar.bz2 llvm-aabe38bf0c773dffed5c12a35e894915418af512.tar.xz |
Preliminary PIC JIT support for X86 (32-bit) / Darwin.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45313 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/X86/X86JITInfo.cpp')
-rw-r--r-- | lib/Target/X86/X86JITInfo.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/Target/X86/X86JITInfo.cpp b/lib/Target/X86/X86JITInfo.cpp index fb121c7fcb..5ce00053a9 100644 --- a/lib/Target/X86/X86JITInfo.cpp +++ b/lib/Target/X86/X86JITInfo.cpp @@ -437,7 +437,14 @@ void X86JITInfo::relocate(void *Function, MachineRelocation *MR, case X86::reloc_pcrel_word: { // PC relative relocation, add the relocated value to the value already in // memory, after we adjust it for where the PC is. - ResultPtr = ResultPtr-(intptr_t)RelocPos-4-MR->getConstantVal(); + ResultPtr = ResultPtr -(intptr_t)RelocPos - 4 - MR->getConstantVal(); + *((unsigned*)RelocPos) += (unsigned)ResultPtr; + break; + } + case X86::reloc_picrel_word: { + // PIC base relative relocation, add the relocated value to the value + // already in memory, after we adjust it for where the PIC base is. + ResultPtr = ResultPtr - ((intptr_t)Function + MR->getConstantVal()); *((unsigned*)RelocPos) += (unsigned)ResultPtr; break; } |