This is an archive of the discontinued LLVM Phabricator instance.

sanitizer_common: Fix build for tests
ClosedPublic

Authored by melver on Jul 12 2021, 11:23 AM.

Details

Summary

It turns out that COMPILER_RT_TEST_COMPILER_CFLAGS is actually a string
that is being appended to and not a list.

Therefore, append the thread-safety flags to the string. Because CMake
separates list elements by ';' when turning into a string, also
substitute ';' with ' '.

Diff Detail

Event Timeline

melver created this revision.Jul 12 2021, 11:23 AM
melver requested review of this revision.Jul 12 2021, 11:23 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 12 2021, 11:23 AM
Herald added a subscriber: Restricted Project. · View Herald Transcript
vitalybuka added inline comments.
compiler-rt/CMakeLists.txt
370

COMPILER_RT_TEST_COMPILER_CFLAGS may have escaped ;
could you fix ; of THREAD_SAFETY_FLAGS in a separate var before appending?

vitalybuka added inline comments.Jul 12 2021, 11:30 AM
compiler-rt/CMakeLists.txt
370

is n't removing quotes around " ${THREAD_SAFETY_FLAGS}" makes it space separated?

melver updated this revision to Diff 358009.Jul 12 2021, 11:36 AM

Use temporary to build space-separated string of flags.

melver marked 2 inline comments as done.Jul 12 2021, 11:37 AM
melver added inline comments.
compiler-rt/CMakeLists.txt
370

Sadly, no.

In that case, I get:

set_default("target_cflags", "-Werror=thread-safety-Werror=thread-safety-reference-Werror=thread-safety-beta ")
hctim accepted this revision.Jul 12 2021, 3:38 PM
hctim added a subscriber: hctim.

LGTM - given timezones I'll submit to fix up the bot. Tested on my machine.

This revision is now accepted and ready to land.Jul 12 2021, 3:38 PM
This revision was automatically updated to reflect the committed changes.
thakis added a subscriber: thakis.Jul 12 2021, 4:08 PM

All compiler-rt tests are still broken on Windows even with this. I'll revert the changes that add this. (https://logs.chromium.org/logs/chromium/buildbucket/cr-buildbucket.appspot.com/8841885532543990160/+/u/package_clang/stdout?format=raw)

Oh wait, I think that run missed this change here by 36 revisions. I'll try again with this.

Oh wait, I think that run missed this change here by 36 revisions. I'll try again with this.

(Seems to work with this. Thanks for the fix!)