summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ExecutionEngine
Commit message (Collapse)AuthorAgeFilesLines
* [MCJIT] Don't crash in debugging output for sections that aren't emitted.Lang Hames2014-10-011-0/+5
| | | | llvm-svn: 218836
* [MCJIT] Turn the getSymbolAddress free function created in r218626 into a staticLang Hames2014-10-011-1/+2
| | | | | | | | | | | member of RTDyldMemoryManager (and rename to getSymbolAddressInProcess). The functionality this provides is very specific to RTDyldMemoryManager, so it makes sense to keep it in that class to avoid accidental re-use. No functional change. llvm-svn: 218741
* Unit test r218187, changing RTDyldMemoryManager::getSymbolAddress's behavior ↵David Blaikie2014-09-291-1/+1
| | | | | | | | | | | favor mangled lookup over unmangled lookup. The contract of this function seems problematic (fallback in either direction seems like it could produce bugs in one client or another), but here's some tests for its current behavior, at least. See the commit/review thread of r218187 for more discussion. llvm-svn: 218626
* [MCJIT] Fix some more RuntimeDyld debugging output format specifiers.Lang Hames2014-09-231-3/+3
| | | | llvm-svn: 218328
* [MCJIT] Remove a few more references to JITMemoryManager that survived r218316.Lang Hames2014-09-231-1/+0
| | | | llvm-svn: 218318
* [MCJIT] Remove #include of JITMemoryManager that accidentally survived r218316.Lang Hames2014-09-231-1/+0
| | | | llvm-svn: 218317
* [MCJIT] Delete the JTIMemoryManager and associated APIs.Lang Hames2014-09-233-907/+4
| | | | | | | | | | This patch removes the old JIT memory manager (which does not provide any useful functionality now that the old JIT is gone), and migrates the few remaining clients over to SectionMemoryManager. http://llvm.org/PR20848 llvm-svn: 218316
* Remove redundant if test.Lang Hames2014-09-211-4/+1
| | | | llvm-svn: 218220
* RTDyldMemoryManager::getSymbolAddress(): Make sure to return 0 if symbol ↵NAKAMURA Takumi2014-09-201-0/+2
| | | | | | name is not met. [-Wreturn-type] llvm-svn: 218195
* [MCJIT] Make RTDyldMemoryManager::getSymbolAddress's behaviour more consistent.Lang Hames2014-09-202-15/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch modifies RTDyldMemoryManager::getSymbolAddress(Name)'s behavior to make it consistent with how clients are using it: Name should be mangled, and getSymbolAddress should demangle it on the caller's behalf before looking the name up in the process. This patch also fixes the one client (MCJIT::getPointerToFunction) that had been passing unmangled names (by having it pass mangled names instead). Background: RTDyldMemoryManager::getSymbolAddress(Name) has always used a re-try mechanism when looking up symbol names in the current process. Prior to this patch getSymbolAddress first tried to look up 'Name' exactly as the user passed it in and then, if that failed, tried to demangle 'Name' and re-try the look up. The implication of this behavior is that getSymbolAddress expected to be called with unmangled names, and that handling mangled names was a fallback for convenience. This is inconsistent with how clients (particularly the RuntimeDyldImpl subclasses, but also MCJIT) usually use this API. Most clients pass in mangled names, and succeed only because of the fallback case. For clients passing in mangled names, getSymbolAddress's old behavior was actually dangerous, as it could cause unmangled names in the process to shadow mangled names being looked up. For example, consider: foo.c: int _x = 7; int x() { return _x; } foo.o: 000000000000000c D __x 0000000000000000 T _x If foo.c becomes part of the process (E.g. via dlopen("libfoo.dylib")) it will add symbols 'x' (the function) and '_x' (the variable) to the process. However jit clients looking for the function 'x' will be using the mangled function name '_x' (note how function 'x' appears in foo.o). When getSymbolAddress goes looking for '_x' it will find the variable instead, and return its address and in place of the function, leading to JIT'd code calling the variable and crashing (if we're lucky). By requiring that getSymbolAddress be called with mangled names, and demangling only when we're about to do a lookup in the process, the new behavior implemented in this patch should eliminate any chance of names being shadowed during lookup. There's no good way to test this at the moment: This issue only arrises when looking up process symbols (not JIT'd symbols). Any test case would have to generate a platform-appropriate dylib to pass to llvm-rtdyld, and I'm not aware of any in-tree tool for doing this in a portable way. llvm-svn: 218187
* Converting the JITDebugLock mutex to a ManagedStatic to avoid the static ↵Chris Bieneman2014-09-191-4/+4
| | | | | | constructor and destructor. llvm-svn: 218154
* Converting FuncNames to a ManagedStatic to avoid static constructors and ↵Chris Bieneman2014-09-191-14/+14
| | | | | | destructors. llvm-svn: 218151
* [MCJIT] Fix a debugging-output formatting bug in RuntimeDyld.Lang Hames2014-09-181-1/+1
| | | | | | | The mismatched mask (7 vs (ColsPerRow-1)) could lead to partial lines being printed out of place. llvm-svn: 218061
* Add a missing return to operator=Reid Kleckner2014-09-161-0/+1
| | | | llvm-svn: 217889
* Fix move-only type issues in Interpreter with MSVCReid Kleckner2014-09-161-12/+24
| | | | | | | | | MSVC 2012 cannot infer any move special members, but it will call them if available. MSVC 2013 cannot infer move assignment. Therefore, explicitly implement the special members for the ExecutionContext class and its contained types. llvm-svn: 217887
* Spell out a move ctor. Even the 2013 vintage of MSVC cannot synthesize move ↵Benjamin Kramer2014-09-161-1/+1
| | | | | | ctors. llvm-svn: 217879
* Interpreter: Hack around a series of bugs in MSVC 2012 that copies around thisBenjamin Kramer2014-09-161-3/+9
| | | | | | | | move-only struct. I feel terrible now, but at least it's shielded away from proper compilers. llvm-svn: 217875
* Add return that was lost somehow in my last commit.Benjamin Kramer2014-09-151-0/+1
| | | | llvm-svn: 217810
* Remove ancient hack that was emulating move semantics with reference counting.Benjamin Kramer2014-09-151-20/+13
| | | | | | No functionality change. llvm-svn: 217808
* [MCJIT] Start Stringref-izing the ExecutionEngine interface.Lang Hames2014-09-153-4/+3
| | | | | | | | | More methods to follow. Using StringRef allows us the EE interface to work with more string types without forcing construction of std::strings. llvm-svn: 217794
* [MCJIT] Improve the "stub not found" diagnostic in RuntimeDyldChecker.Lang Hames2014-09-111-1/+4
| | | | | | | | | | | | | A "stub found found" diagnostic is emitted when RuntimeDyldChecker's stub lookup logic fails to find the requested stub. The obvious reason for the failure is that no such stub has been created, but it can also fail for internal symbols if the symbol offset is not computed correctly (E.g. due to a mangled relocation addend). This patch adds a comment about the latter case so that it's not overlooked. Inspired by confusion experienced during test case construction for r217635. llvm-svn: 217643
* [MCJIT] Add support for ARM HALF_DIFF relocations to MCJIT.Lang Hames2014-09-114-58/+183
| | | | | | Fixes <rdar://problem/18297804>. llvm-svn: 217620
* [MCJIT] Take the relocation addend into account when applying ARM MachO VANILLALang Hames2014-09-111-1/+2
| | | | | | | | and BR24 relocations. <rdar://problem/18296496> llvm-svn: 217605
* Add doInitialization/doFinalization to DataLayoutPass.Rafael Espindola2014-09-101-1/+1
| | | | | | | | | | | | | With this a DataLayoutPass can be reused for multiple modules. Once we have doInitialization/doFinalization, it doesn't seem necessary to pass a Module to the constructor. Overall this change seems in line with the idea of making DataLayout a required part of Module. With it the only way of having a DataLayout used is to add it to the Module. llvm-svn: 217548
* [MCJIT] Remove redundant architecture check from RuntimeDyldMachOI386.Lang Hames2014-09-101-1/+1
| | | | llvm-svn: 217470
* [MCJIT] Revert partial RuntimeDyldELF cleanup that was prematurely committed inLang Hames2014-09-071-3/+3
| | | | | | r217328. llvm-svn: 217329
* [MCJIT] Rewrite RuntimeDyldMachO and its derived classes to use the 'Offset'Lang Hames2014-09-077-18/+18
| | | | | | | | | | field of RelocationValueRef, rather than the 'Addend' field. This is consistent with RuntimeDyldELF's use of RelocationValueRef, and more consistent with the semantics of the data being stored (the offset from the start of a section or symbol). llvm-svn: 217328
* [MCJIT] Fix a bug RuntimeDyldImpl's read/writeBytesUnaligned methods.Lang Hames2014-09-071-19/+17
| | | | | | | | | The previous implementation was writing to the high-bytes of integers on BE targets (when run on LE hosts). http://llvm.org/PR20640 llvm-svn: 217325
* [MCJIT] Fix an iterator invalidation bug in MCJIT::finalizeObject.Lang Hames2014-09-052-5/+10
| | | | | | | | | | | The finalizeObject method calls generateCodeForModule on each of the currently 'added' objects, but generateCodeForModule moves objects out of the 'added' set as it's called. To avoid iterator invalidation issues, the added set is copied out before any calls to generateCodeForModule. This should fix http://llvm.org/PR20851 . llvm-svn: 217291
* [MCJIT] Const-ify the symbol lookup operations on RuntimeDyld.Lang Hames2014-09-052-6/+6
| | | | llvm-svn: 217263
* Fix use-after-move introduced in r217065 and caught in post-commit review by ↵David Blaikie2014-09-041-2/+2
| | | | | | Alexey. llvm-svn: 217181
* unique_ptrify RuntimeDyld::DyldDavid Blaikie2014-09-041-7/+7
| | | | llvm-svn: 217180
* build/cmake: Fix CMP0023 warning with libffiJan Vesely2014-09-041-1/+1
| | | | | | | | | | | | | | | | | | | | Fixes: CMake Warning (dev) at lib/ExecutionEngine/Interpreter/CMakeLists.txt:16 (target_link_libraries): Policy CMP0023 is not set: Plain and keyword target_link_libraries signatures cannot be mixed. Run "cmake --help-policy CMP0023" for policy details. Use the cmake_policy command to set the policy and suppress this warning. The keyword signature for target_link_libraries has already been used with the target "LLVMInterpreter". All uses of target_link_libraries with a target should be either all-keyword or all-plain. The uses of the keyword signature are here: * cmake/modules/AddLLVM.cmake:345 (target_link_libraries) Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> llvm-svn: 217154
* [MCJIT] Make sure eh-frame fixups use the target's pointer type, not the host's.Lang Hames2014-09-046-39/+63
| | | | | | | If the wrong pointer type is used it can cause corruption of the frame description entries. llvm-svn: 217124
* [MCJIT] Add command-line argument to llvm-rtdyld to specify target addresses forLang Hames2014-09-043-0/+19
| | | | | | | | | sections. This allows fine-grained control of the memory layout of hypothetical target processes for testing purposes. llvm-svn: 217122
* unique_ptrify RuntimeDyldImpl::loadObjectDavid Blaikie2014-09-032-8/+7
| | | | | | | | | | I'm not sure this is a particularly helpful API (to pass ownership and then return it unconditionally) rather than just pass the underlying object by non-const reference, but this was the original API so I'll just make it more safe/stable and anyone else is free to adjust that at their whim, of course. llvm-svn: 217081
* [JIT] Add an out-of-line definition for the virtual destructor inChandler Carruth2014-09-032-0/+16
| | | | | | | JITEventListener. This used to be in the old JIT (last line of the file) and everyone just "happened" to pick it up from there. =/ Doh. llvm-svn: 217073
* unique_ptrify MCJIT::emitObjectDavid Blaikie2014-09-032-5/+5
| | | | llvm-svn: 217067
* unique_ptrify a bunch of stuff through RuntimeDyld::loadObjectDavid Blaikie2014-09-037-58/+59
| | | | llvm-svn: 217065
* Add override to overriden virtual methods, remove virtual keywords.Benjamin Kramer2014-09-035-5/+6
| | | | | | No functionality change. Changes made by clang-tidy + some manual cleanup. llvm-svn: 217028
* [MCJIT] Make llvm-rtdyld process eh_frame sections in -verify mode (accidentallyLang Hames2014-09-031-1/+0
| | | | | | | | left out of r217010). Also remove a crufty debugging output statement that was accidentally left in. llvm-svn: 217011
* [MCJIT] Add a 'section_addr' builtin function to RuntimeDyldChecker.Lang Hames2014-09-033-25/+141
| | | | | | | | | | The syntax of the new builtin is 'section_addr(<filename>, <section-name>)' (similar to the stub_addr builtin, but without a symbol name). It returns the base address of the given section in the given object file. This builtin makes it possible to refer to the contents of sections that cannot contain symbols, e.g. sections added by the linker itself, like __eh_frame. llvm-svn: 217010
* unique_ptrify passing the TargetMachine to ExecutionEngine::MCJITCtorDavid Blaikie2014-09-023-16/+12
| | | | llvm-svn: 216988
* Reinstate "Nuke the old JIT."Eric Christopher2014-09-0217-2293/+12
| | | | | | | | Approved by Jim Grosbach, Lang Hames, Rafael Espindola. This reinstates commits r215111, 215115, 215116, 215117, 215136. llvm-svn: 216982
* [MCJIT] Move endian-aware read/writes from RuntimeDyldMachO intoLang Hames2014-08-298-57/+46
| | | | | | | | | RuntimeDyldImpl. These are platform independent, and moving them to the base class allows RuntimeDyldChecker to use them too. llvm-svn: 216801
* Fix typos in comments, NFCRobin Morisset2014-08-291-1/+1
| | | | | | | | | | | | | | Summary: Just fixing comments, no functional change. Test Plan: N/A Reviewers: jfb Subscribers: mcrosier, llvm-commits Differential Revision: http://reviews.llvm.org/D5130 llvm-svn: 216784
* [MCJIT] Fix format specifiers for debug output in RuntimeDyld.Lang Hames2014-08-282-3/+3
| | | | | | More work on http://llvm.org/PR20640 llvm-svn: 216648
* Fix unaligned reads/writes in X86JIT and RuntimeDyldELF.Alexey Samsonov2014-08-271-26/+22
| | | | | | | | | | | | | | | | Summary: Introduce support::ulittleX_t::ref type to Support/Endian.h and use it in x86 JIT to enforce correct endianness and fix unaligned accesses. Test Plan: regression test suite Reviewers: lhames Subscribers: ributzka, llvm-commits Differential Revision: http://reviews.llvm.org/D5011 llvm-svn: 216631
* [MCJIT] Replace a C-style cast in RuntimeDyldImpl.h.Lang Hames2014-08-271-1/+1
| | | | llvm-svn: 216568
* [MCJIT] More endianness fixes for RuntimeDyldMachO.Lang Hames2014-08-272-12/+28
| | | | | | http://llvm.org/PR20640 llvm-svn: 216567
OpenPOWER on IntegriCloud