[PATCH] D118840: [ELF] Support (TYPE=<value>) to customize the output section type

Peter Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 14 05:18:02 PST 2022


peter.smith added a comment.

One more section type `SHT_GROUP` that I think we should disallow, although if GNU ld would prefer to include that we should prefer compatibility.

I'm not sure what the best policy is on setting approval as we've got a dependency on binutils. I'm happy with the implementation. Perhaps it would be useful to commit with an [ALPHA] tag, with explanation, to the feature? That way we reserve the right to make small modifications to the interface to maintain consistency with GNU ld.



================
Comment at: lld/ELF/ScriptParser.cpp:794
+    ECase(SHT_INIT_ARRAY), ECase(SHT_FINI_ARRAY), ECase(SHT_PREINIT_ARRAY),
+    ECase(SHT_GROUP),
+};
----------------
I think `SHT_GROUP` may also be too difficult to use without further extensions to linker scripts. It would only be useful in `ld -r` links as groups don't mean anything in ELF executables and shared libraries. To effectively use them from a linker script we'd need something like `SH_IDX("output section name")` which the linker would fill in the `sh_idx` in the output ELF file. I don't think a user could be expected to hard code a number in the linker script. 

Apologies I didn't spot this one on the first go.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D118840



More information about the llvm-commits mailing list