[cfe-dev] [UBSan] Is static linking supported?

Troy Johnson via cfe-dev cfe-dev at lists.llvm.org
Thu Aug 23 14:10:39 PDT 2018


> > The standalone version of the UBSan runtime used on Windows does
> > install its own signal handlers. Maybe that causes a bad interaction
> > with Troy's program?

I was running on Linux, not Windows.

> >> >> No, that's not expected :). Could you share the options you used
> >> >> to compile and link it, and the backtrace you get?

I was trying the test.cc example here:  https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html#usage

But with the addition of -static.  It linked, but immediately seg faulted when I ran it.

Notably, if you try -static with another sanitizer, like -fsanitize=address, you get linker errors with the word "dynamic" in it, so it becomes pretty clear that you are doing something unexpected.

The successful link of -fsanitize=undefined -static plus the lack of any disclaimer in the documentation made me assume it should work.

-Troy


More information about the cfe-dev mailing list