1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-01 08:23:21 +01:00
llvm-mirror/tools
Jim Grosbach ae80577a24 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
$

llvm-svn: 129388
2011-04-12 21:20:41 +00:00
..
bugpoint Fix whitespace. 2011-03-31 13:06:39 +00:00
bugpoint-passes Add dependency to "make check". 2010-12-10 02:15:36 +00:00
edis Build EnhancedDisassembly as a shared library too. 2011-03-12 22:01:47 +00:00
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 Fix Whitespace. 2011-01-10 02:34:40 +00:00
llvm-as Merge System into Support. 2010-11-29 18:16:10 +00:00
llvm-bcanalyzer llvm-bcanalyzer.cpp: Tweak format string to suppress warnings on mingw32-g++. 2011-03-18 03:21:04 +00:00
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 Reapply: Add type output to llvm-dis annotations. Patch by Yuri! 2011-03-17 19:50:04 +00:00
llvm-extract Merge System into Support. 2010-11-29 18:16:10 +00:00
llvm-ld Switch FileRemover from PathV1 to V2. 2011-03-31 13:04:19 +00:00
llvm-link Merge System into Support. 2010-11-29 18:16:10 +00:00
llvm-mc Moved an access to an object past a NULL check, 2011-04-09 00:21:04 +00:00
llvm-nm llvm-nm: Update to use the new LLVMObject library. 2011-01-20 06:38:57 +00:00
llvm-objdump We need to pass the TargetMachine object to the InstPrinter if we are printing 2011-03-21 04:13:46 +00:00
llvm-prof MemoryBuffer now return an error_code and returns a OwningPtr<MemoryBuffer> via an out parm. 2010-12-16 03:29:14 +00:00
llvm-ranlib Support/Path: Deprecate PathV1::exists and replace all uses with PathV2::fs::exists. 2011-01-10 02:34:23 +00:00
llvm-rtdyld MCJIT lazy relocation resolution and symbol address re-assignment. 2011-04-12 21:20:41 +00:00
llvm-shlib improve solaris support, from PR9109, patch by Yuri! 2011-02-13 08:38:44 +00:00
llvm-stub llvm-stub.cpp: mingw-w64 tweak. 2011-03-24 07:06:45 +00:00
llvmc Make "-opt [-emit-llvm]" work for .ll files. 2011-02-19 00:33:27 +00:00
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 MachO file loader and execution utility. 2011-03-18 17:11:39 +00:00
Makefile MachO file loader and execution utility. 2011-03-18 17:11:39 +00:00