This is an archive of the discontinued LLVM Phabricator instance.

[gn build] Allow use_ubsan=true on mac and unbreak use_asan and use_ubsan
ClosedPublic

Authored by thakis on Jun 15 2022, 2:47 PM.

Details

Summary

use_ubsan=true seems to Just Work on macOS, so allow it.

https://reviews.llvm.org/D122862 broke use_asan=true and use_ubsan=true builds
on Linux too. This makes this go again by explicitly disabling asan and ubsan
for the baremetal part of the build. See discussion on
https://reviews.llvm.org/D122862 for other possible approaches.

Diff Detail

Event Timeline

thakis created this revision.Jun 15 2022, 2:47 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 15 2022, 2:47 PM
thakis requested review of this revision.Jun 15 2022, 2:47 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 15 2022, 2:47 PM
aeubanks accepted this revision.Jun 15 2022, 3:48 PM

I like this solution the best

This revision is now accepted and ready to land.Jun 15 2022, 3:48 PM
pcc added inline comments.Jun 15 2022, 3:53 PM
llvm/utils/gn/build/toolchain/BUILD.gn
256–257

Can we add these lines to the stage2_unix_toolchain template instead, as I mentioned in D122862?

pcc added a subscriber: phosek.Jun 15 2022, 4:34 PM
pcc added inline comments.
llvm/utils/gn/build/toolchain/BUILD.gn
256–257

On the other review @phosek mentioned that use_asan ought to affect libc++ and so on.

That seems reasonable enough, but we might need to change the build a bit to make that work.

Maybe we can move the sanitizer flags into a default config, and have the sanitizers and builtins libraries subtract that from the config?

thakis added inline comments.Jun 15 2022, 4:35 PM
llvm/utils/gn/build/toolchain/BUILD.gn
256–257

https://reviews.llvm.org/D122862#3587372 mentions that for libc++, it'd be nice to build with sanitizers enabled.

Which is a good point, but so is yours in https://reviews.llvm.org/D122862#3587325.

I think that means we want to have a stage2_unix_toolchain with sanitizers on and one with sanitizers off, and use the one with sanitizers on for libc++, but the one with sanitizers off for building the sanitizers.

…but that's something I don't want to tackle right now, so I kept this as-is to maintain the status quo from before the baremetal patch for now, and added a FIXME pointing to this comment.

256–257

That's an even better approach. Let's do that! (But again, in another patch :))

This revision was landed with ongoing or failed builds.Jun 15 2022, 4:41 PM
This revision was automatically updated to reflect the committed changes.