summaryrefslogtreecommitdiff
path: root/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp
Commit message (Collapse)AuthorAge
...
* Basic support for parsing Mach-O universal binaries in LLVMObject libraryAlexey Samsonov2013-06-18
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184191 91177308-0d34-0410-b5e6-96231b3b80d8
* Convert another use of sys::identifyFileType.Rafael Espindola2013-06-11
| | | | | | No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183758 91177308-0d34-0410-b5e6-96231b3b80d8
* Pass a StringRef to sys::identifyFileType.Rafael Espindola2013-06-10
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183669 91177308-0d34-0410-b5e6-96231b3b80d8
* Change how we iterate over relocations on ELF.Rafael Espindola2013-05-30
| | | | | | | | | | | | | | | | | | | | | | | | | | For COFF and MachO, sections semantically have relocations that apply to them. That is not the case on ELF. In relocatable objects (.o), a section with relocations in ELF has offsets to another section where the relocations should be applied. In dynamic objects and executables, relocations don't have an offset, they have a virtual address. The section sh_info may or may not point to another section, but that is not actually used for resolving the relocations. This patch exposes that in the ObjectFile API. It has the following advantages: * Most (all?) clients can handle this more efficiently. They will normally walk all relocations, so doing an effort to iterate in a particular order doesn't save time. * llvm-readobj now prints relocations in the same way the native readelf does. * probably most important, relocations that don't point to any section are now visible. This is the case of relocations in the rela.dyn section. See the updated relocation-executable.test for example. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182908 91177308-0d34-0410-b5e6-96231b3b80d8
* Put RTDyldMemoryManager into its own file, and make it linked into Filip Pizlo2013-05-21
| | | | | | | | | | | | | | | | | | | | libExecutionEngine. Move method implementations that aren't specific to allocation out of SectionMemoryManager and into RTDyldMemoryManager. This is in preparation for exposing RTDyldMemoryManager through the C API. This is a fixed version of r182407 and r182411. That first revision broke builds because I forgot to move the conditional includes of various POSIX headers from SectionMemoryManager into RTDyldMemoryManager. Those includes are necessary because of how getPointerToNamedFunction works around the glibc libc_nonshared.a thing. The latter revision still broke things because I forgot to include llvm/Config/config.h. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182418 91177308-0d34-0410-b5e6-96231b3b80d8
* Roll out r182411 and 182412 because it's still broken.Filip Pizlo2013-05-21
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182415 91177308-0d34-0410-b5e6-96231b3b80d8
* Put RTDyldMemoryManager into its own file, and make it linked into Filip Pizlo2013-05-21
| | | | | | | | | | | | | | | | | | libExecutionEngine. Move method implementations that aren't specific to allocation out of SectionMemoryManager and into RTDyldMemoryManager. This is in preparation for exposing RTDyldMemoryManager through the C API. This is a fixed version of r182407. That revision broke builds because I forgot to move the conditional includes of various POSIX headers from SectionMemoryManager into RTDyldMemoryManager. Those includes are necessary because of how getPointerToNamedFunction works around the glibc libc_nonshared.a thing. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182411 91177308-0d34-0410-b5e6-96231b3b80d8
* Roll out r182407 and r182408 because they broke builds.Filip Pizlo2013-05-21
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182409 91177308-0d34-0410-b5e6-96231b3b80d8
* Put RTDyldMemoryManager into its own file, and make it linked into Filip Pizlo2013-05-21
| | | | | | | | | | | | libExecutionEngine. Move method implementations that aren't specific to allocation out of SectionMemoryManager and into RTDyldMemoryManager. This is in preparation for exposing RTDyldMemoryManager through the C API. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182407 91177308-0d34-0410-b5e6-96231b3b80d8
* Add EH support to the MCJIT.Rafael Espindola2013-05-05
| | | | | | | | | This gets exception handling working on ELF and Macho (x86-64 at least). Other than the EH frame registration, this patch also implements support for GOT relocations which are used to locate the personality function on MachO. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181167 91177308-0d34-0410-b5e6-96231b3b80d8
* AArch64: add stubs to support long function calls on MCJITTim Northover2013-05-04
| | | | | | | | | | | | | | | | | | | | As with global accesses, external functions could exist anywhere in memory. Therefore the stub must create a complete 64-bit address. This patch implements the fragment as (roughly): movz x16, #:abs_g3:somefunc movk x16, #:abs_g2_nc:somefunc movk x16, #:abs_g1_nc:somefunc movk x16, #:abs_g0_nc:somefunc br x16 In principle we could save 4 bytes by using a literal-load instead, but it is unclear that would be more efficient and can only be tested when real hardware is readily available. This allows (for example) the MCJIT test 2003-05-07-ArgumentTest to pass on AArch64. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181133 91177308-0d34-0410-b5e6-96231b3b80d8
* [SystemZ] Add MCJIT supportRichard Sandiford2013-05-03
| | | | | | | | | Another step towards reinstating the SystemZ backend. I'll commit the configure changes separately (TARGET_HAS_JIT etc.), then commit a patch to enable the MCJIT tests on SystemZ. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181015 91177308-0d34-0410-b5e6-96231b3b80d8
* Add getSymbolAlignment to the ObjectFile interface.Rafael Espindola2013-04-29
| | | | | | | | | | | | | For regular object files this is only meaningful for common symbols. An object file format with direct support for atoms should be able to provide alignment information for all symbols. This replaces getCommonSymbolAlignment and fixes test-common-symbols-alignment.ll on darwin. This also includes a fix to MachOObjectFile::getSymbolFlags. It was marking undefined symbols as common (already tested by existing mcjit tests now that it is used). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180736 91177308-0d34-0410-b5e6-96231b3b80d8
* Use a RelocationRef instead of a relocation_iterator.Rafael Espindola2013-04-29
| | | | | | No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180723 91177308-0d34-0410-b5e6-96231b3b80d8
* Propagate relocation info to resolveRelocation.Rafael Espindola2013-04-29
| | | | | | This gets most of the MCJITs tests passing with MachO. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180716 91177308-0d34-0410-b5e6-96231b3b80d8
* Replace ObjRelocationInfo with relocation_iterator.Rafael Espindola2013-04-29
| | | | | | | | | | | For MachO we need information that is not represented in ObjRelocationInfo. Instead of copying the bits we think are needed from a relocation_iterator, just pass the relocation_iterator down to the format specific functions. No functionality change yet as we still drop the information once processRelocationRef returns. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180711 91177308-0d34-0410-b5e6-96231b3b80d8
* Formatting, grammarAndrew Kaylor2013-02-20
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175647 91177308-0d34-0410-b5e6-96231b3b80d8
* Adding support for absolute relocations. This occurs in ELF files when a ↵Andrew Kaylor2013-02-20
| | | | | | relocation is given with no name and an undefined section. The relocation is applied with an address of zero. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175643 91177308-0d34-0410-b5e6-96231b3b80d8
* Query section for whether it should be executable.Tim Northover2012-12-17
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170350 91177308-0d34-0410-b5e6-96231b3b80d8
* RuntimeDyld: Fix up r169178. MSVC doesn't like "or".NAKAMURA Takumi2012-12-04
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169183 91177308-0d34-0410-b5e6-96231b3b80d8
* Runtime dynamic linker for MCJIT should support MIPS BigEndian architecture.Akira Hatanaka2012-12-03
| | | | | | | | | | This small change adds support for that. It will make all MCJIT tests pass in make-check on BigEndian platforms. Patch by Petar Jovanovic. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169178 91177308-0d34-0410-b5e6-96231b3b80d8
* Use the new script to sort the includes of every file under lib.Chandler Carruth2012-12-03
| | | | | | | | | | | | | | | | | Sooooo many of these had incorrect or strange main module includes. I have manually inspected all of these, and fixed the main module include to be the nearest plausible thing I could find. If you own or care about any of these source files, I encourage you to take some time and check that these edits were sensible. I can't have broken anything (I strictly added headers, and reordered them, never removed), but they may not be the headers you'd really like to identify as containing the API being implemented. Many forward declarations and missing includes were added to a header files to allow them to parse cleanly when included first. The main module rule does in fact have its merits. =] git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169131 91177308-0d34-0410-b5e6-96231b3b80d8
* Add R_ARM_TARGET1 relocation to MCJIT and ensure that the runtime dyld readsAmara Emerson2012-11-16
| | | | | | | | | | all symbols during object loading, not just global ones. This fixes JIT execution of code using llvm.global_ctors with internal linkage constructors. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168148 91177308-0d34-0410-b5e6-96231b3b80d8
* Interface changes to allow RuntimeDyld memory managers to set memory ↵Andrew Kaylor2012-11-15
| | | | | | permissions after an object has been loaded. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168114 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a method to indicate section address re-assignment is finished.Andrew Kaylor2012-11-05
| | | | | | Prior to this patch RuntimeDyld attempted to re-apply relocations every time reassignSectionAddress was called (via MCJIT::mapSectionAddress). In addition to being inefficient and redundant, this led to a problem when a section was temporarily moved too far away from another section with a relative relocation referencing the section being moved. To fix this, I'm adding a new method (finalizeObject) which the client can call to indicate that it is finished rearranging section addresses so the relocations can safely be applied. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167400 91177308-0d34-0410-b5e6-96231b3b80d8
* Change resolveRelocation parameters so the relocations can find placeholder ↵Andrew Kaylor2012-11-02
| | | | | | | | values in the original object buffer. Some ELF relocations require adding the a value to the original contents of the object buffer at the specified location. In order to properly handle multiple applications of a relocation, the RuntimeDyld code should be grabbing the original value from the object buffer and writing a new value into the loaded section buffer. This patch changes the parameters passed to resolveRelocations to accommodate this need. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167304 91177308-0d34-0410-b5e6-96231b3b80d8
* Fixed format string to avoid pointer truncation during 64-bit debugging.Andrew Kaylor2012-11-01
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167247 91177308-0d34-0410-b5e6-96231b3b80d8
* Make use of common-symbol alignment info in ELF loader.Tim Northover2012-10-29
| | | | | | Patch by Amara Emerson. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166919 91177308-0d34-0410-b5e6-96231b3b80d8
* PowerPC: Initial support for PowerPC64 MCJITAdhemerval Zanella2012-10-25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds initial support for MCJIT for PPC64-elf-abi. The TOC relocation and ODP handling is implemented. It fixes the following ExecutionEngine testcases: ExecutionEngine/2003-01-04-ArgumentBug.ll ExecutionEngine/2003-01-04-LoopTest.ll ExecutionEngine/2003-01-04-PhiTest.ll ExecutionEngine/2003-01-09-SARTest.ll ExecutionEngine/2003-01-10-FUCOM.ll ExecutionEngine/2003-01-15-AlignmentTest.ll ExecutionEngine/2003-05-11-PHIRegAllocBug.ll ExecutionEngine/2003-06-04-bzip2-bug.ll ExecutionEngine/2003-06-05-PHIBug.ll ExecutionEngine/2003-08-15-AllocaAssertion.ll ExecutionEngine/2003-08-21-EnvironmentTest.ll ExecutionEngine/2003-08-23-RegisterAllocatePhysReg.ll ExecutionEngine/2003-10-18-PHINode-ConstantExpr-CondCode-Failure.ll ExecutionEngine/simplesttest.ll ExecutionEngine/simpletest.ll ExecutionEngine/stubs.ll ExecutionEngine/test-arith.ll ExecutionEngine/test-branch.ll ExecutionEngine/test-call-no-external-funcs.ll ExecutionEngine/test-cast.ll ExecutionEngine/test-common-symbols.ll ExecutionEngine/test-constantexpr.ll ExecutionEngine/test-fp-no-external-funcs.ll ExecutionEngine/test-fp.ll ExecutionEngine/test-global-init-nonzero.ll ExecutionEngine/test-global.ll ExecutionEngine/test-loadstore.ll ExecutionEngine/test-local.ll ExecutionEngine/test-logical.ll ExecutionEngine/test-loop.ll ExecutionEngine/test-phi.ll ExecutionEngine/test-ret.ll ExecutionEngine/test-return.ll ExecutionEngine/test-setcond-fp.ll ExecutionEngine/test-setcond-int.ll ExecutionEngine/test-shift.ll git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166678 91177308-0d34-0410-b5e6-96231b3b80d8
* Indenting.Eric Christopher2012-10-12
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165785 91177308-0d34-0410-b5e6-96231b3b80d8
* Clean-up of memory buffer and object ownership model in MCJITAndrew Kaylor2012-10-02
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165053 91177308-0d34-0410-b5e6-96231b3b80d8
* Better const handling for RuntimeDyld and MCJIT.Jim Grosbach2012-09-13
| | | | | | mapSectionAddress() wasn't consistent. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163843 91177308-0d34-0410-b5e6-96231b3b80d8
* MCJIT: getPointerToFunction() references target address space.Jim Grosbach2012-09-05
| | | | | | | Make sure to return a pointer into the target memory, not the local memory. Often they are the same, but we can't assume that. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163217 91177308-0d34-0410-b5e6-96231b3b80d8
* Correct MCJIT functionality for MIPS32 architecture.Akira Hatanaka2012-08-17
| | | | | | | | | | | No new tests are added. All tests in ExecutionEngine/MCJIT that have been failing pass after this patch is applied (when "make check" is done on a mips board). Patch by Petar Jovanovic. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162135 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a typo (the the => the)Sylvestre Ledru2012-07-23
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160621 91177308-0d34-0410-b5e6-96231b3b80d8
* RuntimeDyld cleanup:Eli Bendersky2012-05-01
| | | | | | | | | | | | | - Improved parameter names for clarity - Added comments - emitCommonSymbols should return void because its return value is not being used anywhere - Attempt to reduce the usage of the RelocationValueRef type. Restricts it for a single goal and may serve as a step for eventual removal. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@155908 91177308-0d34-0410-b5e6-96231b3b80d8
* RuntimeDyld code cleanup:Eli Bendersky2012-05-01
| | | | | | | | | | | - There's no point having a different type for the local and global symbol tables. - Renamed SymbolTable to GlobalSymbolTable to clarify the intention - Improved const correctness where relevant git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@155898 91177308-0d34-0410-b5e6-96231b3b80d8
* It doesn't make sense to move symbol relocations to section relocations whenEli Bendersky2012-04-30
| | | | | | | | | | | relocations are resolved. It's much more reasonable to do this decision when relocations are just being added - we have all the information at that point. Also a bit of renaming and extra comments to clarify extensions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@155819 91177308-0d34-0410-b5e6-96231b3b80d8
* Code cleanup in RuntimeDyld:Eli Bendersky2012-04-30
| | | | | | | | | | | - Add comments - Change field names to be more reasonable - Fix indentation and naming to conform to coding conventions - Remove unnecessary includes / replace them by forward declatations git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@155815 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix some formatting, grammar and style issues and add a couple of missing ↵Eli Bendersky2012-04-29
| | | | | | comments. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@155793 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement GDB integration for source level debugging of code JITed usingPreston Gurd2012-04-16
| | | | | | | | | | | | | | | | the MCJIT execution engine. The GDB JIT debugging integration support works by registering a loaded object image with a pre-defined function that GDB will monitor if GDB is attached. GDB integration support is implemented for ELF only at this time. This integration requires GDB version 7.0 or newer. Patch by Andy Kaylor! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@154868 91177308-0d34-0410-b5e6-96231b3b80d8
* This patch improves the MCJIT runtime dynamic loader by adding new handlingPreston Gurd2012-04-12
| | | | | | | | | | | | of zero-initialized sections, virtual sections and common symbols and preventing the loading of sections which are not required for execution such as debug information. Patch by Andy Kaylor! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@154610 91177308-0d34-0410-b5e6-96231b3b80d8
* Re-factored RuntimeDyLd:Danil Malyshev2012-03-30
| | | | | | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153754 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r153694. It was causing failures in the buildbots.Bill Wendling2012-03-29
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153701 91177308-0d34-0410-b5e6-96231b3b80d8
* Re-factored RuntimeDyld.Danil Malyshev2012-03-29
| | | | | | Added ExecutionEngine/MCJIT tests. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153694 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert a series of commits to MCJIT to get the build working in CMakeChandler Carruth2012-03-22
| | | | | | | | | | | | | | | (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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153241 91177308-0d34-0410-b5e6-96231b3b80d8
* Re-factored RuntimeDyld.Danil Malyshev2012-03-21
| | | | | | Added ExecutionEngine/MCJIT tests. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153221 91177308-0d34-0410-b5e6-96231b3b80d8
* Split the lib/ExecutionEngine/RuntimeDyld/RuntimeDyldImpl.h header to ↵Eli Bendersky2012-01-22
| | | | | | | | | | | | smaller logical headers. ELF and MachO implementations of RuntimeDyldImpl go into their own header files now. Reviewed on llvm-commits git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148652 91177308-0d34-0410-b5e6-96231b3b80d8
* Tidy up.Jim Grosbach2012-01-16
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148265 91177308-0d34-0410-b5e6-96231b3b80d8
* ExecutionEngine interface to re-map addresses for engines that support it.Jim Grosbach2012-01-16
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148264 91177308-0d34-0410-b5e6-96231b3b80d8