Eli Friedman via llvm-dev
2019-Dec-03 21:56 UTC
[llvm-dev] Issue combining SanitizerCoverage with LTO
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>
Roman Lebedev via llvm-dev
2019-Dec-03 22:01 UTC
[llvm-dev] Issue combining SanitizerCoverage with LTO
I believe i have reported a related issue in https://bugs.llvm.org/show_bug.cgi?id=41734 "-fsanitize-coverage=inline-8bit-counters + ThinLTO = lld crash" On Wed, Dec 4, 2019 at 12:56 AM Eli Friedman via llvm-dev <llvm-dev at lists.llvm.org> wrote:> > 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? > > > > -EliRoman> _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev