[PATCH] D42482: [ELF] - Support INSERT AFTER statement in linker script.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 31 00:53:09 PST 2018


grimar added a comment.

In https://reviews.llvm.org/D42482#992724, @ruiu wrote:

> Hmm, isn't this too restricted? It may work for .text or .data because sections are sorted by section attributes, but it doesn't work for other cases, no?


Yes, exactly. Tried to find balance between simplicity and functionality here. Original PR case was saying that such mini-scripts with "INSERT AFTER xxx"
are used in addition to default bfd script to place some sections and symbols.

If we have .text (ax) and .data (aw) and some .foo (aw) and trying to insert .foo after .text (`INSERT AFTER .text`).
Then .foo will be inserted after .data in our case. Though that still does not violate spec which says:
"The exact insertion point is as for orphan sections" and technically we still would insert after .text.

By "other cases", do you have some specific useful case in mind where this patch would not work ? I just wonder how much simple approach
can/should be and if we really need anything more complex than that.


https://reviews.llvm.org/D42482





More information about the llvm-commits mailing list