Commit Graph

2118 Commits

Author SHA1 Message Date
Lang Hames
67191c1ced [Orc] Rename ObjectLinkingLayer -> RTDyldObjectLinkingLayer.
The current ObjectLinkingLayer (now RTDyldObjectLinkingLayer) links objects
in-process using MCJIT's RuntimeDyld class. In the near future I hope to add new
object linking layers (e.g. a remote linking layer that links objects in the JIT
target process, rather than the client), so I'm renaming this class to be more
descriptive.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295636 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-20 05:45:14 +00:00
Eric Fiselier
a61fc423f3 [CMake] Fix pthread handling for out-of-tree builds
LLVM defines `PTHREAD_LIB` which is used by AddLLVM.cmake and various projects
to correctly link the threading library when needed. Unfortunately
`PTHREAD_LIB` is defined by LLVM's `config-ix.cmake` file which isn't installed
and therefore can't be used when configuring out-of-tree builds. This causes
such builds to fail since `pthread` isn't being correctly linked.

This patch attempts to fix that problem by renaming and exporting
`LLVM_PTHREAD_LIB` as part of`LLVMConfig.cmake`. I renamed `PTHREAD_LIB`
because It seemed likely to cause collisions with downstream users of
`LLVMConfig.cmake`.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294690 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-10 01:59:20 +00:00
Eugene Leviant
3523e86a0b RuntimeDyldELF/AArch64: Implement basic GOT support
This patch implements two GOT relocations:
R_AARCH64_ADR_GOT_PAGE and R_AARCH64_LD64_GOT_LO12_NC

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294191 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-06 15:31:28 +00:00
Will Dietz
9ca31561b6 RuntimeDyldELF: Don't abort on R_X86_64_NONE, it's a no-oop.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293388 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-28 18:39:01 +00:00
Eugene Leviant
9c3e633489 RuntimeDyldELF: add LDST128_ABS_LO12_NC reloc
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@292788 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-23 13:52:08 +00:00
Eugene Leviant
ece7697261 RuntimeDyldELF: add LDST8_ABS_LO12_NC and LDST16_ABS_LO12_NC relocs
Differential revision: https://reviews.llvm.org/D28863


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@292785 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-23 13:13:47 +00:00
Lang Hames
b1e2ecc0ae [Orc][RPC] Add an RPCFunctionNotSupported error type and return it from
negotiateFunction where appropriate.

Replacing the old ECError with a custom type allows us to attach the name of
the function that could not be negotiated, enabling better diagnostics for
negotiation failures.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@292055 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-15 06:34:25 +00:00
Eugene Leviant
2d0a1dd417 RuntimeDyldELF: implement R_AARCH64_PREL64 reloc
Differential revision: https://reviews.llvm.org/D28122


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@291558 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-10 11:05:30 +00:00
Pavel Labath
1148d63bde Fix MSVC build failure introduced in r291431
MSVC does not like to reinterpret_cast to a uint64_t. Use a different cast
instead.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@291435 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-09 11:20:35 +00:00
Eugene Leviant
0f4cbb99e9 RuntimeDyldELF: don't create thunk if not needed
This patch doesn't create thunk for branch operation when following conditions are met:
- Architecture is AArch64
- Relocation target is in the same object file
- Relocation target is close enough to be encoded in immediate offset

In such case we branch directly to the target instead of branching to thunk

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@291431 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-09 09:56:31 +00:00
Lang Hames
b7c9e93afb [ExecutionEngine] Fix compile errors in OProfileJITEventListener.
Allows LLVM to build with LLVM_USE_OPROFILE=True.

Patch by Mark Dewing. Thanks Mark!



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290908 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-03 21:39:43 +00:00
Eugene Leviant
4a47ce3808 RuntimeDyldELF: refactor AArch64 relocations. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290606 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-27 13:33:32 +00:00
Eugene Leviant
9b804c5b0a RuntimeDyldELF: add R_AARCH64_ADD_ABS_LO12_NC reloc
Differential revision: https://reviews.llvm.org/D28115


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290598 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-27 09:51:38 +00:00
Lang Hames
6cc32b3b42 [Orc][RPC] Add a ParallelCallGroup utility for dispatching and waiting on
multiple asynchronous RPC calls.

ParallelCallGroup allows multiple asynchronous calls to be dispatched,
and provides a wait method that blocks until all asynchronous calls have
been executed on the remote and all return value handlers run on the
local machine.

This will allow, for example, the JIT client to issue memory allocation calls
for all sections in parallel, then block until all memory has been allocated
on the remote and the allocated addresses registered with the client, at which
point the JIT client can proceed to applying relocations.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290523 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-25 21:55:05 +00:00
Ed Maste
91d837c186 Update mailing list post URL and add libunwind reference
RTDyldMemoryManager.cpp describes the differing __register_frame
API between libunwind and libgcc, with a mailing list posting URL.

The original link was 404; replace it with what I believe is the
intended post, as well as a reference to the "OS X" implementation in
libunwind.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290269 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-21 20:51:42 +00:00
Yichao Yu
e012a3d747 Fix R_AARCH64_MOVW_UABS_G3 relocation
Summary: The relocation is missing mask so an address that has non-zero bits in 47:43 may overwrite the register number. (Frequently shows up as target register changed to `xzr`....)

Reviewers: t.p.northover, lhames

Subscribers: davide, aemerson, rengolin, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289880 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-15 22:36:53 +00:00
Stephan Bergmann
20a600c431 Replace APFloatBase static fltSemantics data members with getter functions
At least the plugin used by the LibreOffice build
(<https://wiki.documentfoundation.org/Development/Clang_plugins>) indirectly
uses those members (through inline functions in LLVM/Clang include files in turn
using them), but they are not exported by utils/extract_symbols.py on Windows,
and accessing data across DLL/EXE boundaries on Windows is generally
problematic.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289647 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-14 11:57:17 +00:00
Simon Dardis
2762dbad70 [mips][rtdyld] Move MIPS relocation resolution to a subclass and implement N32 relocations
N32 relocations are only correct for individual relocations at the moment.
Support for relocation composition will follow in a later patch.

Patch By: Daniel Sanders

Reviwers: vkalintiris, atanasyan

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289532 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-13 11:39:18 +00:00
Simon Dardis
17b733b5ee [mips][rtdyld] Merge code to write relocated values to the section. NFC
Preparation work for implementing N32 support.

Patch By: Daniel Sanders

Reviewers: vkalintiris, atanasyan

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288900 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-07 11:41:23 +00:00
Peter Collingbourne
06115803f9 IR: Change the gep_type_iterator API to avoid always exposing the "current" type.
Instead, expose whether the current type is an array or a struct, if an array
what the upper bound is, and if a struct the struct type itself. This is
in preparation for a later change which will make PointerType derive from
Type rather than SequentialType.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288458 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-02 02:24:42 +00:00
Eugene Zelenko
c02caf5200 Fix some Clang-tidy and Include What You Use warnings; other minor fixes (NFC).
This preparation to remove SetVector.h dependency on SmallSet.h.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288256 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-30 17:48:10 +00:00
Lang Hames
db04d03093 [RuntimeDyld] Skip undefined symbols when building the symbol table.
Storing these in the symbol table (with zero values) is just wasted space.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288225 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-30 01:12:07 +00:00
Simon Pilgrim
84d1e9104a Fix comment typos. NFC.
Identified by Pedro Giffuni in PR27636.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287490 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-20 13:47:59 +00:00
Chris Bieneman
92cb3eecbd [CMake] NFC. Updating CMake dependency specifications
This patch updates a bunch of places where add_dependencies was being explicitly called to add dependencies on intrinsics_gen to instead use the DEPENDS named parameter. This cleanup is needed for a patch I'm working on to add a dependency debugging mode to the build system.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287206 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-17 04:36:50 +00:00
Lang Hames
085827f843 [ORC] Re-apply 286620 with fixes for the ErrorSuccess class.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286639 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-11 21:42:09 +00:00
Lang Hames
b35b701639 [ORC] Revert r286620 while I investigate a bot failure.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286621 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-11 19:46:46 +00:00
Lang Hames
d8314f03b1 [ORC] Refactor the ORC RPC utilities to add some new features.
(1) Add support for function key negotiation.

The previous version of the RPC required both sides to maintain the same
enumeration for functions in the API. This means that any version skew between
the client and server would result in communication failure.

With this version of the patch functions (and serializable types) are defined
with string names, and the derived function signature strings are used to
negotiate the actual function keys (which are used for efficient call
serialization). This allows clients to connect to any server that supports a
superset of the API (based on the function signatures it supports).

(2) Add a callAsync primitive.

The callAsync primitive can be used to install a return value handler that will
run as soon as the RPC function's return value is sent back from the remote.

(3) Launch policies for RPC function handlers.

The new addHandler method, which installs handlers for RPC functions, takes two
arguments: (1) the handler itself, and (2) an optional "launch policy". When the
RPC function is called, the launch policy (if present) is invoked to actually
launch the handler. This allows the handler to be spawned on a background
thread, or added to a work list. If no launch policy is used, the handler is run
on the server thread itself. This should only be used for short-running
handlers, or entirely synchronous RPC APIs.

(4) Zero cost cross type serialization.

You can now define serialization from any type to a different "wire" type. For
example, this allows you to call an RPC function that's defined to take a
std::string while passing a StringRef argument. If a serializer from StringRef
to std::string has been defined for the channel type this will be used to
serialize the argument without having to construct a std::string instance.

This allows buffer reference types to be used as arguments to RPC calls without
requiring a copy of the buffer to be made.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286620 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-11 19:42:44 +00:00
Peter Collingbourne
76c218e094 Bitcode: Change the materializer interface to return llvm::Error.
Differential Revision: https://reviews.llvm.org/D26439

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286382 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-09 17:49:19 +00:00
Keno Fischer
a45d706e76 Fix cross-endianness RuntimeDyld relocation for ARM
rL284780 fixed the PREL31 relocation and added a test for it. Being
the first such test for ARM relocations, it exposed incorrect endianness
assumptions (causing buildbot failures on big-endian hosts). Fix that by
using the same helpers used for the x86 case.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284789 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-20 22:15:56 +00:00
Keno Fischer
a5f79d9770 Fix PREL31 relocation on ARM
Summary:
This is a 31bits relative relocation instead of a 32bits absolute relocation.

Reviewers: t.p.northover, peter.smith, rengolin

Subscribers: aemerson, llvm-commits, samparker

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284780 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-20 21:15:29 +00:00
Simon Dardis
f7463aa366 [mips][mcjit] Add the majority of N32 support.
The missing piece is relocation composition for %hi(%neg(%gp_rel(x))) and
similar.

Patch by: Daniel Sanders


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284724 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-20 13:02:23 +00:00
Benjamin Kramer
06d5a1641d Do a sweep over move ctors and remove those that are identical to the default.
All of these existed because MSVC 2013 was unable to synthesize default
move ctors. We recently dropped support for it so all that error-prone
boilerplate can go.

No functionality change intended.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284721 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-20 12:20:28 +00:00
Reid Kleckner
5b1c9f3223 Remove LLVM_NOEXCEPT and replace it with noexcept
Now that we have dropped MSVC 2013, all supported compilers support
noexcept and we can drop this portability macro.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284672 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-19 23:52:38 +00:00
Walter Erquinigo
f68eeb3359 Handle relocations to thumb functions when dynamic linking COFF modules
Summary:
This adds the necessary logic to support relocations to thumb functions in the COFF dynamic linker.
The jumps to function addresses are mostly blx, which requires the ISA selection bit when jumping to a thumb function.

Note: I'm determining if the relocation requires the ISA bit when creating the relocation entries and not when resolving the relocation. I have to do that because I need the ObjectFile and the actual Symbol, which are available only when creating the entries. It would require a gross refactor if I do it otherwise, but I'm okay with doing it if you think it's better.

Reviewers: peter.smith, compnerd

Subscribers: rengolin, sas

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284410 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-17 18:56:18 +00:00
Mehdi Amini
d1fa61bdee Use StringRef instead of raw pointer in ExecutionEngine
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283016 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-01 06:22:04 +00:00
Lang Hames
c12323739a [MCJIT] Fix some inconsistent handling of name mangling inside MCJIT.
This patch moves symbol mangling from findSymbol to getSymbolAddress. The
findSymbol, findExistingSymbol and findModuleForSymbol methods now always take
a mangled name, allowing the 'demangle-and-retry' cruft to be removed from
findSymbol. See http://llvm.org/PR28699 for details.

Patch by James Holderness. Thanks very much James!



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281238 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-12 17:19:24 +00:00
Lang Hames
b80c6300c5 [ORC] Clone module flags metadata into the globals module in the
CompileOnDemandLayer.

Also contains a tweak to the orc-lazy jit in LLI to enable the test case.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280632 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-04 17:53:30 +00:00
Lang Hames
c6f214bfea [ExecutionEngine] Move ObjectCache::anchor from MCJIT to ExecutionEngine.
ObjectCache is an ExecutionEngine utility, so its anchor belongs there. The
practical impact of this change is that ORC users no longer need to link MCJIT
to use ObjectCaches.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280616 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-04 07:24:11 +00:00
Saleem Abdulrasool
294618592b ExecutionEngine: fix a bug in the movt/movw relocator
According to the arm arm specifications, 4 bytes are needed for a shift instead
of 8, this was causing the movt instruction to write to a different register
sometimes.

Patch by Walter Erquinigo!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280005 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-29 20:42:03 +00:00
Eugene Zelenko
9feaa97ada Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes.
Differential revision: https://reviews.llvm.org/D23789


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279535 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-23 17:14:32 +00:00
Lang Hames
472f1cbd1f [RuntimeDyld] Revert r279182 and 279201 -- they broke some ARM bots.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279275 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-19 17:06:39 +00:00
Lang Hames
84c33c6c95 [RuntimeDyld] Add support for ELF R_ARM_REL32 and R_ARM_GOT_PREL.
Patch by William Dillon. Thanks William!

This patch adds support for the R_ARM_REL32 and R_ARM_GOT_PREL ELF ARM
relocations to RuntimeDyld, which should allow JITing of code that
produces these relocations.

No test case: Unfortunately RuntimeDyldELF's GOT building mechanism (which
uses a separate section for GOT entries) isn't compatible with
RuntimeDyldChecker. The correct fix for this is to fix RuntimeDyldELF's GOT
support (it's fundamentally broken at the moment: separate sections aren't
guaranteed to be in range of a GOT entry load), but that's a non-trivial job.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279182 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-19 01:15:39 +00:00
Lang Hames
b60f9a25c0 Revert r279016 -- it breaks win32-elf JIT tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279029 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-18 01:33:28 +00:00
Lang Hames
5bc5c47fda [RuntimeDyld] Strip leading '_' from symbols on 32-bit windows in
RTDyldMemoryManager::getSymbolAddressInProcess()

This should allow JIT'd code for win32 to find in-process symbols. See
http://llvm.org/PR28699 .

Patch by James Holderness. Thanks James!



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279016 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-18 00:22:34 +00:00
Justin Bogner
6673ea81f6 Replace "fallthrough" comments with LLVM_FALLTHROUGH
This is a mechanical change of comments in switches like fallthrough,
fall-through, or fall-thru to use the LLVM_FALLTHROUGH macro instead.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278902 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-17 05:10:15 +00:00
David Majnemer
5d08e375ab Use the range variant of remove_if instead of unpacking begin/end
No functionality change is intended.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278475 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-12 04:32:37 +00:00
David Majnemer
2d62ce6ee8 Use the range variant of find/find_if instead of unpacking begin/end
If the result of the find is only used to compare against end(), just
use is_contained instead.

No functionality change is intended.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278469 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-12 03:55:06 +00:00
Lang Hames
3f8d4e3f67 [MCJIT] Improve documentation and error handling for MCJIT::runFunction.
ExecutionEngine::runFunction is supposed to allow execution of arbitrary
function types, but MCJIT can only reasonably support a limited subset of
main-linke function types. This patch documents this limitation, and fixes
MCJIT::runFunction to abort with a meaningful error at runtime if called with
an unsupported function type.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278348 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-11 15:56:23 +00:00
Lang Hames
04d404bad2 Re-apply r278065 (Weak symbol support in RuntimeDyld) with a fix for ELF.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278149 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-09 19:27:17 +00:00
Lang Hames
06c9df2f1c Revert r278065 while I investigate some build-bot breakage.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278069 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-08 22:57:30 +00:00