[JITLink] Switch from an atom-based model to a "blocks and symbols" model.
authorLang Hames <lhames@gmail.com>
Fri, 4 Oct 2019 03:55:26 +0000 (03:55 +0000)
committerLang Hames <lhames@gmail.com>
Fri, 4 Oct 2019 03:55:26 +0000 (03:55 +0000)
commit4e920e58e6bc3bf4450b0aae6e225943957de195
tree34397c4c9f6d3162922d7c3e1c9ac6e5946fb264
parentff55e2e0476b72f456dbb37c247ae9ffef7a4f8d
[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
25 files changed:
llvm/include/llvm/ExecutionEngine/JITLink/EHFrameSupport.h
llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h
llvm/include/llvm/ExecutionEngine/JITLink/JITLinkMemoryManager.h
llvm/lib/ExecutionEngine/JITLink/BasicGOTAndStubsBuilder.h
llvm/lib/ExecutionEngine/JITLink/CMakeLists.txt
llvm/lib/ExecutionEngine/JITLink/EHFrameSupport.cpp
llvm/lib/ExecutionEngine/JITLink/EHFrameSupportImpl.h
llvm/lib/ExecutionEngine/JITLink/JITLink.cpp
llvm/lib/ExecutionEngine/JITLink/JITLinkGeneric.cpp
llvm/lib/ExecutionEngine/JITLink/JITLinkGeneric.h
llvm/lib/ExecutionEngine/JITLink/JITLinkMemoryManager.cpp
llvm/lib/ExecutionEngine/JITLink/MachOAtomGraphBuilder.cpp [deleted file]
llvm/lib/ExecutionEngine/JITLink/MachOAtomGraphBuilder.h [deleted file]
llvm/lib/ExecutionEngine/JITLink/MachOLinkGraphBuilder.cpp [new file with mode: 0644]
llvm/lib/ExecutionEngine/JITLink/MachOLinkGraphBuilder.h [new file with mode: 0644]
llvm/lib/ExecutionEngine/JITLink/MachO_x86_64.cpp
llvm/lib/ExecutionEngine/Orc/Core.cpp
llvm/lib/ExecutionEngine/Orc/ObjectLinkingLayer.cpp
llvm/test/ExecutionEngine/JITLink/X86/MachO_zero_fill_alignment.s
llvm/tools/llvm-jitlink/llvm-jitlink-macho.cpp
llvm/tools/llvm-jitlink/llvm-jitlink.cpp
llvm/tools/llvm-jitlink/llvm-jitlink.h
llvm/unittests/ExecutionEngine/JITLink/JITLinkTestCommon.cpp
llvm/unittests/ExecutionEngine/JITLink/JITLinkTestCommon.h
llvm/unittests/ExecutionEngine/JITLink/MachO_x86_64_Tests.cpp