[PATCH] D120045: [lld][ELF] support nested special directives in output sections

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 17 14:34:54 PST 2022


MaskRay added a comment.

In D120045#3330873 <https://reviews.llvm.org/D120045#3330873>, @bluca wrote:

> In D120045#3330562 <https://reviews.llvm.org/D120045#3330562>, @MaskRay wrote:
>
>> I added the `(TYPE=...)` syntax for the sole purpose that Fedora or systemd (https://github.com/systemd/package-notes) has a proper way to mark `.note*` sections `SHT_NOTE`.
>
> And unless this fix or something along those lines is included too, it will not be used and it will serve no purpose whatsoever. Note how this patch doesn't mention _any specific directive_ but it simply skips any unknown ones. See it as future proofing, and compatibility with the documented bfd format. It's not going to get any closer to what you want - take it or leave it.

Some keywords have been supported. A new keyword likely introduces an interesting enough semantic difference (e.g. changing sh_flags, sh_link, etc) we should not silently ignore.
Ignore the unknown keyword like `FOOBAR` may cause a silently broken binary.

In addition, the `(type)` syntax is actually ambiguous: it is overloaded with the output section address syntax. Ignoring the keyword will cause trouble if the user intends to use a non-keyword variable in a pair of parentheses for the address.

---

I filed https://github.com/systemd/package-notes/issues/28 to remove `(READONLY)`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D120045/new/

https://reviews.llvm.org/D120045



More information about the llvm-commits mailing list