[PATCH] D97447: Add GNU attribute 'retain'
Reid Kleckner via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Feb 26 11:52:49 PST 2021
rnk accepted this revision.
rnk added a comment.
This revision is now accepted and ready to land.
lgtm with a minor doc tweak
My reading of the discussion is that this is ready, but please wait for others if you are aware of any outstanding concerns.
================
Comment at: clang/include/clang/Basic/AttrDocs.td:98
+
+This attribute only has an effect on ELF targets; other targets prevent the
+removal of definitions by the linker when using the ``used`` attribute alone.
----------------
The attribute does have an effect on non-ELF targets: a retained global will be added to llvm.used, if it ends up being emitted. Maybe you can say that the attribute is only necessary on ELF targets, and that there is no harm in using `retain` in addition to `used` on non-ELF targets. Using the attributes together should result in consistent behavior across platforms.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D97447/new/
https://reviews.llvm.org/D97447
More information about the cfe-commits
mailing list