MaskRay added a comment.

In D96838#2578073 <https://reviews.llvm.org/D96838#2578073>, @rjmccall wrote:

> GCC 11 hasn't been released yet, so can we still engage with GCC about the 
> semantics of this attribute?  This is a very low-level attribute, and I don't 
> understand why it was made separate instead of just having `used` add the 
> appropriate section flag on targets that support it.

GCC did overload `used` with the linker garbage collection semantics. Then 
after discussions (e.g. 
https://gcc.gnu.org/pipermail/gcc-patches/2021-February/565478.html) they 
decided to pick the earliest suggestion: add `retain`.

This makes sense to me: `used` can emit a function which is only used by inline 
assembly, but the user intention can still be that the whole thing can be 
GCable.

IIUC macOS's always enabled `.subsections_via_symbols` means always 
-ffunction-sections/-fdata-sections, so there is no GC preciseness concern.
However, the current Windows behavior (`.drectve` include a linker option to 
force retaining the whole section) can unnecessarily retain the full section.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D96838

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to