[PATCH] D56516: [SanitizerCoverage] Don't create comdat for weak functions.

Matt Morehouse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 9 15:08:37 PST 2019


morehouse created this revision.
morehouse added reviewers: eugenis, pcc.
Herald added a subscriber: hiraditya.

Comdat groups override weak symbol behavior, allowing the linker to keep
the comdats for weak symbols in favor of comdats for strong symbols.

Fixes the issue described in:
https://bugs.chromium.org/p/chromium/issues/detail?id=918662#c24


https://reviews.llvm.org/D56516

Files:
  llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp


Index: llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp
===================================================================
--- llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp
+++ llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp
@@ -577,7 +577,7 @@
       *CurModule, ArrayTy, false, GlobalVariable::PrivateLinkage,
       Constant::getNullValue(ArrayTy), "__sancov_gen_");
 
-  if (TargetTriple.supportsCOMDAT())
+  if (TargetTriple.supportsCOMDAT() && !F.hasWeakLinkage())
     if (auto Comdat =
             GetOrCreateFunctionComdat(F, TargetTriple, CurModuleUniqueId))
       Array->setComdat(Comdat);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D56516.180940.patch
Type: text/x-patch
Size: 635 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190109/6d7ff89c/attachment.bin>


More information about the llvm-commits mailing list