llvm-project/lld/lib/Driver
Rafael Auler 9a7e211e8f [LinkerScript] Implement semantics for simple sections mappings
This commit implements the behaviour of the SECTIONS linker script directive,
used to not only define a custom mapping between input and output sections, but
also order input sections in the output file. To do this, we modify
DefaultLayout with hooks at important places that allow us to re-order input
sections according to a custom order. We also add a hook in SegmentChunk to
allow us to calculate linker script expressions while assigning virtual
addresses to the input sections that live in a segment.

Not all SECTIONS constructs are currently supported, but only the ones that do
not use special sort orders. It adds two LIT test as practical examples of
which sections directives are currently supported.

In terms of high-level changes, it creates a new class "script::Sema" that owns
all linker script ASTs and the logic for linker script semantics as well.
ELFLinkingContext owns a single copy of Sema, which will be used throughout
the object file writing process (to layout sections as proposed by the linker
script).

Other high-level change is that the writer no longer uses a "const" copy of
the linking context. This happens because linker script expressions must be
calculated *while* calculating final virtual addresses, which is a very late
step in object file writing. While calculating these expressions, we need to
update the linker script symbol table (inside the semantics object), and, thus,
we are "modifying our context" as we prepare to write the file.

http://reviews.llvm.org/D8157

llvm-svn: 232402
2015-03-16 19:55:15 +00:00
..
CMakeLists.txt Add Example Sub Target. 2015-02-26 00:48:10 +00:00
CoreDriver.cpp Fix five of the shared library build targets 2015-01-21 22:54:56 +00:00
CoreOptions.td This is my Driver refactoring patch. 2013-04-04 18:59:24 +00:00
DarwinLdDriver.cpp [MachO] Remove dependency on lldDriver 2015-01-23 23:26:13 +00:00
DarwinLdOptions.td [macho] -rpath support 2014-12-18 21:33:38 +00:00
Driver.cpp [ELF] Ability to resolve undefined symbols lazily 2015-03-14 10:34:43 +00:00
GnuLdDriver.cpp [LinkerScript] Implement semantics for simple sections mappings 2015-03-16 19:55:15 +00:00
GnuLdOptions.td LinkerScript: Add -T <scriptfile> option 2015-03-13 18:15:01 +00:00
Makefile Initial set of Makefiles 2014-06-04 09:54:07 +00:00
TODO.rst LinkerScript: Add -T <scriptfile> option 2015-03-13 18:15:01 +00:00
UniversalDriver.cpp Sort include files according to convention. 2014-10-18 05:33:55 +00:00
UniversalDriverOptions.td Add support to print version. 2014-10-08 03:47:51 +00:00
WinLinkDriver.cpp Use range-based for loops to iterate over file nodes. 2015-03-05 00:07:38 +00:00
WinLinkModuleDef.cpp [PECOFF] Fix exported symbol in the import library 2014-10-21 21:41:28 +00:00
WinLinkOptions.td [PECOFF] Ignore /maxilkfile option. 2014-11-25 19:51:28 +00:00