[llvm-dev] Issue combining SanitizerCoverage with LTO

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[llvm-dev] Issue combining SanitizerCoverage with LTO

Doerfert, Johannes via llvm-dev

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


_______________________________________________
LLVM Developers mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Reply | Threaded
Open this post in threaded view
|

Re: [llvm-dev] Issue combining SanitizerCoverage with LTO

Doerfert, Johannes via llvm-dev
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
<[hidden email]> 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?
>
>
>
> -Eli
Roman

> _______________________________________________
> LLVM Developers mailing list
> [hidden email]
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
_______________________________________________
LLVM Developers mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev