summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ExecutionEngine/JITLink/EHFrameSupport.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [JITLink] Refactor EH-frame handling to support eh-frames with existing relocs.Lang Hames2019-11-061-194/+461
| | | | | | | | | | | | | | | | | | 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).
* [JITLink] Fix an unused variable warning.Lang Hames2019-10-041-3/+2
| | | | llvm-svn: 373692
* [JITLink] Switch from an atom-based model to a "blocks and symbols" model.Lang Hames2019-10-041-107/+88
| | | | | | | | | | | | | | | | | | | | | | | | 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
* [JITLink][ORC] Track eh-frame section size for registration/deregistration.Lang Hames2019-08-271-9/+23
| | | | | | | | | | | | | | | On MachO, processing of the eh-frame section should stop if the end of the __eh_frame section is reached, regardless of whether or not there is a null CFI length field at the end of the section. This patch tracks the eh-frame section size and threads it through the appropriate APIs so that processing can be terminated correctly. No testcase yet: This patch is all API plumbing (rather than modification of linked memory) which the existing infrastructure does not provide a way of testing. Committing without a testcase until I have an idea of how to write one. llvm-svn: 370074
* [JITLink][ORC] Add EHFrameRegistrar interface, use in EHFrameRegistrationPlugin.Lang Hames2019-07-041-0/+9
| | | | | | | | 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. llvm-svn: 365098
* Disable EHFrameSupport in JITLink/RuntimeDyld on AIXXing Xue2019-05-221-1/+2
| | | | | | | | | | | | | | | | | | | 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
* [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] Add a 'plugin' interface to ObjectLinkingLayer for events/configuration.Lang Hames2019-04-261-4/+5
| | | | | | | | | | | | | 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
* [JITLink] Refer to FDE's CIE (not the most recent CIE) when parsing eh-frame.Lang Hames2019-04-241-12/+19
| | | | | | | | | | | | | | | 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
* [JITLink] Remove a lot of reduntant 'JITLink_' prefixes. NFC.Lang Hames2019-04-221-0/+533
llvm-svn: 358869
OpenPOWER on IntegriCloud