MaskRay added a comment.

> The !associated metadata may be attached to a global object declaration with 
> a single argument that references another global object. This metadata 
> prevents discarding of the global object in linker GC unless the referenced 
> object is also discarded.

"prevents discarding" is not accurate in the context. `__llvm_prf_*` cannot be 
discarded because C identifier name input sections are GC roots.

Add "C identifier name input sections are GC roots. In LLD, the SHF_LINK_ORDER 
flag overrides the C identifier name semantics." in appropriate place.

> Furthermore, when a function symbol is discarded by the linker, setting up 
> !associated metadata allows linker to discard counters, data and values 
> associated with that function symbol. This is not possible today because 
> there's metadata to guide the linker. This approach is also used by other 
> instrumentations like sanitizers.

This C identifier name GC currently only works with LLD but does no harm to 
gold/GNU ld.

Do you think `__llvm_prf_*` can link to the text section so that the self-link 
trick is not needed? (https://sourceware.org/bugzilla/show_bug.cgi?id=27259)


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

https://reviews.llvm.org/D76802

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

Reply via email to