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

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 7 17:19:00 PST 2022


MaskRay updated this revision to Diff 406657.
MaskRay edited the summary of this revision.
MaskRay added a comment.

I do intend to report a type mismatch error.
The previous diff had an issue that this is not detected.
The uploaded one has fixed it.

So I pick this choice:

> Do the input sections have to be compatible with the output section type?



> I note in the example that all of your examples are of the form of linker script data directives BYTE, QUAD etc. Would it make sense to restrict this to OutputSections with no InputSections or at least non executable input sections?

I think `.init_array (TYPE=SHT_INIT_ARRAY) : { *(.init_array) }`  should be supported.
In addition, our orphan placement rule may place input sections of the same name into the output section.
It seems odd to reject them.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D118840

Files:
  lld/ELF/OutputSections.cpp
  lld/ELF/OutputSections.h
  lld/ELF/ScriptParser.cpp
  lld/docs/ELF/linker_script.rst
  lld/test/ELF/linkerscript/custom-section-type.s
  lld/test/ELF/linkerscript/noload.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D118840.406657.patch
Type: text/x-patch
Size: 10917 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220208/9ac57efd/attachment.bin>


More information about the llvm-commits mailing list