[PATCH] D96838: Add GNU attribute 'retain'

Paul Robinson via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 23 10:41:47 PST 2021


probinson added inline comments.


================
Comment at: clang/include/clang/Basic/AttrDocs.td:98
+This support is available in GNU ``ld`` and ``gold`` as of binutils 2.36, as
+well as in ``ld.lld`` 13.
+  }];
----------------
As a user, this seems like a complicated thing to figure out.
Also it seems to understate the case; if you have a linker that does understand SHF_GNU_RETAIN, then you *have* to use attribute `retain` to get the effect you want; otherwise your code breaks, probably silently.
And it looks like if you happen to combine an older compiler with a new-enough linker, you can never get it to do what you want.

I hope I'm wrong about these things, but that's what the docs suggest.


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