[llvm-dev] Issue combining SanitizerCoverage with LTO

Eli Friedman via llvm-dev llvm-dev at lists.llvm.org
Tue Dec 3 13:56:10 PST 2019


An issue was reported to me that involved using "-fsanitize-coverage=trace-pc-guard -flto=thin".

Currently, what seems to happen is that the sancov instrumentation gets inserted at compile-time, then at LTO-time some instrumented functions get erased.  The associated sancov globals don't get erased, though.  The end result is that some sancov globals have null MD_associated metadata, and the linker prints an error like "incompatible section flags for __sancov_guards".  This seems to happen for any program where a function is erased at link time.  For example, the following program:

void testfn(){}
__attribute((visibility("hidden"))) void testfn2(){}

I'm not sure how __sancov_guards is supposed to work in this context.  Is LTO misbehaving, or is SanitizerCoverage making bad assumptions?

-Eli
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20191203/167714fa/attachment.html>


More information about the llvm-dev mailing list