[PATCH] D96838: Add GNU attribute 'retain'

John McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 22 00:24:11 PST 2021


rjmccall added a comment.

> I have documented the behaviors in clang/include/clang/Basic/AttrDocs.td. Do you have suggestions on the wording?

Included; please let me know what you think.



================
Comment at: clang/include/clang/Basic/AttrDocs.td:63-76
+The attribute, when attached to a function definition, causes the function to
+be emitted even if it appears that the function is not referenced and can
+otherwise be omitted.
+
+The attribute, when attached to a variable definition with static storage,
+causes the variable to be emitted even if it appears that the variable is not
+referenced.
----------------



================
Comment at: clang/include/clang/Basic/AttrDocs.td:83-91
+This attribute only has effects on ELF targets that support SHF_GNU_RETAIN.
+The attribute, when attached to a function or variable definition, if the
+function or variable is emitted, causes the function or variable to be emitted
+in a unique section with SHF_GNU_RETAIN flag.  This ELF section flag prevents
+garbage collection of the section by supported linkers (GNU ld and gold from
+binutils 2.36 onwards, LLD 13 or newer).
+
----------------



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D96838



More information about the cfe-commits mailing list