llvm-6502/tools
Jim Grosbach f8c1c8465f MCJIT lazy relocation resolution and symbol address re-assignment.
Add handling for tracking the relocations on symbols and resolving them.
Keep track of the relocations even after they are resolved so that if
the RuntimeDyld client moves the object, it can update the address and any
relocations to that object will be updated.

For our trival object file load/run test harness (llvm-rtdyld), this enables
relocations between functions located in the same object module. It should
be trivially extendable to load multiple objects with mutual references.

As a simple example, the following now works (running on x86_64 Darwin 10.6):


$ cat t.c
int bar() {
  return 65;
}

int main() {
  return bar();
}
$ clang t.c -fno-asynchronous-unwind-tables -o t.o -c
$ otool -vt t.o
t.o:
(__TEXT,__text) section
_bar:
0000000000000000  pushq %rbp
0000000000000001  movq  %rsp,%rbp
0000000000000004  movl  $0x00000041,%eax
0000000000000009  popq  %rbp
000000000000000a  ret
000000000000000b  nopl  0x00(%rax,%rax)
_main:
0000000000000010  pushq %rbp
0000000000000011  movq  %rsp,%rbp
0000000000000014  subq  $0x10,%rsp
0000000000000018  movl  $0x00000000,0xfc(%rbp)
000000000000001f  callq 0x00000024
0000000000000024  addq  $0x10,%rsp
0000000000000028  popq  %rbp
0000000000000029  ret
$ llvm-rtdyld t.o -debug-only=dyld ; echo $?
Function sym: '_bar' @ 0
Function sym: '_main' @ 16
Extracting function: _bar from [0, 15]
    allocated to 0x100153000
Extracting function: _main from [16, 41]
    allocated to 0x100154000
Relocation at '_main' + 16 from '_bar(Word1: 0x2d000000)
Resolving relocation at '_main' + 16 (0x100154010) from '_bar (0x100153000)(pcrel, type: 2, Size: 4).
loaded '_main' at: 0x100154000
65
$




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129388 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-12 21:20:41 +00:00
..
bugpoint Fix whitespace. 2011-03-31 13:06:39 +00:00
bugpoint-passes
edis
gold If present, use gold's support for getting a file view. This prevents having 2011-04-07 21:11:00 +00:00
llc Added *hidden* flags -print-options and -print-all-options so 2011-04-05 18:54:36 +00:00
lli Updated library dependencies. 2011-03-22 03:58:55 +00:00
llvm-ar
llvm-as
llvm-bcanalyzer
llvm-config Rename LLVMConfig.cmake to LLVM-Config.cmake. The *Config.cmake naming 2011-04-05 17:02:48 +00:00
llvm-diff Don't include Operator.h from InstrTypes.h. 2011-04-11 09:35:34 +00:00
llvm-dis
llvm-extract
llvm-ld Switch FileRemover from PathV1 to V2. 2011-03-31 13:04:19 +00:00
llvm-link
llvm-mc Moved an access to an object past a NULL check, 2011-04-09 00:21:04 +00:00
llvm-nm
llvm-objdump
llvm-prof
llvm-ranlib
llvm-rtdyld MCJIT lazy relocation resolution and symbol address re-assignment. 2011-04-12 21:20:41 +00:00
llvm-shlib
llvm-stub llvm-stub.cpp: mingw-w64 tweak. 2011-03-24 07:06:45 +00:00
llvmc
lto Update CMakeLists.txt 2011-04-01 18:03:58 +00:00
macho-dump Remove unused function. 2011-04-04 17:36:11 +00:00
opt remove graphprinter support for domfrontier. 2011-04-05 21:43:56 +00:00
CMakeLists.txt
Makefile