summaryrefslogtreecommitdiff
path: root/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp
Commit message (Collapse)AuthorAge
* Remove 'using std::errro_code' from lib.Rafael Espindola2014-06-13
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210871 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove all uses of 'using std::error_code' from headers.Rafael Espindola2014-06-13
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210866 91177308-0d34-0410-b5e6-96231b3b80d8
* [RuntimeDyld] Add support for MachO __jump_table and __pointers sections, andLang Hames2014-05-12
| | | | | | | | | | | | | SECTDIFF relocations on 32-bit x86. This fixes several of the MCJIT regression test failures that show up on 32-bit builds. <rdar://problem/16886294> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208635 91177308-0d34-0410-b5e6-96231b3b80d8
* Back out r208257 while I investigate tester failures.Lang Hames2014-05-07
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208267 91177308-0d34-0410-b5e6-96231b3b80d8
* [RuntimeDyld] Make RuntimeDyldImpl::resolveExternalSymbols preserve theLang Hames2014-05-07
| | | | | | | | | | | | | | | | | | | relocation entries it applies. Prior to this patch, RuntimeDyldImpl::resolveExternalSymbols discarded relocations for external symbols once they had been applied. This causes issues if the client calls MCJIT::finalizeLoadedModules more than once, and updates the location of any symbols in between (e.g. by calling MCJIT::mapSectionAddress). No test case yet: None of our in-tree memory managers support moving sections around. I'll have to hack up a dummy memory manager before I can write a unit test. Fixes <rdar://problem/16764378> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208257 91177308-0d34-0410-b5e6-96231b3b80d8
* [ARM64] Try and make the ELF MCJIT *slightly* less broken for ARM64.James Molloy2014-04-30
| | | | | | | | | A bunch of switch cases were missing, not just for ARM64 but also for AArch64_BE. I've fixed all those, but there's zero testing as ExecutionEngine tests are disabled when crosscompiling and I don't have a native platform available to test on. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207626 91177308-0d34-0410-b5e6-96231b3b80d8
* PR19553: Memory leak in RuntimeDyldELF::createObjectImageFromFileDavid Blaikie2014-04-29
| | | | | | | | | | | | | | | | This starts in MCJIT::getSymbolAddress where the unique_ptr<object::Binary> is release()d and (after a cast) passed to a single caller, MCJIT::addObjectFile. addObjectFile calls RuntimeDyld::loadObject. RuntimeDld::loadObject calls RuntimeDyldELF::createObjectFromFile And the pointer is never owned at this point. I say this point, because the alternative codepath, RuntimeDyldMachO::createObjectFile certainly does take ownership, so this seemed like a good hint that this was a/the right place to take ownership. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207580 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++] Use 'nullptr'.Craig Topper2014-04-24
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207083 91177308-0d34-0410-b5e6-96231b3b80d8
* [Modules] Fix potential ODR violations by sinking the DEBUG_TYPEChandler Carruth2014-04-22
| | | | | | | definition below all the header #include lines. This updates most of the miscellaneous other lib/... directories. A few left though. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206845 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "[rtdyld,c++11] Range'ify symbol table walking."Jim Grosbach2014-04-21
| | | | | | | | | Tentative revert for http://lab.llvm.org:8011/builders/llvm-mips-linux/builds/8305. This reverts commit c2a58efff07294fca724f89500538f2ddbcd12ff. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206773 91177308-0d34-0410-b5e6-96231b3b80d8
* [rtdyld,c++11] Range'ify symbol table walking.Jim Grosbach2014-04-21
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206769 91177308-0d34-0410-b5e6-96231b3b80d8
* Convert getFileOffset to getOffset and move it to its only user.Rafael Espindola2014-04-21
| | | | | | | | | | | | | We normally don't drop functions from the C API's, but in this case I think we can: * The old implementation of getFileOffset was fairly broken * The introduction of LLVMGetSymbolFileOffset was itself a C api breaking change as it removed LLVMGetSymbolOffset. * It is an incredibly specialized use case. The only reason MCJIT needs it is because of its odd position of being a dynamic linker of .o files. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206750 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove section_rel_empty. Just compare begin() and end() instead.Rafael Espindola2014-04-03
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205577 91177308-0d34-0410-b5e6-96231b3b80d8
* Add ARM big endian Target (armeb, thumbeb)Christian Pirker2014-03-28
| | | | | | | | Reviewed at http://llvm-reviews.chandlerc.com/D3095 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205007 91177308-0d34-0410-b5e6-96231b3b80d8
* [MCJIT] Check if there have been errors during RuntimeDyld execution.Juergen Ributzka2014-03-26
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204837 91177308-0d34-0410-b5e6-96231b3b80d8
* AArch64_BE Elf support for MC-JIT runtime dynamic linkerChristian Pirker2014-03-26
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204816 91177308-0d34-0410-b5e6-96231b3b80d8
* [RuntimeDyld] clang-format files.Juergen Ributzka2014-03-21
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204507 91177308-0d34-0410-b5e6-96231b3b80d8
* [RuntimeDyld] Allow processRelocationRef to process more than one relocation ↵Juergen Ributzka2014-03-21
| | | | | | | | | | | | | entry at a time. Some targets require more than one relocation entry to perform a relocation. This change allows processRelocationRef to process more than one relocation entry at a time by passing the relocation iterator itself instead of just the relocation entry. Related to <rdar://problem/16199095> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204439 91177308-0d34-0410-b5e6-96231b3b80d8
* Add an option to MCJIT to have it forward all sections to theLang Hames2014-03-20
| | | | | | | | | | | | | | | | | | | | | | | | RTDyldMemoryManager, regardless of whether it thinks they're "required for execution". Currently, RuntimeDyld only passes sections that are "required for execution" to the RTDyldMemoryManager, and takes "required for execution" to mean exactly "contains symbols or relocations". There are two problems with this: (1) It can drop sections with anonymous data that is referenced by code. (2) It leaves the JIT client no way to inspect interesting sections that aren't actually required to run the program (e.g dwarf sections). A test case is still in the works. Future work: We may want to replace this with a generic section filtering mechanism, but that will require more consideration. For now, this flag at least allows clients to volunteer to do the filtering themselves. Fixes <rdar://problem/15177691>. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204398 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] Introduce SectionRef::relocations() to use range-based loopsAlexey Samsonov2014-03-14
| | | | | | | | | | | | Reviewers: rafael Reviewed By: rafael CC: llvm-commits Differential Revision: http://llvm-reviews.chandlerc.com/D3077 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203927 91177308-0d34-0410-b5e6-96231b3b80d8
* Make createObjectImage and createObjectImageFromFile static methods on theLang Hames2014-03-08
| | | | | | | | | | relevant subclasses of RuntimeDyldImpl. This allows construction of RuntimeDyldImpl instances to be deferred until after the target architecture is known. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203352 91177308-0d34-0410-b5e6-96231b3b80d8
* Replace OwningPtr<T> with std::unique_ptr<T>.Ahmed Charles2014-03-06
| | | | | | | | | | This compiles with no changes to clang/lld/lldb with MSVC and includes overloads to various functions which are used by those projects and llvm which have OwningPtr's as parameters. This should allow out of tree projects some time to move. There are also no changes to libs/Target, which should help out of tree targets have time to move, if necessary. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203083 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] Replace OwningPtr::take() with OwningPtr::release().Ahmed Charles2014-03-05
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202957 91177308-0d34-0410-b5e6-96231b3b80d8
* Extend RTDyld API to enable optionally precomputing the total amount of memoryLang Hames2014-02-12
| | | | | | | | | | | | | | | | | | | | required for all sections in a module. This can be useful when targets or code-models place strict requirements on how sections must be laid out in memory. If RTDyldMemoryManger::needsToReserveAllocationSpace() is overridden to return true then the JIT will call the following method on the memory manager, which can be used to preallocate the necessary memory. void RTDyldMemoryManager::reserveAllocationSpace(uintptr_t CodeSize, uintptr_t DataSizeRO, uintptr_t DataSizeRW) Patch by Vaidas Gasiunas. Thanks very much Viadas! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201259 91177308-0d34-0410-b5e6-96231b3b80d8
* In RuntimeDyldImpl::emitSection, make Allocate (section size to be allocated) aLang Hames2014-02-11
| | | | | | | | | | | | | | | uintptr_t. An unsigned could overflow for large sections. No test case - anything big enough to overflow an unsigned is going to take an appreciable time to zero when the test passes. The choice of uintptr_t was made to match the RTDyldMemoryManager APIs, but these should probably be hardcoded to uint64_ts: It is legitimate to JIT for 64-bit targets from a 32-bit host/compiler. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201127 91177308-0d34-0410-b5e6-96231b3b80d8
* Change the begin and end methods in ObjectFile to match the style guide.Rafael Espindola2014-02-10
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201108 91177308-0d34-0410-b5e6-96231b3b80d8
* Simplify getSymbolFlags.Rafael Espindola2014-01-31
| | | | | | | None of the object formats require extra parsing to compute these flags, so the method cannot fail. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200574 91177308-0d34-0410-b5e6-96231b3b80d8
* Simplify the handling of iterators in ObjectFile.Rafael Espindola2014-01-30
| | | | | | | | | | | | None of the object file formats reported error on iterator increment. In retrospect, that is not too surprising: no object format stores symbols or sections in a linked list or other structure that requires chasing pointers. As a consequence, all error checking can be done on begin() and end(). This reduces the text segment of bin/llvm-readobj in my machine from 521233 to 518526 bytes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200442 91177308-0d34-0410-b5e6-96231b3b80d8
* Re-apply r196639: Add support for archives and object file caching under MCJIT.Lang Hames2014-01-08
| | | | | | | | | | I believe the bot failures on linux systems were due to overestimating the alignment of object-files within archives, which are only guaranteed to be two-byte aligned. I have reduced the alignment in RuntimeDyldELF::createObjectImageFromFile accordingly. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198737 91177308-0d34-0410-b5e6-96231b3b80d8
* Re-sort all of the includes with ./utils/sort_includes.py so thatChandler Carruth2014-01-07
| | | | | | | | | | subsequent changes are easier to review. About to fix some layering issues, and wanted to separate out the necessary churn. Also comment and sink the include of "Windows.h" in three .inc files to match the usage in Memory.inc. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198685 91177308-0d34-0410-b5e6-96231b3b80d8
* Whitespace cleanups.NAKAMURA Takumi2013-12-07
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196654 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r196639 while I investigate a bot failure.Lang Hames2013-12-07
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196641 91177308-0d34-0410-b5e6-96231b3b80d8
* Add support for archives and object file caching under MCJIT.Lang Hames2013-12-07
| | | | | | | | Patch by Andy Kaylor, with minor edits to resolve merge conflicts. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196639 91177308-0d34-0410-b5e6-96231b3b80d8
* [weak vtables] Remove a bunch of weak vtablesJuergen Ributzka2013-11-19
| | | | | | | | | | | | This patch removes most of the trivial cases of weak vtables by pinning them to a single object file. The memory leaks in this version have been fixed. Thanks Alexey for pointing them out. Differential Revision: http://llvm-reviews.chandlerc.com/D2068 Reviewed by Andy git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195064 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r194865 and r194874.Alexey Samsonov2013-11-18
| | | | | | | | | | | | | This change is incorrect. If you delete virtual destructor of both a base class and a subclass, then the following code: Base *foo = new Child(); delete foo; will not cause the destructor for members of Child class. As a result, I observe plently of memory leaks. Notable examples I investigated are: ObjectBuffer and ObjectBufferStream, AttributeImpl and StringSAttributeImpl. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194997 91177308-0d34-0410-b5e6-96231b3b80d8
* [weak vtables] Remove a bunch of weak vtablesJuergen Ributzka2013-11-15
| | | | | | | | | | | This patch removes most of the trivial cases of weak vtables by pinning them to a single object file. Differential Revision: http://llvm-reviews.chandlerc.com/D2068 Reviewed by Andy git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194865 91177308-0d34-0410-b5e6-96231b3b80d8
* Path: Recognize COFF import library file magic.Rui Ueyama2013-11-15
| | | | | | | | | | | | Summary: Make identify_magic to recognize COFF import file. Reviewers: Bigcheese CC: llvm-commits Differential Revision: http://llvm-reviews.chandlerc.com/D2165 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194852 91177308-0d34-0410-b5e6-96231b3b80d8
* Fixing a problem with iterator validity in ↵Andrew Kaylor2013-11-11
| | | | | | RuntimeDyldImpl::resolveExternalSymbols git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194415 91177308-0d34-0410-b5e6-96231b3b80d8
* Improving MCJIT/RuntimeDyld thread safetyAndrew Kaylor2013-10-21
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193094 91177308-0d34-0410-b5e6-96231b3b80d8
* Avoid duplicate search by reusing the iterator.Yaron Keren2013-10-19
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193034 91177308-0d34-0410-b5e6-96231b3b80d8
* Adding padding to the .eh_frame section in RuntimeDyldAndrew Kaylor2013-10-16
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192754 91177308-0d34-0410-b5e6-96231b3b80d8
* Adding support for deregistering EH frames with MCJIT.Andrew Kaylor2013-10-16
| | | | | | | | Patch by Yaron Keren git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192753 91177308-0d34-0410-b5e6-96231b3b80d8
* Path: Recognize Windows compiled resource file.Rui Ueyama2013-10-15
| | | | | | | | | | | | | | Some background: One can pass compiled resource files (.res files) directly to the linker on Windows. If a resource file is given, the linker will run "cvtres" command in background to convert the resource file to a COFF file to link it. What I'm trying to do with this patch is to make the linker to recognize the resource file by file magic, so that it can run cvtres command. Differential Revision: http://llvm-reviews.chandlerc.com/D1943 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192742 91177308-0d34-0410-b5e6-96231b3b80d8
* Fixing some host==target assumptions in RuntimeDyldAndrew Kaylor2013-10-15
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192732 91177308-0d34-0410-b5e6-96231b3b80d8
* Adding multiple object support to MCJIT EH frame handlingAndrew Kaylor2013-10-11
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192504 91177308-0d34-0410-b5e6-96231b3b80d8
* This threads SectionName through the allocateCodeSection/allocateDataSection ↵Filip Pizlo2013-10-02
| | | | | | | | | | | | | | | | | | | | APIs, both in C++ and C land. It's useful for the memory managers that are allocating a section to know what the name of the section is. At a minimum, this is useful for low-level debugging - it's customary for JITs to be able to tell you what memory they allocated, and as part of any such dump, they should be able to tell you some meta-data about what each allocation is for. This allows clients that supply their own memory managers to do this. Additionally, we also envision the SectionName being useful for passing meta-data from within LLVM to an LLVM client. This changes both the C and C++ APIs, and all of the clients of those APIs within LLVM. I'm assuming that it's safe to change the C++ API because that API is allowed to change. I'm assuming that it's safe to change the C API because we haven't shipped the API in a release yet (LLVM 3.3 doesn't include the MCJIT memory management C API). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191804 91177308-0d34-0410-b5e6-96231b3b80d8
* Adding multiple module support for MCJIT.Andrew Kaylor2013-10-01
| | | | | | | | | | Tests to follow. PIC with small code model and EH frame handling will not work with multiple modules. There are also some rough edges to be smoothed out for remote target support. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191722 91177308-0d34-0410-b5e6-96231b3b80d8
* Adding PIC support for ELF on x86_64 platformsAndrew Kaylor2013-08-19
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188726 91177308-0d34-0410-b5e6-96231b3b80d8
* Adding comments to document RuntimeDyld relocation handlingAndrew Kaylor2013-08-19
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188697 91177308-0d34-0410-b5e6-96231b3b80d8
* [PowerPC] Support powerpc64le as a syntax-checking target.Bill Schmidt2013-07-26
| | | | | | | | | | | | | | | | | | | | | | | | This patch provides basic support for powerpc64le as an LLVM target. However, use of this target will not actually generate little-endian code. Instead, use of the target will cause the correct little-endian built-in defines to be generated, so that code that tests for __LITTLE_ENDIAN__, for example, will be correctly parsed for syntax-only testing. Code generation will otherwise be the same as powerpc64 (big-endian), for now. The patch leaves open the possibility of creating a little-endian PowerPC64 back end, but there is no immediate intent to create such a thing. The LLVM portions of this patch simply add ppc64le coverage everywhere that ppc64 coverage currently exists. There is nothing of any import worth testing until such time as little-endian code generation is implemented. In the corresponding Clang patch, there is a new test case variant to ensure that correct built-in defines for little-endian code are generated. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187179 91177308-0d34-0410-b5e6-96231b3b80d8