[PATCH] D53113: [SanitizerCoverage] Make Inline8bit and TracePC counters dead stripping resistant.

Max Moroz via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 11 08:23:00 PDT 2018


Dor1s updated this revision to Diff 169217.
Dor1s marked an inline comment as done.
Dor1s added a comment.

Move GlobalsToAppendToUsed.push_back call into CreateFunctionLocalArrayInSection


Repository:
  rL LLVM

https://reviews.llvm.org/D53113

Files:
  lib/Transforms/Instrumentation/SanitizerCoverage.cpp


Index: lib/Transforms/Instrumentation/SanitizerCoverage.cpp
===================================================================
--- lib/Transforms/Instrumentation/SanitizerCoverage.cpp
+++ lib/Transforms/Instrumentation/SanitizerCoverage.cpp
@@ -594,6 +594,7 @@
   Array->setSection(getSectionName(Section));
   Array->setAlignment(Ty->isPointerTy() ? DL->getPointerSize()
                                         : Ty->getPrimitiveSizeInBits() / 8);
+  GlobalsToAppendToUsed.push_back(Array);
   GlobalsToAppendToCompilerUsed.push_back(Array);
   MDNode *MD = MDNode::get(F.getContext(), ValueAsMetadata::get(&F));
   Array->addMetadata(LLVMContext::MD_associated, *MD);
@@ -631,14 +632,14 @@
 
 void SanitizerCoverageModule::CreateFunctionLocalArrays(
     Function &F, ArrayRef<BasicBlock *> AllBlocks) {
-  if (Options.TracePCGuard) {
+  if (Options.TracePCGuard)
     FunctionGuardArray = CreateFunctionLocalArrayInSection(
         AllBlocks.size(), F, Int32Ty, SanCovGuardsSectionName);
-    GlobalsToAppendToUsed.push_back(FunctionGuardArray);
-  }
+
   if (Options.Inline8bitCounters)
     Function8bitCounterArray = CreateFunctionLocalArrayInSection(
         AllBlocks.size(), F, Int8Ty, SanCovCountersSectionName);
+
   if (Options.PCTable)
     FunctionPCsArray = CreatePCArray(F, AllBlocks);
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53113.169217.patch
Type: text/x-patch
Size: 1309 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181011/2da93e0d/attachment.bin>


More information about the llvm-commits mailing list