This is an archive of the discontinued LLVM Phabricator instance.

[Scudo][CMake] Add -fno-lto to Scudo libraries
ClosedPublic

Authored by aeubanks on Jul 28 2020, 3:01 PM.

Details

Summary

-fno-lto is in SANITIZER_COMMON_CFLAGS but not here.
Don't use SANITIZER_COMMON_CFLAGS because of performance issues.
See https://bugs.llvm.org/show_bug.cgi?id=46838.

Fixes
$ ninja TScudoCUnitTest-i386-Test
on an LLVM build with -DLLVM_ENABLE_LTO=Thin.
check-scudo now passes.

Diff Detail

Event Timeline

aeubanks created this revision.Jul 28 2020, 3:01 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 28 2020, 3:01 PM
Herald added subscribers: Restricted Project, dexonsmith, cryptoad, mgorny. · View Herald Transcript
aeubanks requested review of this revision.Jul 28 2020, 3:01 PM
cryptoad added inline comments.Jul 28 2020, 3:10 PM
compiler-rt/lib/scudo/standalone/CMakeLists.txt
8

So there are various things we don't want from SANITIZER_COMMON_CFLAGS, like -fno-builtin etc.
The other sanitizer are not meant to be performance critical while Scudo is.
Just using SANITIZER_COMMON_CFLAGS as is wouldn't work for us.

aeubanks added inline comments.Jul 28 2020, 3:19 PM
compiler-rt/lib/scudo/standalone/CMakeLists.txt
8

Can you suggest any alternatives?
I'm not familiar with Scudo, but it seems like it's pulling in GWPAsan stuff, and that uses SANITIZER_COMMON_CFLAGS.

cryptoad added a subscriber: hctim.Jul 28 2020, 3:34 PM
cryptoad added inline comments.
compiler-rt/lib/scudo/standalone/CMakeLists.txt
8

cc: @hctim
Didn't we have some error in the past with mismatched GWP-ASan/Scudo flags?

hctim added inline comments.Jul 28 2020, 3:51 PM
compiler-rt/lib/scudo/standalone/CMakeLists.txt
8

I vaguely remember something like this - but I believe it was prior to the standalone version of scudo.

We should probably remove ${SANITIZER_COMMON_CFLAGS} from GWP-ASan now that there's an integration into scudo standalone.

aeubanks updated this revision to Diff 281410.Jul 28 2020, 4:28 PM

Manually add -fno-lto to Scudo flags instead
Add FIXME for sharing flags with GWPAsan

aeubanks retitled this revision from [Scudo][CMake] Initialize SCUDO_CFLAGS with SANITIZER_COMMON_CFLAGS to [Scudo][CMake] Add -fno-lto to Scudo libraries.Jul 28 2020, 4:29 PM
aeubanks edited the summary of this revision. (Show Details)
aeubanks added a reviewer: hctim.
cryptoad added inline comments.Jul 28 2020, 4:30 PM
compiler-rt/lib/scudo/standalone/CMakeLists.txt
12

Don't you want to add NO_LTO_FLAGS to SCUDO_FLAGS?

aeubanks updated this revision to Diff 281424.Jul 28 2020, 5:14 PM

Actually do the right thing

aeubanks updated this revision to Diff 281425.Jul 28 2020, 5:15 PM

Remove extra line

aeubanks added inline comments.Jul 28 2020, 5:17 PM
compiler-rt/lib/scudo/standalone/CMakeLists.txt
12

Sorry, I'm pretty sure I tested it and thought I had fixed it, but I guess not.
I think check-scudo doesn't build TScudoCUnitTest-i386-Test.

Also I realized the lines below do what I want better so I made it similar to those lines.

cryptoad accepted this revision.Jul 29 2020, 10:21 AM
This revision is now accepted and ready to land.Jul 29 2020, 10:21 AM
This revision was automatically updated to reflect the committed changes.