[PATCH] D97430: [SanitizerCoverage] Drop !associated on metadata sections

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 25 11:32:28 PST 2021


rnk accepted this revision.
rnk added a comment.

What you have described is generally true, and it is why static locals cannot be part of the comdat group of an inline function (`inline int f() { static int gv; return ++gv; }`). Groups (and !associated, I guess, although I'm not super familiar) really only work for metadata applications, where the relocation edges go from the associated data towards the externally visible things. It is very difficult to construct a comdat group with more than one externally visible symbol. See all the confusion over the `D5` comdat group.



================
Comment at: llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp:686-688
   GlobalsToAppendToCompilerUsed.push_back(Array);
-  MDNode *MD = MDNode::get(F.getContext(), ValueAsMetadata::get(&F));
-  Array->addMetadata(LLVMContext::MD_associated, *MD);
----------------
MaskRay wrote:
> vitalybuka wrote:
> > Why removing these lines does not change COFF behaviour ?
> I'll amend the description: 
> 
> > This patch does change the object file output for COFF (`!associated` is ignored).
I agree, it is redundant for COFF. The comdat group is what establishes the association links.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97430



More information about the llvm-commits mailing list