[PATCH] D96837: Add !retain metadata to represent SHF_GNU_RETAIN on ELF platforms

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 16 22:34:12 PST 2021


MaskRay created this revision.
MaskRay added reviewers: jdoerfert, phosek.
Herald added subscribers: dexonsmith, pengfei, hiraditya, krytarowski, arichardson, emaste.
MaskRay requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

!retain may be attached to a function/global variable definition.
Its section will be marked as a linker GC root.

We don't restrict the feature to ELFOSABI_GNU and ELFOSABI_FREEBSD for
now. See the rationale in D95749 <https://reviews.llvm.org/D95749>.

The integrated assembler has supported SHF_GNU_RETAIN since D95730 <https://reviews.llvm.org/D95730>.
GNU as>=2.36 supports section flag 'R'.
We don't need to worry about GNU ld support because older GNU ld just ignores
the unknown SHF_GNU_RETAIN.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D96837

Files:
  llvm/docs/LangRef.rst
  llvm/include/llvm/IR/FixedMetadataKinds.def
  llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
  llvm/test/CodeGen/X86/elf-retain.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D96837.324186.patch
Type: text/x-patch
Size: 4852 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210217/548addb5/attachment.bin>


More information about the llvm-commits mailing list