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 | 345a00ba05edf0a62bef9d3a1d85b68fd1767b4d (patch) | |
tree | 576f5ed2db868205ae5b65ab055c64648520271d /llvm/lib/Target/X86/X86JITInfo.cpp | |
parent | db33a0211b0d47c4e023966764eecc19622a5580 (diff) | |
download | bcm5719-llvm-345a00ba05edf0a62bef9d3a1d85b68fd1767b4d.tar.gz bcm5719-llvm-345a00ba05edf0a62bef9d3a1d85b68fd1767b4d.zip |
Preliminary PIC JIT support for X86 (32-bit) / Darwin.
llvm-svn: 45313
Diffstat (limited to 'llvm/lib/Target/X86/X86JITInfo.cpp')
-rw-r--r-- | llvm/lib/Target/X86/X86JITInfo.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/llvm/lib/Target/X86/X86JITInfo.cpp b/llvm/lib/Target/X86/X86JITInfo.cpp index fb121c7fcbc..5ce00053a93 100644 --- a/llvm/lib/Target/X86/X86JITInfo.cpp +++ b/llvm/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; } |