#
7b11f564 |
| 11-Jan-2021 |
Lang Hames <lhames@gmail.com> |
[JITLink] Rename PostAllocationPasses to PreFixupPasses.
PreFixupPasses better reflects when these passes will run.
A future patch will (re)introduce a PostAllocationPasses list that will run after
[JITLink] Rename PostAllocationPasses to PreFixupPasses.
PreFixupPasses better reflects when these passes will run.
A future patch will (re)introduce a PostAllocationPasses list that will run after allocation, but before JITLinkContext::notifyResolved is called to notify the rest of the JIT about the resolved symbol addresses.
show more ...
|
Revision tags: llvmorg-11.0.1, llvmorg-11.0.1-rc2 |
|
#
ec6b71df |
| 16-Dec-2020 |
Lang Hames <lhames@gmail.com> |
[JITLink][ORC] Enable creation / linking of raw jitlink::LinkGraphs.
Separates link graph creation from linking. This allows raw LinkGraphs to be created and passed to a link. ObjectLinkingLayer is
[JITLink][ORC] Enable creation / linking of raw jitlink::LinkGraphs.
Separates link graph creation from linking. This allows raw LinkGraphs to be created and passed to a link. ObjectLinkingLayer is updated to support emission of raw LinkGraphs in addition to object buffers.
Raw LinkGraphs can be created by in-memory compilers to bypass object encoding / decoding (though this prevents caching, as LinkGraphs have do not have an on-disk representation), and by utility code to add programatically generated data structures to the JIT target process.
show more ...
|
#
04795ab8 |
| 14-Dec-2020 |
Lang Hames <lhames@gmail.com> |
Re-apply 8904ee8ac7e with missing header included this time.
|
#
5b112bcc |
| 14-Dec-2020 |
Nico Weber <thakis@chromium.org> |
Revert "[JITLink] Add JITLinkDylib type, thread through JITLinkMemoryManager APIs."
This reverts commit 8904ee8ac7ebcc50a60de0914abc6862e28b6664. Didn't `git add` llvm/ExecutionEngine/JITLink/JITLin
Revert "[JITLink] Add JITLinkDylib type, thread through JITLinkMemoryManager APIs."
This reverts commit 8904ee8ac7ebcc50a60de0914abc6862e28b6664. Didn't `git add` llvm/ExecutionEngine/JITLink/JITLinkDylib.h and hence doesn't build anywhere.
show more ...
|
#
8904ee8a |
| 14-Dec-2020 |
Lang Hames <lhames@gmail.com> |
[JITLink] Add JITLinkDylib type, thread through JITLinkMemoryManager APIs.
JITLinkDylib represents a target dylib for a JITLink link. By representing this explicitly we can: - Enable JITLinkMemory
[JITLink] Add JITLinkDylib type, thread through JITLinkMemoryManager APIs.
JITLinkDylib represents a target dylib for a JITLink link. By representing this explicitly we can: - Enable JITLinkMemoryManagers to manage allocations on a per-dylib basis (e.g by maintaining a seperate allocation pool for each JITLinkDylib). - Enable new features and diagnostics that require information about the target dylib (not implemented in this patch).
show more ...
|
Revision tags: llvmorg-11.0.1-rc1, llvmorg-11.0.0, llvmorg-11.0.0-rc6, llvmorg-11.0.0-rc5, llvmorg-11.0.0-rc4, llvmorg-11.0.0-rc3, llvmorg-11.0.0-rc2 |
|
#
0f5b7076 |
| 02-Aug-2020 |
Lang Hames <lhames@gmail.com> |
[llvm-jitlink] Add -phony-externals option to suppress unresolved externals.
The -phony-externals option adds a generator which explicitly defines any otherwise unresolved externals as null. This tr
[llvm-jitlink] Add -phony-externals option to suppress unresolved externals.
The -phony-externals option adds a generator which explicitly defines any otherwise unresolved externals as null. This transforms link-time unresolved-symbol errors into potential runtime null pointer accesses (if an unresolved external is actually accessed during execution).
This option can be useful in -harness mode to avoid having to mock a large number of symbols that are not reachable at runtime (e.g. unused methods referenced by a class vtable).
show more ...
|
#
8ce8cee1 |
| 30-Jul-2020 |
Lang Hames <lhames@gmail.com> |
[llvm-jitlink] Add -harness option to llvm-jitlink.
The -harness option enables new testing use-cases for llvm-jitlink. It takes a list of objects to treat as a test harness for any regular objects
[llvm-jitlink] Add -harness option to llvm-jitlink.
The -harness option enables new testing use-cases for llvm-jitlink. It takes a list of objects to treat as a test harness for any regular objects passed to llvm-jitlink.
If any files are passed using the -harness option then the following transformations are applied to all other files:
(1) Symbols definitions that are referenced by the harness files are promoted to default scope. (This enables access to statics from test harness).
(2) Symbols definitions that clash with definitions in the harness files are deleted. (This enables interposition by test harness).
(3) All other definitions in regular files are demoted to local scope. (This causes untested code to be dead stripped, reducing memory cost and eliminating spurious unresolved symbol errors from untested code).
These transformations allow the harness files to reference and interpose symbols in the regular object files, which can be used to support execution tests (including fuzz tests) of functions in relocatable objects produced by a build.
show more ...
|
#
9f1dcdca |
| 30-Jul-2020 |
Lang Hames <lhames@gmail.com> |
[JITLink] Allow JITLinkContext::notifyResolved to return an Error.
This allows clients to detect invalid transformations applied by JITLink passes (e.g. inserting or removing symbols in unexpected w
[JITLink] Allow JITLinkContext::notifyResolved to return an Error.
This allows clients to detect invalid transformations applied by JITLink passes (e.g. inserting or removing symbols in unexpected ways) and terminate linking with an error.
This change is used to simplify the error propagation logic in ObjectLinkingLayer.
show more ...
|
Revision tags: llvmorg-11.0.0-rc1, llvmorg-12-init, llvmorg-10.0.1, llvmorg-10.0.1-rc4, llvmorg-10.0.1-rc3, llvmorg-10.0.1-rc2 |
|
#
bf783a6a |
| 19-Jun-2020 |
Lang Hames <lhames@gmail.com> |
[JITLink] Display host -> target address mapping in debugging output.
This can be helpful for sanity checking JITLink memory manager behavior.
|
Revision tags: llvmorg-10.0.1-rc1, llvmorg-10.0.0, llvmorg-10.0.0-rc6, llvmorg-10.0.0-rc5, llvmorg-10.0.0-rc4, llvmorg-10.0.0-rc3 |
|
#
27a79b72 |
| 24-Feb-2020 |
Lang Hames <lhames@gmail.com> |
[JITLink] Add a MachO x86-64 GOT and Stub bypass optimization.
This optimization bypasses GOT loads and calls/branches through stubs when the ultimate target of the access/branch is found to be with
[JITLink] Add a MachO x86-64 GOT and Stub bypass optimization.
This optimization bypasses GOT loads and calls/branches through stubs when the ultimate target of the access/branch is found to be within range of the reference.
Extra debugging output is also added to the generic JITLink algorithm and basic GOT and Stubs builder utility to aid debugging.
show more ...
|
Revision tags: llvmorg-10.0.0-rc2, llvmorg-10.0.0-rc1, llvmorg-11-init, llvmorg-9.0.1, llvmorg-9.0.1-rc3, llvmorg-9.0.1-rc2 |
|
#
674df13b |
| 26-Nov-2019 |
Lang Hames <lhames@gmail.com> |
[ORC][JITLink] Add support for weak references, and improve handling of static libraries.
This patch substantially updates ORCv2's lookup API in order to support weak references, and to better suppo
[ORC][JITLink] Add support for weak references, and improve handling of static libraries.
This patch substantially updates ORCv2's lookup API in order to support weak references, and to better support static archives. Key changes:
-- Each symbol being looked for is now associated with a SymbolLookupFlags value. If the associated value is SymbolLookupFlags::RequiredSymbol then the symbol must be defined in one of the JITDylibs being searched (or be able to be generated in one of these JITDylibs via an attached definition generator) or the lookup will fail with an error. If the associated value is SymbolLookupFlags::WeaklyReferencedSymbol then the symbol is permitted to be undefined, in which case it will simply not appear in the resulting SymbolMap if the rest of the lookup succeeds.
Since lookup now requires these flags for each symbol, the lookup method now takes an instance of a new SymbolLookupSet type rather than a SymbolNameSet. SymbolLookupSet is a vector-backed set of (name, flags) pairs. Clients are responsible for ensuring that the set property (i.e. unique elements) holds, though this is usually simple and SymbolLookupSet provides convenience methods to support this.
-- Lookups now have an associated LookupKind value, which is either LookupKind::Static or LookupKind::DLSym. Definition generators can inspect the lookup kind when determining whether or not to generate new definitions. The StaticLibraryDefinitionGenerator is updated to only pull in new objects from the archive if the lookup kind is Static. This allows lookup to be re-used to emulate dlsym for JIT'd symbols without pulling in new objects from archives (which would not happen in a normal dlsym call).
-- JITLink is updated to allow externals to be assigned weak linkage, and weak externals now use the SymbolLookupFlags::WeaklyReferencedSymbol value for lookups. Unresolved weak references will be assigned the default value of zero.
Since this patch was modifying the lookup API anyway, it alo replaces all of the "MatchNonExported" boolean arguments with a "JITDylibLookupFlags" enum for readability. If a JITDylib's associated value is JITDylibLookupFlags::MatchExportedSymbolsOnly then the lookup will only match against exported (non-hidden) symbols in that JITDylib. If a JITDylib's associated value is JITDylibLookupFlags::MatchAllSymbols then the lookup will match against any symbol defined in the JITDylib.
show more ...
|
Revision tags: llvmorg-9.0.1-rc1 |
|
#
76aee8a3 |
| 05-Nov-2019 |
Lang Hames <lhames@gmail.com> |
[JITLink] Refactor EH-frame handling to support eh-frames with existing relocs.
Some targets (E.g. MachO/arm64) use relocations to fix some CFI record fields in the eh-frame section. When relocation
[JITLink] Refactor EH-frame handling to support eh-frames with existing relocs.
Some targets (E.g. MachO/arm64) use relocations to fix some CFI record fields in the eh-frame section. When relocations are used the initial (pre-relocation) content of the eh-frame section can no longer be interpreted by following the eh-frame specification. This causes errors in the existing eh-frame parser.
This patch moves eh-frame handling into two LinkGraph passes that are run after relocations have been parsed (but before they are applied). The first] pass breaks up blocks in the eh-frame section into per-CFI-record blocks, and the second parses blocks of (potentially multiple) CFI records and adds the appropriate edges to any CFI fields that do not have existing relocations. These passes can be run independently of one another. By handling eh-frame splitting/fixing with LinkGraph passes we can both re-use existing relocations for CFI record fields and avoid applying eh-frame fixups before parsing the section (which would complicate the linker and require extra temporary allocations of working memory).
show more ...
|
#
4e920e58 |
| 04-Oct-2019 |
Lang Hames <lhames@gmail.com> |
[JITLink] Switch from an atom-based model to a "blocks and symbols" model.
In the Atom model the symbols, content and relocations of a relocatable object file are represented as a graph of atoms, wh
[JITLink] Switch from an atom-based model to a "blocks and symbols" model.
In the Atom model the symbols, content and relocations of a relocatable object file are represented as a graph of atoms, where each Atom represents a contiguous block of content with a single name (or no name at all if the content is anonymous), and where edges between Atoms represent relocations. If more than one symbol is associated with a contiguous block of content then the content is broken into multiple atoms and layout constraints (represented by edges) are introduced to ensure that the content remains effectively contiguous. These layout constraints must be kept in mind when examining the content associated with a symbol (it may be spread over multiple atoms) or when applying certain relocation types (e.g. MachO subtractors).
This patch replaces the Atom model in JITLink with a blocks-and-symbols model. The blocks-and-symbols model represents relocatable object files as bipartite graphs, with one set of nodes representing contiguous content (Blocks) and another representing named or anonymous locations (Symbols) within a Block. Relocations are represented as edges from Blocks to Symbols. This scheme removes layout constraints (simplifying handling of MachO alt-entry symbols, and hopefully ELF sections at some point in the future) and simplifies some relocation logic.
llvm-svn: 373689
show more ...
|
Revision tags: llvmorg-9.0.0, llvmorg-9.0.0-rc6, llvmorg-9.0.0-rc5, llvmorg-9.0.0-rc4, llvmorg-9.0.0-rc3 |
|
#
70e158e0 |
| 27-Aug-2019 |
Lang Hames <lhames@gmail.com> |
[JITLink] Don't under-align zero-fill sections.
If content sections have lower alignment than zero-fill sections then bump the overall segment alignment to avoid under-aligning the zero-fill section
[JITLink] Don't under-align zero-fill sections.
If content sections have lower alignment than zero-fill sections then bump the overall segment alignment to avoid under-aligning the zero-fill sections.
llvm-svn: 370072
show more ...
|
Revision tags: llvmorg-9.0.0-rc2, llvmorg-9.0.0-rc1, llvmorg-10-init, llvmorg-8.0.1, llvmorg-8.0.1-rc4, llvmorg-8.0.1-rc3, llvmorg-8.0.1-rc2 |
|
#
ed49f6d8 |
| 22-May-2019 |
Galina Kistanova <gkistanova@gmail.com> |
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 Fail
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
llvm-svn: 361430
show more ...
|
#
68774edc |
| 20-May-2019 |
Fangrui Song <maskray@google.com> |
Use llvm::sort. NFC
llvm-svn: 361134
|
Revision tags: llvmorg-8.0.1-rc1 |
|
#
45139290 |
| 13-May-2019 |
Lang Hames <lhames@gmail.com> |
[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
[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.
llvm-svn: 360555
show more ...
|
#
5e332f19 |
| 09-May-2019 |
Lang Hames <lhames@gmail.com> |
[ORC] Simplify logic for updating edges when should-discard atoms are pruned.
llvm-svn: 360384
|
#
0d8ae1e3 |
| 07-May-2019 |
Lang Hames <lhames@gmail.com> |
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 lay
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).
llvm-svn: 360205
show more ...
|
#
3181b87c |
| 01-May-2019 |
Lang Hames <lhames@gmail.com> |
[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 h
[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.
llvm-svn: 359643
show more ...
|
#
d407b4b9 |
| 30-Apr-2019 |
Lang Hames <lhames@gmail.com> |
[JITLink] Add debugging output to print resolved external atoms.
llvm-svn: 359614
|
#
1233c15b |
| 22-Apr-2019 |
Lang Hames <lhames@gmail.com> |
[JITLink] Remove a lot of reduntant 'JITLink_' prefixes. NFC.
llvm-svn: 358869
|
#
11c8dfa5 |
| 20-Apr-2019 |
Lang Hames <lhames@gmail.com> |
Initial implementation of JITLink - A replacement for RuntimeDyld.
Summary:
JITLink is a jit-linker that performs the same high-level task as RuntimeDyld: it parses relocatable object files and mak
Initial implementation of JITLink - A replacement for RuntimeDyld.
Summary:
JITLink is a jit-linker that performs the same high-level task as RuntimeDyld: it parses relocatable object files and makes their contents runnable in a target process.
JITLink aims to improve on RuntimeDyld in several ways:
(1) A clear design intended to maximize code-sharing while minimizing coupling.
RuntimeDyld has been developed in an ad-hoc fashion for a number of years and this had led to intermingling of code for multiple architectures (e.g. in RuntimeDyldELF::processRelocationRef) in a way that makes the code more difficult to read, reason about, extend. JITLink is designed to isolate format and architecture specific code, while still sharing generic code.
(2) Support for native code models.
RuntimeDyld required the use of large code models (where calls to external functions are made indirectly via registers) for many of platforms due to its restrictive model for stub generation (one "stub" per symbol). JITLink allows arbitrary mutation of the atom graph, allowing both GOT and PLT atoms to be added naturally.
(3) Native support for asynchronous linking.
JITLink uses asynchronous calls for symbol resolution and finalization: these callbacks are passed a continuation function that they must call to complete the linker's work. This allows for cleaner interoperation with the new concurrent ORC JIT APIs, while still being easily implementable in synchronous style if asynchrony is not needed.
To maximise sharing, the design has a hierarchy of common code:
(1) Generic atom-graph data structure and algorithms (e.g. dead stripping and | memory allocation) that are intended to be shared by all architectures. | + -- (2) Shared per-format code that utilizes (1), e.g. Generic MachO to | atom-graph parsing. | + -- (3) Architecture specific code that uses (1) and (2). E.g. JITLinkerMachO_x86_64, which adds x86-64 specific relocation support to (2) to build and patch up the atom graph.
To support asynchronous symbol resolution and finalization, the callbacks for these operations take continuations as arguments:
using JITLinkAsyncLookupContinuation = std::function<void(Expected<AsyncLookupResult> LR)>;
using JITLinkAsyncLookupFunction = std::function<void(const DenseSet<StringRef> &Symbols, JITLinkAsyncLookupContinuation LookupContinuation)>;
using FinalizeContinuation = std::function<void(Error)>;
virtual void finalizeAsync(FinalizeContinuation OnFinalize);
In addition to its headline features, JITLink also makes other improvements:
- Dead stripping support: symbols that are not used (e.g. redundant ODR definitions) are discarded, and take up no memory in the target process (In contrast, RuntimeDyld supported pointer equality for weak definitions, but the redundant definitions stayed resident in memory).
- Improved exception handling support. JITLink provides a much more extensive eh-frame parser than RuntimeDyld, and is able to correctly fix up many eh-frame sections that RuntimeDyld currently (silently) fails on.
- More extensive validation and error handling throughout.
This initial patch supports linking MachO/x86-64 only. Work on support for other architectures and formats will happen in-tree.
Differential Revision: https://reviews.llvm.org/D58704
llvm-svn: 358818
show more ...
|