Its PR35877 again.
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.
So it does not work for case when we would have only script that do INSERT
to patch some "default bfd script" that we do not have in LLD anyways.