summaryrefslogtreecommitdiff
path: root/tools/llvm-rtdyld
Commit message (Collapse)AuthorAge
* build: Tidy up a bunch of tool Makefiles, and simplify where possible using theDaniel Dunbar2011-10-18
| | | | | | new all-targets pseudo-component. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142401 91177308-0d34-0410-b5e6-96231b3b80d8
* Load multiple object files and link them via RuntimeDyld in llvm-rtdyld.Jim Grosbach2011-04-13
| | | | | | | | | | | | | | | | | | | | | | | | Relocations between the object modules are properly resolved, as in the following trivial example: $ cat t.c int foo(); int main() { return foo(); } $ cat foo.c int foo() { return 65; } $ clang -c t.c -fno-asynchronous-unwind-tables $ clang -c foo.c -fno-asynchronous-unwind-tables $ llvm-rtdyld t.o foo.o ; echo $? loaded '_main' at: 0x10015c000 65 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129448 91177308-0d34-0410-b5e6-96231b3b80d8
* Allow user-specified program entry point for llvm-rtdyld.Jim Grosbach2011-04-13
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129446 91177308-0d34-0410-b5e6-96231b3b80d8
* MCJIT lazy relocation resolution and symbol address re-assignment.Jim Grosbach2011-04-12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Tidy up a bit now that we're using the MemoryManager interface.Jim Grosbach2011-04-12
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129328 91177308-0d34-0410-b5e6-96231b3b80d8
* Refactor MCJIT 32-bit section loading.Jim Grosbach2011-04-08
| | | | | | | | | Teach 32-bit section loading to use the Memory Manager interface, just like the 64-bit loading does. Tidy up a few other things here and there. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129138 91177308-0d34-0410-b5e6-96231b3b80d8
* RuntimeDyld should use the memory manager API.Jim Grosbach2011-04-06
| | | | | | | | | | | | Start teaching the runtime Dyld interface to use the memory manager API for allocating space. Rather than mapping directly into the MachO object, we extract the payload for each object and copy it into a dedicated buffer allocated via the memory manager. For now, just do Segment64, so this works on x86_64, but not yet on ARM. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128973 91177308-0d34-0410-b5e6-96231b3b80d8
* Layer the memory manager between the JIT and the runtime Dyld.Jim Grosbach2011-04-04
| | | | | | | | | | | | The JITMemory manager references LLVM IR constructs directly, while the runtime Dyld works at a lower level and can handle objects which may not originate from LLVM IR. Introduce a new layer for the memory manager to handle the interface between them. For the MCJIT, this layer will be almost entirely simply a call-through w/ translation between the IR objects and symbol names. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128851 91177308-0d34-0410-b5e6-96231b3b80d8
* Update CMake link dependency.Francois Pichet2011-03-29
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128503 91177308-0d34-0410-b5e6-96231b3b80d8
* Instantiate a JITMemoryManager for MCJIT DyldJim Grosbach2011-03-29
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128485 91177308-0d34-0410-b5e6-96231b3b80d8
* Propogate the error message, not just the error state.Jim Grosbach2011-03-22
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128094 91177308-0d34-0410-b5e6-96231b3b80d8
* Build the new RuntimeDyld library.Oscar Fuentes2011-03-21
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128035 91177308-0d34-0410-b5e6-96231b3b80d8
* Library-ize the dyld components of llvm-rtdyld.Jim Grosbach2011-03-21
| | | | | | | | | | | Move the dynamic linking functionality of the llvm-rtdyld program into an ExecutionEngine support library. Update llvm-rtdyld to just load an object file into memory, use the library to process it, then run the _main() function, if one is found. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128031 91177308-0d34-0410-b5e6-96231b3b80d8
* Add llvm-rtdyld support for loading 32-bit code.Jim Grosbach2011-03-18
| | | | | | | | Factor out the 64-bit specific bits into a helper function and add an equivalent that loads the 32-bit sections. This allows using llvm-rtdyld on ARM. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127892 91177308-0d34-0410-b5e6-96231b3b80d8
* Update list of link components for llvm-rtdyld.Oscar Fuentes2011-03-18
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127887 91177308-0d34-0410-b5e6-96231b3b80d8
* Naming conventional tidy up.Jim Grosbach2011-03-18
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127886 91177308-0d34-0410-b5e6-96231b3b80d8
* MachO file loader and execution utility.Jim Grosbach2011-03-18
Add a bone-simple utility to load a MachO object into memory, look for a function (main) in it, and run that function directly. This will be used as a test and development platform for MC-JIT work regarding symbol resolution, dynamic lookup, etc.. Code by Daniel Dunbar. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127885 91177308-0d34-0410-b5e6-96231b3b80d8