2497 Commits

Author SHA1 Message Date
Lang Hames
52668f961e [ORC] Suppress an ORCv1 deprecation warning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366485 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-18 19:55:42 +00:00
Lang Hames
19f0f50d66 [ORC] Add deprecation warnings to ORCv1 layers and utilities.
Summary:
ORCv1 is deprecated. The current aim is to remove it before the LLVM 10.0
release. This patch adds deprecation attributes to the ORCv1 layers and
utilities to warn clients of the change.

Reviewers: dblaikie, sgraenitz, AlexDenisov

Subscribers: llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D64609

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366344 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-17 16:40:52 +00:00
Lang Hames
1193b207a6 [ORC] Add custom IR compiler configuration to LLJITBuilder to enable obj caches.
LLJITBuilder now has a setCompileFunctionCreator method which can be used to
construct a CompileFunction for the LLJIT instance being created. The motivating
use-case for this is supporting ObjectCaches, which can now be set up at
compile-function construction time. To demonstrate this an example project,
LLJITWithObjectCache, is included.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@365671 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-10 17:24:24 +00:00
Lang Hames
55280dd6d4 [JITLink][ORC] Add EHFrameRegistrar interface, use in EHFrameRegistrationPlugin.
Replaces direct calls to eh-frame registration with calls to methods on an
EHFrameRegistrar instance. This allows clients to substitute a registrar that
registers frames in a remote process via IPC/RPC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@365098 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-04 00:05:12 +00:00
Erik Pilkington
6012b27129 [C++2a] Add __builtin_bit_cast, used to implement std::bit_cast
This commit adds a new builtin, __builtin_bit_cast(T, v), which performs a
bit_cast from a value v to a type T. This expression can be evaluated at
compile time under specific circumstances.

The compile time evaluation currently doesn't support bit-fields, but I'm
planning on fixing this in a follow up (some of the logic for figuring this out
is in CodeGen). I'm also planning follow-ups for supporting some more esoteric
types that the constexpr evaluator supports, as well as extending
__builtin_memcpy constexpr evaluation to use the same infrastructure.

rdar://44987528

Differential revision: https://reviews.llvm.org/D62825

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@364954 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-02 18:28:13 +00:00
Lang Hames
49786123c8 [JITLink] Move JITLinkMemoryManager into its own header.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@363444 91177308-0d34-0410-b5e6-96231b3b80d8
2019-06-14 19:41:21 +00:00
Lang Hames
fed30998fe [ORC] Rename MaterializationResponsibility resolve and emit methods to
notifyResolved/notifyEmitted.

The 'notify' prefix better describes what these methods do: they update the JIT
symbol states and notify any pending queries that the 'resolved' and 'emitted'
states have been reached (rather than actually performing the resolution or
emission themselves). Since new states are going to be introduced in the near
future (to track symbol registration/initialization) it's worth changing the
convention pre-emptively to avoid further confusion.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@363322 91177308-0d34-0410-b5e6-96231b3b80d8
2019-06-13 20:11:23 +00:00
Cameron McInally
f36937ccde [ExecutionEngine] Fix rL362941: Add UnaryOperator visitor to the interpreter
Missed break statements. This was D62881.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@362958 91177308-0d34-0410-b5e6-96231b3b80d8
2019-06-10 16:05:25 +00:00
Cameron McInally
2314c6c63e [ExecutionEngine] Add UnaryOperator visitor to the interpreter
This is to support the unary FNeg instruction.

Differential Revision: https://reviews.llvm.org/D62881

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@362941 91177308-0d34-0410-b5e6-96231b3b80d8
2019-06-10 14:38:48 +00:00
Lang Hames
883ef72f22 [ORC] Update symbol lookup to use a single callback with a required symbol state
rather than two callbacks.

The asynchronous lookup API (which the synchronous lookup API wraps for
convenience) used to take two callbacks: OnResolved (called once all requested
symbols had an address assigned) and OnReady to be called once all requested
symbols were safe to access). This patch updates the asynchronous lookup API to
take a single 'OnComplete' callback and a required state (SymbolState) to
determine when the callback should be made. This simplifies the common use case
(where the client is interested in a specific state) and will generalize neatly
as new states are introduced to track runtime initialization of symbols.

Clients who were making use of both callbacks in a single query will now need to
issue two queries (one for SymbolState::Resolved and another for
SymbolState::Ready). Synchronous lookup API clients who were explicitly passing
the WaitOnReady argument will now need neeed to pass a SymbolState instead (for
'WaitOnReady == true' use SymbolState::Ready, for 'WaitOnReady == false' use
SymbolState::Resolved). Synchronous lookup API clients who were using default
arugment values should see no change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@362832 91177308-0d34-0410-b5e6-96231b3b80d8
2019-06-07 19:33:51 +00:00
Nick Desaulniers
e5876ebb72 [RuntimeDyld] fix too-small-bitmask error
Summary:
This was flagged in https://www.viva64.com/en/b/0629/ under "Snippet No.
33".

It seems that this statement is doing the standard bitwise trick for
adjusting a value to have a specific alignment.

The issue is that getStubAlignment() returns an unsigned, while DataSize
is declared a uint64_t. The right hand side of the expression is not
extended to 64b before bitwise negation, resulting in the top half of
the mask being 0s, which is not correct for realignment.

Reviewers: lhames, MaskRay

Reviewed By: MaskRay

Subscribers: RKSimon, MaskRay, hiraditya, llvm-commits, srhines

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D62227

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@362286 91177308-0d34-0410-b5e6-96231b3b80d8
2019-06-01 04:51:26 +00:00
Lang Hames
434afd372b [RuntimeDyld] Update reserveAllocationSpace to account for stub padding.
This should fix the buildbot failures caused by r362139.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@362151 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-30 20:58:28 +00:00
Lang Hames
b2a17d0a26 [RuntimeDyld] Apply padding and alignment bumps to all sections with stubs, and
increase the MachO/x86-64 stub alignment to 8.

Stub alignment should be guaranteed for any section containing RuntimeDyld
stubs/GOT-entries. To do this we should pad and align all sections containing
stubs, not just code sections.

This commit also bumps the MachO/x86-64 stub alignment to 8, so that GOT entries
will be aligned.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@362139 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-30 19:59:20 +00:00
Lang Hames
93af05e03e [ORC] Track JIT symbol states more explicitly.
Prior to this patch, JITDylibs inferred symbol states (whether a symbol was
newly added, materializing, resolved, or ready to run) via a combination of (1)
bits in the JITSymbolFlags member, and (2) the state of some internal JITDylib
data structures. This patch explicitly tracks symbol states by adding a new
SymbolState member to the symbol table entries, and removing the 'Lazy' and
'Materializing' bits from JITSymbolFlags. This is a first step towards adding
additional states representing initialization phases (e.g. eh-frame registration,
registration with the language runtime, and static initialization).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361899 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-28 23:35:44 +00:00
Lang Hames
35b7b92e5a [RuntimeDyld][ARM] Fix an incorrect assertion condition.
Fixes https://llvm.org/PR42036

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361782 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-27 21:34:31 +00:00
Galina Kistanova
35e2e8d045 Reverted r361134 because of a failing test left unattended for a long time.
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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361430 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-22 20:42:56 +00:00
Xing Xue
8b8f8d0ad8 Disable EHFrameSupport in JITLink/RuntimeDyld on AIX
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361410 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-22 17:41:27 +00:00
Lang Hames
8f5a892f82 [ORC] Assert that JITDylibs have unique names.
Patch by Praveen Velliengiri. Thanks Praveen!

Differential Revision: https://reviews.llvm.org/D62139

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361215 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-21 03:23:08 +00:00
Nick Desaulniers
0fbbfa8099 [ORC] fix use-after-move. NFC
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361203 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-20 22:17:43 +00:00
Lang Hames
194c9b02cb [ORC] Remove some unreachable code.
Fixes http://llvm.org/PR41662.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361199 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-20 21:30:33 +00:00
Lang Hames
766312c7e0 [Support] Renamed member 'Size' to 'AllocatedSize' in MemoryBlock and 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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361195 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-20 20:53:05 +00:00
Fangrui Song
1bf2855bbf Use llvm::sort. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361134 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-20 10:18:35 +00:00
Lang Hames
558b52b517 [ORC] Change handling for SymbolStringPtr tombstones and empty keys.
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360925 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-16 18:29:34 +00:00
Fangrui Song
7287acf23f Recommit [Object] Change object::SectionRef::getContents() to return 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360892 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-16 13:24:04 +00:00
Hans Wennborg
71eaa4f97d Revert r360876 "[Object] Change object::SectionRef::getContents() to return 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360878 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-16 12:08:34 +00:00
Fangrui Song
a4d6bb66d0 [Object] Change object::SectionRef::getContents() to return Expected<StringRef>
Expected<ArrayRef<uint8_t>> may be better but use Expected<StringRef> for now.

Follow-up of D61781.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360876 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-16 11:33:48 +00:00
Lang Hames
57b9d72d71 [JITLink][MachO] Use getSymbol64TableEntry for 64-bit MachO files.
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360830 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-16 00:21:07 +00:00
Lang Hames
803e94e6d3 [JITLink][MachO] Honor the no-dead-strip flag on nlist entries.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360618 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-13 20:52:30 +00:00
Lang Hames
3a049ed50c [JITLink] Track section alignment and make sure it is respected during layout.
Previously we had only honored alignments on individual atoms, but
tools/runtimes may assume that the section alignment is respected too.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360555 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-13 04:51:31 +00:00
Lang Hames
b18a506abe [JITLink] Add a test for zero-filled content.
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360547 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-12 22:26:33 +00:00
Lang Hames
fdcfe3e84d [ORC] Make a narrowing-cast explicit to silence a compiler warning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360478 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-10 22:51:03 +00:00
Lang Hames
77ebf7c3a9 [JITLink][MachO] Mark atoms in sections 'no-dead-strip' set live by default.
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360477 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-10 22:24:37 +00:00
Lang Hames
76e6710242 [JITLink] Fixed a signedness bug when processing X86_64_RELOC_SUBTRACTOR.
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360392 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-09 23:17:41 +00:00
Lang Hames
bb1ce15c01 [ORC] Simplify logic for updating edges when should-discard atoms are pruned.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360384 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-09 22:03:58 +00:00
Lang Hames
2ede9f4880 [JITLink] Improve/fix some JITLink debugging output.
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360383 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-09 22:03:57 +00:00
Lang Hames
bc737544d2 [ORC] Fix a formatting bug.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360382 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-09 22:03:53 +00:00
Sven van Haastregt
d88dad83c0 Fix LLVM_USE_PERF build after getPageSize change
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().

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360322 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-09 10:10:44 +00:00
Lang Hames
90dd07f5c5 [Support] Add error handling to sys::Process::getPageSize().
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360221 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-08 02:11:07 +00:00
Lang Hames
b6de0aa63f Reapply r360194 "[JITLink] Add support for MachO .alt_entry atoms." with fixes.
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).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360205 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-07 22:56:40 +00:00
Lang Hames
4d014be88d Revert r360194 "[JITLink] Add support for MachO .alt_entry atoms."
The testcase is asserting on some bots - reverting while I investigate.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360200 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-07 22:19:29 +00:00
Lang Hames
7fdae47df1 [JITLink] Add support for MachO .alt_entry atoms.
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360194 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-07 21:35:14 +00:00
Lang Hames
966c1da7e6 [JITLink] Add two useful Section operations: find by name, get address range.
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359950 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-04 00:23:09 +00:00
Lang Hames
5fb18b5a09 [ORC] Pass object buffer ownership back in NotifyEmitted.
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359735 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-01 22:40:23 +00:00
Lang Hames
b78c93233b [JITLink] Make sure we explicitly deallocate memory on failure.
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359643 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-01 02:43:52 +00:00
Lang Hames
4c1872ad8f [ORC] Move SimpleCompiler/ConcurrentIRCompiler definitions into a .cpp file.
SimpleCompiler is no longer templated, so there's no reason for this code to be
in a header any more.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359626 91177308-0d34-0410-b5e6-96231b3b80d8
2019-04-30 22:42:01 +00:00
Lang Hames
ef6f977b4b [JITLink] Add debugging output to print resolved external atoms.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359614 91177308-0d34-0410-b5e6-96231b3b80d8
2019-04-30 21:28:07 +00:00
Lang Hames
7f26fc050a [ORC][JITLink] Name in-memory compiled objects after their source modules.
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359613 91177308-0d34-0410-b5e6-96231b3b80d8
2019-04-30 21:27:56 +00:00
Lang Hames
9a1c76870e [ORC] Allow JITDylib definition generators to return Errors.
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359521 91177308-0d34-0410-b5e6-96231b3b80d8
2019-04-30 00:03:26 +00:00
Lang Hames
0b8468ca09 [ORC] Replace the LLJIT/LLLazyJIT Create methods with Builder utilities.
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());

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359511 91177308-0d34-0410-b5e6-96231b3b80d8
2019-04-29 22:37:27 +00:00
Lang Hames
357f4e4a0d [ORC] Add a 'plugin' interface to ObjectLinkingLayer for events/configuration.
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359357 91177308-0d34-0410-b5e6-96231b3b80d8
2019-04-26 22:58:39 +00:00