summaryrefslogtreecommitdiff
path: root/lib/ExecutionEngine
AgeCommit message (Collapse)Author
2017-12-13Remove redundant includes from lib/ExecutionEngine.Michael Zolotukhin
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320621 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-09Fix 'not all control paths return a value' warning on MSVC buildsSimon Pilgrim
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@317790 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-09[SectionMemoryManager] Abstract out mmap, munmap, mprotect even more ; NFCSanjoy Das
Summary: This will let ORC JIT clients plug in custom logic for the mmap, munmap and mprotect paths. Reviewers: loladiro, dblaikie Subscribers: mcrosier, llvm-commits Differential Revision: https://reviews.llvm.org/D39300 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@317770 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-22ExecutionEngine: make COFF Thumb2 assertions non-tautologicalSaleem Abdulrasool
The overflow detection assertions were tautological due to truncation. Adjust them to no longer be tautological. Patch by Alex Langford! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316303 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-22[mips] Adds support for R_MIPS_26, HIGHER, HIGHEST relocations in RuntimeDyld.Nitesh Jain
Reviewers: sdardis Subscribers: jaydeep, bhushan, llvm-commits Differential Revision: https://reviews.llvm.org/D38314 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316287 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-20[ExecutionEngine] After a heroic dev-meeting hack session, the JIT supports TLS.Lang Hames
Turns on EmulatedTLS support by default in EngineBuilder. ;) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316200 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-19ExecutionEngine: adjust COFF i386 tautological assertsSaleem Abdulrasool
Modify static_casts to not be tautological in some COFF i386 relocations. Patch by Alex Langford! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316169 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-17[ExecutionEngine] Correct the size of a write in a COFF i386 relocationShoaib Meenai
We want to be writing a 32bit value, so we should be writing 4 bytes instead of 2. Patch by Alex Langford <apl@fb.com>. Differential Revision: https://reviews.llvm.org/D38872 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315964 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-11Convert an ErrorOr to Expected.Rafael Espindola
getRelocationAddend should never be called on non SHT_RELA sections, but changing that requires changing RelocVisitor.h. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315473 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-10Make the ELFObjectFile constructor private.Rafael Espindola
This forces every user to use the new create method that returns an Expected. This in turn propagates better error messages. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315371 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-10Try to make gcc happy.Rafael Espindola
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315349 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-10Return Expected from createRTDyldELFObject.Rafael Espindola
No functionality change, it just makes it easier to use Expected in Object. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315348 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-10Simplify. NFC.Rafael Espindola
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315347 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-28[ORC] Fix the type of RTDyldObjectLinkingLayer::NotifyLoadedFtor.Lang Hames
Bug found by Stefan Granitz. Thanks Stefan! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@314436 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-20Revert "Revert "ExecutionEngine: add R_AARCH64_ABS{16,32}""Saleem Abdulrasool
This reverts commit SVN r313668. The original test case attempted to write a pointer value into 16-bits, although the value may exceed the range representable in 16-bits. Ensure that the symbol is located in the address space such that its absolute address is representable in 16-bits. This should fix the assertion failure that was seen on the Windows hosts. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313822 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-19Revert "ExecutionEngine: add R_AARCH64_ABS{16,32}"Saleem Abdulrasool
This reverts commit SVN r313654. Seems that it is triggering an assertion on Windows specifically. Revert until I can build on Windows and look into what is happening there. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313668 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-19ExecutionEngine: add R_AARCH64_ABS{16,32}Saleem Abdulrasool
Add support for the R_AARCH64_ABS{16,32} relocations in the execution engine. This is primarily used for DWARF debug information relocations and needed by the LLVM JIT to support JITing for lldb. Patch by Alex Langford! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313654 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-17[ORC] Hook up the LLVMOrcAddObjectFile function in the Orc C Bindings.Lang Hames
This can be used to add a relocatable object to the JIT session. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313474 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-15[ORC] Fix a typo.Lang Hames
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313346 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-05[ORC] Add a pair of ORC layers that forward object-layer operations via RPC.Lang Hames
This patch introduces RemoteObjectClientLayer and RemoteObjectServerLayer, which can be used to forward ORC object-layer operations from a JIT stack in the client to a JIT stack (consisting only of object-layers) in the server. This is a new way to support remote-JITing in LLVM. The previous approach (supported by OrcRemoteTargetClient and OrcRemoteTargetServer) used a remote-mapping memory manager that sat "beneath" the JIT stack and sent fully-relocated binary blobs to the server. The main advantage of the new approach is that relocatable objects can be cached on the server and re-used (if the code that they represent hasn't changed), whereas fully-relocated blobs can not (since the addresses they have been permanently bound to will change from run to run). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@312511 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-03[ORC] Add an Error return to the JITCompileCallbackManager::grow method.Lang Hames
Calling grow may result in an error if, for example, this is a callback manager for a remote target. We need to be able to return this error to the callee. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@312429 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-31[Orc] Add a comment about member variable dependencies to OrcMCJITReplacement.Lang Hames
The comment explains the reason behind the change in member variable order in r312086. Thanks to Philip Reames for the suggestion. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@312205 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-30[Orc] Fix member variable ordering issue in OrcMCJITReplacement.Lang Hames
https://reviews.llvm.org/D36888 From that review description: When an OrcMCJITReplacement object gets destructed, LazyEmitLayer may still contain a shared_ptr of a module, which requires ShouldDelete in the deleter. But ShouldDelete gets destructed before LazyEmitLayer due to the order of declaration in OrcMCJITReplacement, which leads to a crash, when the destructor of LazyEmitLayer is executed. Changing the order of declaration fixes this. Patch by Moritz Kroll. Thanks Moritz! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@312086 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-28Untabify.NAKAMURA Takumi
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311875 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-15[ORC] Add case statements for AArch64 to the local stub and callback managerLang Hames
creation functions. This should allow lli to lazily execute code using OrcLazyJIT on AArch64. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310938 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-11[cmake] Expose the dependencies of ExecutionEngine as PUBLICMichal Gorny
Expose the dependencies of LLVMExecutionEngine library as PUBLIC rather than PRIVATE when building a shared library. This is necessary because the library is not contained but exposes API of other LLVM libraries via its headers. This causes other libraries to fail to link if the linker verifies for correctness of -l flags (i.e. fails on indirect dependencies). This e.g. happens when building LLDB against shared LLVM: lib64/liblldbExpression.a(IRExecutionUnit.cpp.o):(.data.rel.ro._ZTIN4llvm18MCJITMemoryManagerE[_ZTIN4llvm18MCJITMemoryManagerE]+0x10): undefined reference to `typeinfo for llvm::RuntimeDyld::MemoryManager' lib64/liblldbExpression.a(IRExecutionUnit.cpp.o):(.data.rel.ro._ZTVN4llvm18MCJITMemoryManagerE[_ZTVN4llvm18MCJITMemoryManagerE]+0x60): undefined reference to `llvm::RuntimeDyld::MemoryManager::anchor()' lib64/liblldbExpression.a(IRExecutionUnit.cpp.o):(.data.rel.ro._ZTVN12lldb_private15IRExecutionUnit13MemoryManagerE[_ZTVN12lldb_private15IRExecutionUnit13MemoryManagerE]+0x48): undefined reference to `llvm::RTDyldMemoryManager::deregisterEHFrames()' lib64/liblldbExpression.a(IRExecutionUnit.cpp.o):(.data.rel.ro._ZTVN12lldb_private15IRExecutionUnit13MemoryManagerE[_ZTVN12lldb_private15IRExecutionUnit13MemoryManagerE]+0x60): undefined reference to `llvm::RuntimeDyld::MemoryManager::anchor()' lib64/liblldbExpression.a(IRExecutionUnit.cpp.o):(.data.rel.ro._ZTVN12lldb_private15IRExecutionUnit13MemoryManagerE[_ZTVN12lldb_private15IRExecutionUnit13MemoryManagerE]+0xd0): undefined reference to `llvm::JITSymbolResolver::anchor()' collect2: error: ld returned 1 exit status Declaring the dependencies as PUBLIC guarantees that any package using the ExecutionEngine library will also get explicit -l flags for the dependent libraries guaranteeing that the symbols exposed in headers could be resolved. Patch originally written by NAKAMURA Takumi. Differential Revision: https://reviews.llvm.org/D36211 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310712 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-09[RuntimeDyld][ORC] Add support for Thumb mode to RuntimeDyldMachOARM.Lang Hames
This patch adds support for thumb relocations to RuntimeDyldMachOARM, and adds a target-specific flags field to JITSymbolFlags (so that on ARM we can record whether each symbol is Thumb-mode code). RuntimeDyldImpl::emitSection is modified to ensure that stubs memory is correctly aligned based on the size returned by getStubAlignment(). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310517 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-03Delete Default and JITDefault code modelsRafael Espindola
IMHO it is an antipattern to have a enum value that is Default. At any given piece of code it is not clear if we have to handle Default or if has already been mapped to a concrete value. In this case in particular, only the target can do the mapping and it is nice to make sure it is always done. This deletes the two default enum values of CodeModel and uses an explicit Optional<CodeModel> when it is possible that it is unspecified. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309911 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-23RuntimeDyldELF.cpp: Prune unused "TargetRegistry.h"NAKAMURA Takumi
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308846 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-19Remove some leftover DWARFContextInMemory.Rafael Espindola
Not sure how I missed these on the previous commit. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308550 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-18[RuntimeDyld][MachO/ARM] Don't add a redundant relocation entry.Lang Hames
We only need to add this entry once for it to be fixed up. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308375 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-07[ORC] Errorize the ORC APIs.Lang Hames
This patch updates the ORC layers and utilities to return and propagate llvm::Errors where appropriate. This is necessary to allow ORC to safely handle error cases in cross-process and remote JITing. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307350 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-05DebugInfo: Generalize LoadedObjectInfoHelper from RuntimeDyldDavid Blaikie
Make it usable by any class derived (even indirectly) from LoadedObjectInfo by allowing a custom base class to be specified and perfect forwarding to the ctor. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307166 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-04[Orc] Remove the memory manager argument to addModule, and de-templatize theLang Hames
symbol resolver argument. De-templatizing the symbol resolver is part of the ongoing simplification of ORC layer API. Removing the memory management argument (and delegating construction of memory managers for RTDyldObjectLinkingLayer to a functor passed in to the constructor) allows us to build JITs whose base object layers need not be compatible with RTDyldObjectLinkingLayer's memory mangement scheme. For example, a 'remote object layer' that sends fully relocatable objects directly to the remote does not need a memory management scheme at all (that will be handled by the remote). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307058 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-29Attempt to fix Orc JIT test timeoutsReid Kleckner
I think there are some destruction ordering issues here. The ShouldDelete map seems to be getting destroyed before the shared_ptr deleter lambda accesses it. In any case, this avoids inserting elements into the map during shutdown. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306736 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-29Remove `inline` keyword from inline `classof` methodsSam Clegg
The style guide states that the explicit `inline` should not be used with inline methods. classof is very common inline method with a fair amount on inconsistency: $ git grep classof ./include | grep inline | wc -l 230 $ git grep classof ./include | grep -v inline | wc -l 257 I chose to target this method rather the larger change since this method is easily cargo-culted (I did it at least once). I considered doing the larger change and removing all occurrences but that would be a much larger change. Differential Revision: https://reviews.llvm.org/D33906 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306731 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-23[ORC] Re-apply r306166 and r306168 with fix for regression test.Lang Hames
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306182 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-23This reverts commit r306166 and r306168.Rafael Espindola
Revert "[ORC] Remove redundant semicolons from DEFINE_SIMPLE_CONVERSION_FUNCTIONS uses." Revert "[ORC] Move ORC IR layer interface from addModuleSet to addModule and fix the module type as std::shared_ptr<Module>." They broke ExecutionEngine/OrcMCJIT/test-global-ctors.ll on linux. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306176 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-23[ORC] Remove redundant semicolons from DEFINE_SIMPLE_CONVERSION_FUNCTIONS uses.Lang Hames
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306168 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-23[ORC] Move ORC IR layer interface from addModuleSet to addModule and fix theLang Hames
module type as std::shared_ptr<Module>. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306166 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-22[ORC] Switch the object layer API from addObjectSet to addObject (singular), andLang Hames
move the ObjectCache from the IRCompileLayer to SimpleCompiler. This is the first in a series of patches aimed at cleaning up and improving the robustness and performance of the ORC APIs. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306058 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-22Revert [mips] Adds support for R_MIPS_26, HIGHER, HIGHEST relocations in ↵Sagar Thakur
RuntimeDyld Reverting due to build bot failures git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306000 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-22[mips] Adds support for R_MIPS_26, HIGHER, HIGHEST relocations in RuntimeDyldSagar Thakur
After the N64 static relocation model support was added to llvm it is required to add its support in RuntimeDyld also because lldb uses ExecutionEngine for evaluating expressions. Reviewed by sdardis Differential: D31649 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305997 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-19[ExecutionEngine] Fix some Clang-tidy modernize-use-using and Include What ↵Eugene Zelenko
You Use warnings; other minor fixes (NFC). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305760 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-07Move Object format code to lib/BinaryFormat.Zachary Turner
This creates a new library called BinaryFormat that has all of the headers from llvm/Support containing structure and layout definitions for various types of binary formats like dwarf, coff, elf, etc as well as the code for identifying a file from its magic. Differential Revision: https://reviews.llvm.org/D33843 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@304864 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-06Sort the remaining #include lines in include/... and lib/....Chandler Carruth
I did this a long time ago with a janky python script, but now clang-format has built-in support for this. I fed clang-format every line with a #include and let it re-sort things according to the precise LLVM rules for include ordering baked into clang-format these days. I've reverted a number of files where the results of sorting includes isn't healthy. Either places where we have legacy code relying on particular include ordering (where possible, I'll fix these separately) or where we have particular formatting around #include lines that I didn't want to disturb in this patch. This patch is *entirely* mechanical. If you get merge conflicts or anything, just ignore the changes in this patch and run clang-format over your #include lines in the files. Sorry for any noise here, but it is important to keep these things stable. I was seeing an increasing number of patches with irrelevant re-ordering of #include lines because clang-format was used. This patch at least isolates that churn, makes it easy to skip when resolving conflicts, and gets us to a clean baseline (again). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@304787 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-23[RuntimeDyld, PowerPC] Fix regression from r303637Ulrich Weigand
Actually, to identify external symbols, we need to check for *either* non-null Value.SymbolName *or* a SymType of Symbol::ST_Unknown. The former may happen for symbols not known to the JIT at all (e.g. defined in a native library), while the latter happens for symbols known to the JIT, but defined in a different module. Fixed several regressions on big-endian ppc64. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303655 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-23[RuntimeDyld, PowerPC] Fix check for external symbols when detecting ↵Ulrich Weigand
reloction overflow The PowerPC part of processRelocationRef currently assumes that external symbols can be identified by checking for SymType == SymbolRef::ST_Unknown. This is actually incorrect in some cases, causing relocation overflows to be mis-detected. The correct check is to test whether Value.SymbolName is null. Includes test case. Note that it is a bit tricky to replicate the exact condition that triggers the bug in a test case. The one included here seems to fail reliably (before the fix) across different operating system versions on Power, but it still makes a few assumptions (called out in the test case comments). Also add ppc64le platform name to the supported list in the lit.local.cfg files for the MCJIT and OrcMCJIT directories, since those tests were currently not run at all. Fixes PR32650. Reviewer: hfinkel Differential Revision: https://reviews.llvm.org/D33402 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303637 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-23[RuntimeDyld, PowerPC] Fix relocation detection overflowUlrich Weigand
Code in RuntimeDyldELF currently uses 32-bit temporaries to detect whether a PPC64 relocation target is out of range. This is incorrect, and can mis-detect overflow where the distance between relocation site and target is close to a multiple of 4GB. Fixed by using 64-bit temporaries. Noticed while debugging PR32650. Reviewer: hfinkel Differential Revision: https://reviews.llvm.org/D33403 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303632 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-17[RuntimeDyld] Fix debug section relocation (pr20457)Pavel Labath
Summary: Debug info sections, (or non-SHF_ALLOC sections in general) should be linked as if their load address was zero to emulate the behavior of the static linker. This bug was discovered because it was breaking lldb expression evaluation on linux. Reviewers: lhames Subscribers: aprantl, eugene, clayborg, lldb-commits, llvm-commits Differential Revision: https://reviews.llvm.org/D32899 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303239 91177308-0d34-0410-b5e6-96231b3b80d8