[PATCH] D48203: [SanitizerCoverage] Add associated metadata to pc-tables.

Evgenii Stepanov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 15 12:42:02 PDT 2018


eugenis added inline comments.


================
Comment at: llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp:409
     appendToUsed(M, GlobalsToAppendToUsed);
+    appendToCompilerUsed(M, GlobalsToAppendToCompilerUsed);
+  }
----------------
morehouse wrote:
> eugenis wrote:
> > morehouse wrote:
> > > eugenis wrote:
> > > > morehouse wrote:
> > > > > eugenis wrote:
> > > > > > this is unnecessary, llvm.used is strictly stronger than llvm.compiler.used
> > > > > I'm not sure I understand...  We're appending different things to each list.
> > > > Right. Sorry.
> > > > A different question then: why only MachO?
> > > Kostya mentioned his reasoning in http://lists.llvm.org/pipermail/llvm-dev/2017-September/117315.html.
> > I don't understand that thread :(
> > What I know is, without compiler.used, neither comdat nor !associated nor a named section would save pctable from the optimizer. Try passing this through opt -O3:
> > 
> > $a = comdat any
> > @a = global i32 0, align 4, comdat($a)
> > @b = internal global i32 0, align 4, section "abc", !associated !0, comdat($a)
> > ; @llvm.compiler.used = appending global [1 x i8*] [i8* bitcast (i32* @b to i8*)]
> > !0 = !{i32 *@a}
> > 
> `clang++ -fsanitize=fuzzer -O3 -S -emit-llvm -o-` shows the pc-tables still there.  But if I run the output of that through `opt -O3`, the pc-tables get stripped.
> 
> So maybe running directly through `opt` performs some stripping that otherwise wouldn't be done?
Most optimizations are done before fuzzer instrumentation.
Try with MSan, it adds a few more at the end.


https://reviews.llvm.org/D48203





More information about the llvm-commits mailing list