summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-rtdyld/llvm-rtdyld.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Re-factored RuntimeDyLd:Danil Malyshev2012-03-301-16/+0
| | | | | | | | | | | | | | | 1. The main works will made in the RuntimeDyLdImpl with uses the ObjectFile class. RuntimeDyLdMachO and RuntimeDyLdELF now only parses relocations and resolve it. This is allows to make improvements of the RuntimeDyLd more easily. In addition the support for COFF can be easily added. 2. Added ARM relocations to RuntimeDyLdELF. 3. Added support for stub functions for the ARM, allowing to do a long branch. 4. Added support for external functions that are not loaded from the object files, but can be loaded from external libraries. Now MCJIT can correctly execute the code containing the printf, putc, and etc. 5. The sections emitted instead functions, thanks Jim Grosbach. MemoryManager.startFunctionBody() and MemoryManager.endFunctionBody() have been removed. 6. MCJITMemoryManager.allocateDataSection() and MCJITMemoryManager. allocateCodeSection() used JMM->allocateSpace() instead of JMM->allocateCodeSection() and JMM->allocateDataSection(), because I got an error: "Cannot allocate an allocated block!" with object file contains more than one code or data sections. llvm-svn: 153754
* Revert r153694. It was causing failures in the buildbots.Bill Wendling2012-03-291-0/+16
| | | | llvm-svn: 153701
* Re-factored RuntimeDyld.Danil Malyshev2012-03-291-16/+0
| | | | | | Added ExecutionEngine/MCJIT tests. llvm-svn: 153694
* Move getPointerToNamedFunction() from JIT/MCJIT to JITMemoryManager.Danil Malyshev2012-03-281-0/+6
| | | | llvm-svn: 153607
* Revert a series of commits to MCJIT to get the build working in CMakeChandler Carruth2012-03-221-5/+15
| | | | | | | | | | | | | | | (and hopefully on Windows). The bots have been down most of the day because of this, and it's not clear to me what all will be required to fix it. The commits started with r153205, then r153207, r153208, and r153221. The first commit seems to be the real culprit, but I couldn't revert a smaller number of patches. When resubmitting, r153207 and r153208 should be folded into r153205, they were simple build fixes. llvm-svn: 153241
* Re-factored RuntimeDyld.Danil Malyshev2012-03-211-16/+0
| | | | | | Added ExecutionEngine/MCJIT tests. llvm-svn: 153221
* (no commit message)Danil Malyshev2012-03-211-0/+6
| | | | llvm-svn: 153208
* Remove unreachable code. (replace with llvm_unreachable to help GCC where ↵David Blaikie2012-01-171-2/+0
| | | | | | necessary) llvm-svn: 148284
* MCJIT support for non-function sections.Jim Grosbach2012-01-161-0/+18
| | | | | | | | | | | | | | | | Move to a by-section allocation and relocation scheme. This allows better support for sections which do not contain externally visible symbols. Flesh out the relocation address vs. local storage address separation a bit more as well. Remote process JITs use this to tell the relocation resolution code where the code will live when it executes. The startFunctionBody/endFunctionBody interfaces to the JIT and the memory manager are deprecated. They'll stick around for as long as the old JIT does, but the MCJIT doesn't use them anymore. llvm-svn: 148258
* Remove unnecessary default cases in switches that cover all enum values.David Blaikie2012-01-101-1/+0
| | | | llvm-svn: 147855
* Load multiple object files and link them via RuntimeDyld in llvm-rtdyld.Jim Grosbach2011-04-131-13/+23
| | | | | | | | | | | | | | | | | | | | | | 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 llvm-svn: 129448
* Allow user-specified program entry point for llvm-rtdyld.Jim Grosbach2011-04-131-3/+8
| | | | llvm-svn: 129446
* MCJIT lazy relocation resolution and symbol address re-assignment.Jim Grosbach2011-04-121-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Tidy up a bit now that we're using the MemoryManager interface.Jim Grosbach2011-04-121-9/+21
| | | | llvm-svn: 129328
* Refactor MCJIT 32-bit section loading.Jim Grosbach2011-04-081-1/+1
| | | | | | | 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. llvm-svn: 129138
* RuntimeDyld should use the memory manager API.Jim Grosbach2011-04-061-5/+5
| | | | | | | | | | 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. llvm-svn: 128973
* Layer the memory manager between the JIT and the runtime Dyld.Jim Grosbach2011-04-041-4/+17
| | | | | | | | | | | 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. llvm-svn: 128851
* Instantiate a JITMemoryManager for MCJIT DyldJim Grosbach2011-03-291-1/+2
| | | | llvm-svn: 128485
* Propogate the error message, not just the error state.Jim Grosbach2011-03-221-2/+3
| | | | llvm-svn: 128094
* Library-ize the dyld components of llvm-rtdyld.Jim Grosbach2011-03-211-226/+10
| | | | | | | | | 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. llvm-svn: 128031
* Add llvm-rtdyld support for loading 32-bit code.Jim Grosbach2011-03-181-66/+158
| | | | | | | 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. llvm-svn: 127892
* Naming conventional tidy up.Jim Grosbach2011-03-181-2/+2
| | | | llvm-svn: 127886
* MachO file loader and execution utility.Jim Grosbach2011-03-181-0/+231
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. llvm-svn: 127885
OpenPOWER on IntegriCloud