This is an archive of the discontinued LLVM Phabricator instance.

[compiler-rt] Add missing arguments to dynamic cflags
AcceptedPublic

Authored by bnbarham on May 6 2022, 5:49 PM.

Details

Summary

91bfccf83733e6d12a6da9f2e1a2d20a88fb974c added a shared library for
clang_rt.tsan and uses TSAN_RTL_DYNAMIC_CFLAGS for its CFLAGS. But
TSAN_RTL_DYNAMIC_CFLAGS was adding TSAN_RTL_CFLAGS before it had
actually been set with further arguments (eg. in the
COMPILER_RT_INTERCEPT_LIBDISPATCH block). Set it right before its use
to avoid this problem in the future.

Diff Detail

Event Timeline

bnbarham created this revision.May 6 2022, 5:49 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 6 2022, 5:49 PM
bnbarham requested review of this revision.May 6 2022, 5:49 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 6 2022, 5:49 PM
Herald added a subscriber: Restricted Project. · View Herald Transcript
yln accepted this revision.May 6 2022, 5:52 PM

@ZijunZhao: what do you think?

This revision is now accepted and ready to land.May 6 2022, 5:52 PM
ZijunZhao added inline comments.May 9 2022, 10:24 AM
compiler-rt/lib/tsan/rtl/CMakeLists.txt
72

I don't think we should set TSAN_RTL_DYNAMIC_CFLAGS in line 251, because we set(TSAN_RTL_DYNAMIC_CFLAGS ${TSAN_RTL_CFLAGS}) before. If we put these two statements later, the items in TSAN_RTL_DYNAMIC_CFLAGS will be different.

bnbarham added inline comments.May 9 2022, 10:51 AM
compiler-rt/lib/tsan/rtl/CMakeLists.txt
72

Sorry, I'm not quite understanding what you're saying here. TSAN_RTL_DYNAMIC_CFLAGS isn't set anywhere else in this file. The current issue is that it *doesn't* include eg. COMPILER_RT_LIBDISPATCH_CFLAGS because it was being set to TSAN_RTL_CFLAGS before TSAN_RTL_CFLAGS was actually finished having flags added to. Are you saying that was intentional?

ZijunZhao added inline comments.May 9 2022, 1:40 PM
compiler-rt/lib/tsan/rtl/CMakeLists.txt
72

yes, that's my concern. I was thinking about whether COMPILER_RT_LIBDISPATCH_CFLAGS should be included. Sorry for the misunderstanding. LGTM :D

ZijunZhao accepted this revision.May 9 2022, 1:41 PM