[ELF] - Support "INSERT AFTER" statement.
authorGeorge Rimar <grimar@accesssoftek.com>
Thu, 8 Mar 2018 14:54:38 +0000 (14:54 +0000)
committerGeorge Rimar <grimar@accesssoftek.com>
Thu, 8 Mar 2018 14:54:38 +0000 (14:54 +0000)
commit9e2c8a9db16f502b135a38fdb6555de8739b9a5f
tree43f4ef01cf0b3671e43fd56cff2f161ecc10c0c3
parent9003b3b76d57c15ee8c451f0c2292977916dcb88
[ELF] - Support "INSERT AFTER" statement.

This implements INSERT AFTER in a following way:

During reading scripts it collects all insert statements.
After we done and read all files it inserts statements into script commands list.

With that:
* Rest of code does know nothing about INSERT.
* Approach is straightforward and have no visible limitations.
* It is also easy to support INSERT BEFORE (was seen in clang code once).
* Should work for PR35877 and similar cases.

Cons:
* It assumes we have "main" scripts that describes sections.

Differential revision: https://reviews.llvm.org/D43468

llvm-svn: 327003
lld/ELF/Driver.cpp
lld/ELF/LinkerScript.cpp
lld/ELF/LinkerScript.h
lld/ELF/ScriptParser.cpp
lld/test/ELF/linkerscript/Inputs/insert-after.s [new file with mode: 0644]
lld/test/ELF/linkerscript/Inputs/insert-after.script [new file with mode: 0644]
lld/test/ELF/linkerscript/insert-after.test [new file with mode: 0644]