Page MenuHomeFreeBSD

Always build the sanitizer runtimes when compiling with clang
ClosedPublic

Authored by arichardson on Mon, Feb 8, 10:29 AM.

Details

Summary

This allows instrumenting e.g. test binaries even when compiling with an
external clang (e.g. CROSS_TOOLCHAIN=llvm11). I have some upcoming patches
that allow building the entire base system with ASan/UBSan/etc.
instrumentation and this is required in preparation for this.

Diff Detail

Repository
R10 FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

LGTM; as long as nobody tries to build these with gcc, it should be OK. On the other hand, maybe somebody will now complain that "clang stuff" is being built when they specifically disabled clang in their src.conf? But in that case we would need to add a separate MK_CLANG_RT option...

This revision is now accepted and ready to land.Mon, Feb 8, 10:34 AM
In D28532#638643, @dim wrote:

LGTM; as long as nobody tries to build these with gcc, it should be OK. On the other hand, maybe somebody will now complain that "clang stuff" is being built when they specifically disabled clang in their src.conf? But in that case we would need to add a separate MK_CLANG_RT option...

Alternatively I could put this under MK_TOOLCHAIN?

In D28532#638643, @dim wrote:

LGTM; as long as nobody tries to build these with gcc, it should be OK. On the other hand, maybe somebody will now complain that "clang stuff" is being built when they specifically disabled clang in their src.conf? But in that case we would need to add a separate MK_CLANG_RT option...

Alternatively I could put this under MK_TOOLCHAIN?

I don't think so, because somebody who doesn't want to build toolchains (and thus uses llvm packages) will likely also have this option disabled. For now, lets just build this part unconditionally, at least when the compiler type is clang.

The *san runtimes are not that large / do not take too long to build I believe.
If we want to make them optional we could introduce MK_CLANG_RT or general MK_RUNTIMES or whatnot.