This is an archive of the discontinued LLVM Phabricator instance.

[sanitizer] Fix for CMAKE_CXX_FLAGS update
AcceptedPublic

Authored by bcain on Aug 16 2021, 5:42 PM.

Details

Reviewers
vitalybuka
Summary

Adds a cmake fix for empty CMAKE_CXX_FLAGS in gwp_asan, profile,
scudo-standalone.

Diff Detail

Event Timeline

bcain created this revision.Aug 16 2021, 5:42 PM
bcain requested review of this revision.Aug 16 2021, 5:42 PM
Herald added a subscriber: Restricted Project. · View Herald TranscriptAug 16 2021, 5:42 PM
vitalybuka added inline comments.Aug 17 2021, 10:21 AM
compiler-rt/lib/gwp_asan/CMakeLists.txt
42

why do we need this if?
it looks no-op for empty string anyway

bcain abandoned this revision.Aug 17 2021, 11:58 AM
bcain added inline comments.
compiler-rt/lib/gwp_asan/CMakeLists.txt
42

cmake was giving an error about REGEX if CMAKE_CXX_FLAGS is empty: something like REGEX sub-command REPLACE requires at least four arguments.

But after removing this patch and rebuilding, I cannot reproduce the failure I saw before. I must have done something invalid.

bcain reclaimed this revision.Aug 18 2021, 6:13 AM
bcain added inline comments.
compiler-rt/lib/gwp_asan/CMakeLists.txt
42

Ok I have reproduced the failure. hexagon-unknown-linux-musl-clang++ is built with CLANG_DEFAULT_CXX_STDLIB="libc++". Perhaps that eliminates the need for CMAKE_CXX_FLAGS to contain -stdlib=libc++? And if it's not there (and CMAKE_CXX_FLAGS is empty), I get this failure:

CMake Error at lib/scudo/standalone/CMakeLists.txt:14 (string):
string sub-command REGEX, mode REPLACE needs at least 6 arguments total to
command.

... and for lib/profile/CMakeLists.txt:116 etc.

bcain retitled this revision from [PATCH 5/8] [sanitizer] Fix for CMAKE_CXX_FLAGS update to [sanitizer] Fix for CMAKE_CXX_FLAGS update.Aug 18 2021, 4:05 PM
vitalybuka added inline comments.Aug 19 2021, 2:13 AM
compiler-rt/lib/gwp_asan/CMakeLists.txt
42

This should be enough

bcain updated this revision to Diff 367482.Aug 19 2021, 6:28 AM

Changed to suggested fix

vitalybuka accepted this revision.Aug 19 2021, 10:47 AM
This revision is now accepted and ready to land.Aug 19 2021, 10:47 AM