summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ExecutionEngine
Commit message (Collapse)AuthorAgeFilesLines
...
* Reverted r361134 because of a failing test left unattended for a long time.Galina Kistanova2019-05-221-6/+8
| | | | | | | | http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/17792/steps/test-check-all/logs/stdio Failing Tests (1): LLVM :: CodeGen/AMDGPU/regbank-reassign.mir llvm-svn: 361430
* Disable EHFrameSupport in JITLink/RuntimeDyld on AIXXing Xue2019-05-222-3/+5
| | | | | | | | | | | | | | | | | | | Summary: EH Frames aren't supported on AIX with the system compiler, but the definition of HAVE_EHTABLE_SUPPORT misses this which causes linking problems on AIX. This patch updates the definition of HAVE_EHTABLE_SUPPORT in both JITLink and RuntimeDyld. Author: daltenty Reviewers: sfertile, xingxue, hubert.reinterpretcase Reviewed By: xingxue Subscribers: hiraditya, jsji, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D62203 llvm-svn: 361410
* [ORC] Assert that JITDylibs have unique names.Lang Hames2019-05-211-0/+10
| | | | | | | | Patch by Praveen Velliengiri. Thanks Praveen! Differential Revision: https://reviews.llvm.org/D62139 llvm-svn: 361215
* [ORC] fix use-after-move. NFCNick Desaulniers2019-05-201-6/+4
| | | | | | | | | | | | | | | | | | | Summary: scan-build flagged a potential use-after-move in debug builds. It's not safe that a moved from value contains anything but garbage. Manually DRY up these repeated expressions. Reviewers: lhames Reviewed By: lhames Subscribers: hiraditya, llvm-commits, srhines Tags: #llvm Differential Revision: https://reviews.llvm.org/D62112 llvm-svn: 361203
* [ORC] Remove some unreachable code.Lang Hames2019-05-201-4/+1
| | | | | | Fixes http://llvm.org/PR41662. llvm-svn: 361199
* [Support] Renamed member 'Size' to 'AllocatedSize' in MemoryBlock and ↵Lang Hames2019-05-202-18/+18
| | | | | | | | | | | | | | | OwningMemoryBlock. Rename member 'Size' to 'AllocatedSize' in order to provide a hint that the allocated size may be different than the requested size. Comments are added to clarify this point. Updated the InMemoryBuffer in FileOutputBuffer.cpp to track the requested buffer size. Patch by Machiel van Hooren. Thanks Machiel! https://reviews.llvm.org/D61599 llvm-svn: 361195
* Use llvm::sort. NFCFangrui Song2019-05-201-8/+6
| | | | llvm-svn: 361134
* [ORC] Change handling for SymbolStringPtr tombstones and empty keys.Lang Hames2019-05-161-2/+0
| | | | | | | | | | | | | | SymbolStringPtr used to use nullptr as its empty value and (since it performed ref-count operations on any non-nullptr) a pointer to a special pool-entry instance as its tombstone. This commit changes the scheme to use two invalid pointer values as the empty and tombstone values, and broadens the ref-count guard to prevent ref-counting operations from being performed on these pointers. This should improve the performance of SymbolStringPtrs used in DenseMaps/DenseSets, as ref counting operations will no longer be performed on the tombstone. llvm-svn: 360925
* Recommit [Object] Change object::SectionRef::getContents() to return ↵Fangrui Song2019-05-162-7/+9
| | | | | | | | | | | | Expected<StringRef> r360876 didn't fix 2 call sites in clang. Expected<ArrayRef<uint8_t>> may be better but use Expected<StringRef> for now. Follow-up of D61781. llvm-svn: 360892
* Revert r360876 "[Object] Change object::SectionRef::getContents() to return ↵Hans Wennborg2019-05-162-9/+7
| | | | | | | | | | | | Expected<StringRef>" It broke the Clang build, see llvm-commits thread. > Expected<ArrayRef<uint8_t>> may be better but use Expected<StringRef> for now. > > Follow-up of D61781. llvm-svn: 360878
* [Object] Change object::SectionRef::getContents() to return Expected<StringRef>Fangrui Song2019-05-162-7/+9
| | | | | | | | Expected<ArrayRef<uint8_t>> may be better but use Expected<StringRef> for now. Follow-up of D61781. llvm-svn: 360876
* [JITLink][MachO] Use getSymbol64TableEntry for 64-bit MachO files.Lang Hames2019-05-161-1/+1
| | | | | | | Fixes a think-o. No test case: The nlist and nlist64 data structures happen to line up for this field, so there's no way to construct a failing test case. llvm-svn: 360830
* [JITLink][MachO] Honor the no-dead-strip flag on nlist entries.Lang Hames2019-05-131-1/+8
| | | | llvm-svn: 360618
* [JITLink] Track section alignment and make sure it is respected during layout.Lang Hames2019-05-134-11/+43
| | | | | | | Previously we had only honored alignments on individual atoms, but tools/runtimes may assume that the section alignment is respected too. llvm-svn: 360555
* [JITLink] Add a test for zero-filled content.Lang Hames2019-05-122-12/+26
| | | | | | | | Also updates RuntimeDyldChecker and llvm-rtdyld to support zero-fill tests by returning a content address of zero (but no error) for zero-fill atoms, and treating loads from zero as returning zero. llvm-svn: 360547
* [ORC] Make a narrowing-cast explicit to silence a compiler warning.Lang Hames2019-05-101-1/+1
| | | | llvm-svn: 360478
* [JITLink][MachO] Mark atoms in sections 'no-dead-strip' set live by default.Lang Hames2019-05-102-36/+66
| | | | | | | | If a MachO section has the no-dead-strip attribute set then its atoms should be preserved, regardless of whether they're public or referenced elsewhere in the object. llvm-svn: 360477
* [JITLink] Fixed a signedness bug when processing X86_64_RELOC_SUBTRACTOR.Lang Hames2019-05-091-2/+2
| | | | | | | | Subtractor relocation addends are signed, so we need to read them via signed int pointers. Accidentally treating 32-bit addends as unsigned leads to out-of-range errors when we try to add very large (>INT32_MAX) bogus addends. llvm-svn: 360392
* [ORC] Simplify logic for updating edges when should-discard atoms are pruned.Lang Hames2019-05-091-16/+4
| | | | llvm-svn: 360384
* [JITLink] Improve/fix some JITLink debugging output.Lang Hames2019-05-092-9/+11
| | | | | | | | Adds full edge details (rather than just edge targets) when out-of-range errors are generated. Also fixes a bug where debugging output accessed an invalidated DenseMap iterator by moving the debugging output above the invalidation point. llvm-svn: 360383
* [ORC] Fix a formatting bug.Lang Hames2019-05-091-1/+1
| | | | llvm-svn: 360382
* Fix LLVM_USE_PERF build after getPageSize changeSven van Haastregt2019-05-091-3/+3
| | | | | | | | Commit r360221 ("[Support] Add error handling to sys::Process::getPageSize().", 2019-05-08) seems to have missed these uses of getPageSize(). Update them to getPageSizeEstimate(). llvm-svn: 360322
* [Support] Add error handling to sys::Process::getPageSize().Lang Hames2019-05-083-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch changes the return type of sys::Process::getPageSize to Expected<unsigned> to account for the fact that the underlying syscalls used to obtain the page size may fail (see below). For clients who use the page size as an optimization only this patch adds a new method, getPageSizeEstimate, which calls through to getPageSize but discards any error returned and substitues a "reasonable" page size estimate estimate instead. All existing LLVM clients are updated to call getPageSizeEstimate rather than getPageSize. On Unix, sys::Process::getPageSize is implemented in terms of getpagesize or sysconf, depending on which macros are set. The sysconf call is documented to return -1 on failure. On Darwin getpagesize is implemented in terms of sysconf and may also fail (though the manpage documentation does not mention this). These failures have been observed in practice when highly restrictive sandbox permissions have been applied. Without this patch, the result is that getPageSize returns -1, which wreaks havoc on any subsequent code that was assuming a sane page size value. <rdar://problem/41654857> Reviewers: dblaikie, echristo Subscribers: kristina, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D59107 llvm-svn: 360221
* Reapply r360194 "[JITLink] Add support for MachO .alt_entry atoms." with fixes.Lang Hames2019-05-074-29/+128
| | | | | | | | | This patch modifies MachOAtomGraphBuilder to use setLayoutNext rather than addEdge, and fixes a bug in the section layout algorithm that could result in atoms appearing more than once in the section ordering (which resulted in those atoms being assigned invalid addresses during layout). llvm-svn: 360205
* Revert r360194 "[JITLink] Add support for MachO .alt_entry atoms."Lang Hames2019-05-073-110/+11
| | | | | | The testcase is asserting on some bots - reverting while I investigate. llvm-svn: 360200
* [JITLink] Add support for MachO .alt_entry atoms.Lang Hames2019-05-073-11/+110
| | | | | | | | | | | | | | | | The MachO .alt_entry directive is applied to a symbol to indicate that it is locked (in terms of address layout and liveness) to its predecessor atom. I.e. it is an alternate entry point, at a fixed offset, for the previous atom. This patch updates MachOAtomGraphBuilder to check for the .alt_entry flag on symbols and add a corresponding LayoutNext edge to the atom-graph. It also updates MachOAtomGraphBuilder_x86_64 to generalize handling of the X86_64_RELOC_SUBTRACTOR relocation: previously either the minuend or subtrahend of the subtraction had to be the same as the atom being fixed up, now it is only necessary for the minuend or subtrahend to be locked (via any chain of alt_entry directives) to the atom being fixed up. llvm-svn: 360194
* [JITLink] Add two useful Section operations: find by name, get address range.Lang Hames2019-05-041-9/+2
| | | | | | | | These operations were already used in eh-frame registration, and are likely to be used in other runtime registrations, so this commit moves them into a header where they can be re-used. llvm-svn: 359950
* [ORC] Pass object buffer ownership back in NotifyEmitted.Lang Hames2019-05-011-19/+18
| | | | | | | | | | Clients who want to regain ownership of object buffers after they have been linked may now use the NotifyEmitted callback for this purpose. Note: Currently NotifyEmitted is only called if linking succeeds. If linking fails the buffer is always discarded. llvm-svn: 359735
* [JITLink] Make sure we explicitly deallocate memory on failure.Lang Hames2019-05-012-4/+11
| | | | | | | | | | | | JITLinkGeneric phases 2 and 3 (focused on applying fixups and finalizing memory, respectively) may fail for various reasons. If this happens, we need to explicitly de-allocate the memory allocated in phase 1 (explicitly, because deallocation may also fail and so is implemented as a method returning error). No testcase yet: I am still trying to decide on the right way to test totally platform agnostic code like this. llvm-svn: 359643
* [ORC] Move SimpleCompiler/ConcurrentIRCompiler definitions into a .cpp file.Lang Hames2019-04-302-0/+87
| | | | | | | SimpleCompiler is no longer templated, so there's no reason for this code to be in a header any more. llvm-svn: 359626
* [JITLink] Add debugging output to print resolved external atoms.Lang Hames2019-04-301-0/+6
| | | | llvm-svn: 359614
* [ORC][JITLink] Name in-memory compiled objects after their source modules.Lang Hames2019-04-301-1/+2
| | | | | | | | In-memory compiled object buffer identifiers will now be derived from the identifiers of their source IR modules. This makes it easier to connect in-memory objects with their source modules in debugging output. llvm-svn: 359613
* [ORC] Allow JITDylib definition generators to return Errors.Lang Hames2019-04-302-58/+94
| | | | | | | | | | | | | | | | | | | | Background: A definition generator can be attached to a JITDylib to generate new definitions in response to queries. For example: a generator that forwards calls to dlsym can map symbols from a dynamic library into the JIT process on demand. If definition generation fails then the generator should be able to return an error. This allows the JIT API to distinguish between the case where a generator does not provide a definition, and the case where it was not able to determine whether it provided a definition due to an error. The immediate motivation for this is cross-process symbol lookups: If the remote-lookup generator is attached to a JITDylib early in the search list, and if a generator failure is misinterpreted as "no definition in this JITDylib" then lookup may continue and bind to a different definition in a later JITDylib, which is a bug. llvm-svn: 359521
* [ORC] Replace the LLJIT/LLLazyJIT Create methods with Builder utilities.Lang Hames2019-04-291-105/+131
| | | | | | | | | | | LLJITBuilder and LLLazyJITBuilder construct LLJIT and LLLazyJIT instances respectively. Over time these will allow more configurable options to be added while remaining easy to use in the default case, which for default in-process JITing is now: auto J = ExitOnErr(LLJITBuilder.create()); llvm-svn: 359511
* [ORC] Add a 'plugin' interface to ObjectLinkingLayer for events/configuration.Lang Hames2019-04-262-51/+153
| | | | | | | | | | | | | ObjectLinkingLayer::Plugin provides event notifications when objects are loaded, emitted, and removed. It also provides a modifyPassConfig callback that allows plugins to modify the JITLink pass configuration. This patch moves eh-frame registration into its own plugin, and teaches llvm-jitlink to only add that plugin when performing execution runs on non-Windows platforms. This should allow us to re-enable the test case that was removed in r359198. llvm-svn: 359357
* [ORC] Remove symbols from dependency lists when failing materialization.Lang Hames2019-04-251-2/+29
| | | | | | | | | When failing materialization of a symbol X, remove X from the dependants list of any of X's dependencies. This ensures that when X's dependencies are emitted (or fail themselves) they do not try to access the no-longer-existing MaterializationInfo for X. llvm-svn: 359252
* [JITLink] Refer to FDE's CIE (not the most recent CIE) when parsing eh-frame.Lang Hames2019-04-242-13/+27
| | | | | | | | | | | | | | | Frame Descriptor Entries (FDEs) have a pointer back to a Common Information Entry (CIE) that describes how the rest FDE should be parsed. JITLink had been assuming that FDEs always referred to the most recent CIE encountered, but the spec allows them to point back to any previously encountered CIE. This patch fixes JITLink to look up the correct CIE for the FDE. The testcase is a MachO binary with an FDE that refers to a CIE that is not the one immediately proceeding it (the layout can be viewed wit 'dwarfdump --eh-frame <testcase>'. This test case had to be a binary as llvm-mc now sorts FDEs (as of r356216) to ensure FDEs *do* point to the most recent CIE. llvm-svn: 359105
* Fix MSVC "32-bit shift implicitly converted to 64 bits" warning. NFCI.Simon Pilgrim2019-04-231-2/+2
| | | | llvm-svn: 358970
* [JITLink] Remove a lot of reduntant 'JITLink_' prefixes. NFC.Lang Hames2019-04-228-18/+22
| | | | llvm-svn: 358869
* [JITLink] Fix section start address calculation in eh-frame recorder.Lang Hames2019-04-221-0/+3
| | | | | | | | | | Section atoms are not sorted, so we need to scan the whole section to find the start address. No test case: Found by inspection, and any reproduction would depend on pointer ordering. llvm-svn: 358865
* [JITLink] Remove an overly strict error check in JITLink's eh-frame parser.Lang Hames2019-04-212-13/+4
| | | | | | | | The error check required FDEs to refer to the most recent CIE, but the eh-frame spec allows them to refer to any previously seen CIE. This patch removes the offending check. llvm-svn: 358840
* [JITLink] Factor basic common GOT and stub creation code into its own class.Lang Hames2019-04-212-72/+130
| | | | llvm-svn: 358838
* [JITLink] Add yet more detail to MachO/x86-64 unsupported relocation errors.Lang Hames2019-04-201-1/+4
| | | | | | | | Knowing the address/symbolnum field values makes it easier to identify the unsupported relocation, and provides enough information for the full bit pattern of the relocation to be reconstructed. llvm-svn: 358833
* [JITLink][ORC] Add JITLink to the list of dependencies for ORC.Lang Hames2019-04-201-1/+2
| | | | | | | | | The new ObjectLinkingLayer in ORC depends on JITLink. This should fix the build error at http://lab.llvm.org:8011/builders/clang-ppc64le-linux-multistage/builds/9621 llvm-svn: 358832
* [JITLink] Fix a bad formatv format string.Lang Hames2019-04-201-1/+1
| | | | llvm-svn: 358831
* [JITLink] Add BinaryFormat to JITLink's dependencies.Lang Hames2019-04-201-1/+1
| | | | | | | | | Hopefully this will fix the missing dependence on llvm::identify_magic that is showing up on some PPC bots. E.g. http://lab.llvm.org:8011/builders/clang-ppc64le-linux-multistage/builds/9617 llvm-svn: 358827
* [JITLink] Add more detail to MachO/x86-64 "unsupported relocation" errors.Lang Hames2019-04-201-1/+5
| | | | | | | The extra information here will be helpful in diagnosing errors, like the ones currently occuring on the PPC big-endian bots. :) llvm-svn: 358826
* [JITLink] Silence some MSVC implicit cast warnings.Lang Hames2019-04-201-2/+3
| | | | llvm-svn: 358824
* [JITLink] Use memset instead of bzero.Lang Hames2019-04-201-2/+2
| | | | llvm-svn: 358822
* [JITLink] Fix a missing header and bad prototype.Lang Hames2019-04-201-1/+2
| | | | llvm-svn: 358819
OpenPOWER on IntegriCloud