[PATCH] D103303: [ELF] Add --overwrite-script
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri May 28 01:17:01 PDT 2021
MaskRay created this revision.
MaskRay added reviewers: grimar, jhenderson, peter.smith, phosek.
Herald added subscribers: dang, arichardson, emaste.
MaskRay requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
This implements https://sourceware.org/bugzilla/show_bug.cgi?id=26404#c6
--overwrite-script specifies a script which contains several `SECTIONS`
commands. Each `SECTIONS` specifies exactly one output section description. The
initial syntax is intentionally narrow. Symbol assignments cannot be used.
Not supporting multiple output section descriptions in one `SECTIONS` makes it
clear the sections don't have order guarantee.
The semantics are similar to `INSERT [BEFORE|AFTER]`: LinkerScript::hasSectionsCommand
is not set. --overwrite-script can be more convenient without a main script
because --overwrite-script does not need a random anchor section used by `INSERT`.
This feature is versatile. To list a few usage:
- Use `KEEP(...)` to retain sections under GC
- Define encapsulation symbols (start/end) for an output section
- Use `: ALIGN(...)` to overalign an output section
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D103303
Files:
lld/ELF/Driver.cpp
lld/ELF/LinkerScript.cpp
lld/ELF/LinkerScript.h
lld/ELF/Options.td
lld/ELF/ScriptParser.cpp
lld/ELF/ScriptParser.h
lld/test/ELF/linkerscript/overwrite-script-discard.test
lld/test/ELF/linkerscript/overwrite-script.test
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D103303.348461.patch
Type: text/x-patch
Size: 14047 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210528/6c94ec33/attachment.bin>
More information about the llvm-commits
mailing list