[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
Wed Feb 2 12:47:15 PST 2022


MaskRay created this revision.
MaskRay added reviewers: andrewng, ikudrin, peter.smith.
Herald added subscribers: arichardson, emaste.
MaskRay requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

The current output section type allows to set the ELF section type to
SHT_PROGBITS or SHT_NOLOAD. This patch allows an arbitrary section value
to be specified. Some common SHT_* literal names are supported as well.

  SECTIONS {
    note (TYPE=SHT_NOTE) : { BYTE(8) }
    init_array ( TYPE=14 ) : { QUAD(14) }
    fini_array (TYPE = SHT_FINI_ARRAY) : { QUAD(15) }
  }

While here, update our documentation.

GNU ld discussion: https://sourceware.org/bugzilla/show_bug.cgi?id=28841

---

I am coordinating with binutils maintainers about the syntax.


Repository:
  rG LLVM Github Monorepo

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

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


More information about the llvm-commits mailing list