[PATCH] D96838: Add GNU attribute 'retain'

Paul Robinson via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 24 08:46:57 PST 2021


probinson added a comment.

Aha; attribute `used` *by itself* is not sufficient to preserve sections in the output.  But the `__start_/__stop_` symbols implicitly create a reference to each of the named sections, and that implicit reference can preserve them in the output (assuming gc roots etc).
So, the idea is that attribute `retain` can be used *instead* of the `__start_/__stop_` symbols, to preserve sections in the output (with the advantage that it will work even for sections that do not have a C-identifier name).

Thanks for helping me understand this from a user perspective.  That will be important when you go to write the release note for this new attribute.


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