This is an archive of the discontinued LLVM Phabricator instance.

[libc] change ASAN condition to generator expression
ClosedPublic

Authored by michaelrj on Feb 14 2022, 3:19 PM.

Details

Summary

Previously, building LLVM-libc with GWP ASAN was conditioned on the flag
COMPILER_RT_BUILD_GWP_ASAN, which caused issues do to the default value
of the flag being set in the compiler-rt cmake, which is seperate. Now
GWP ASAN is included based on if it exists as a target, which is more
consistent.

Diff Detail

Event Timeline

michaelrj created this revision.Feb 14 2022, 3:19 PM
michaelrj requested review of this revision.Feb 14 2022, 3:19 PM
sivachandra added inline comments.Feb 14 2022, 3:45 PM
libc/src/stdlib/CMakeLists.txt
216

Using it in an if block does not seem to change the semantics. However, the following works for me:

list(APPEND SCUDO_DEPS $<$<TARGET_EXISTS:RTGwpAsan.${LIBC_TARGET_ARCHITECTURE}>:RTGwpAsan.${LIBC_TARGET_ARCHITECTURE}>
                       $<$<TARGET_EXISTS:RTGwpAsanBacktraceLibc.${LIBC_TARGET_ARCHITECTURE}>:RTGwpAsanBacktraceLibc.${LIBC_TARGET_ARCHITECTURE}>
                       $<$<TARGET_EXISTS:RTGwpAsanSegvHandler.${LIBC_TARGET_ARCHITECTURE}>:RTGwpAsanSegvHandler.${LIBC_TARGET_ARCHITECTURE}>)
michaelrj updated this revision to Diff 408657.Feb 14 2022, 3:49 PM

switch to TARGET_NAME_IF_EXISTS

michaelrj marked an inline comment as done.Feb 14 2022, 3:50 PM

move the checking to inside the library rules

sivachandra accepted this revision.Feb 15 2022, 4:10 PM
This revision is now accepted and ready to land.Feb 15 2022, 4:10 PM
This revision was automatically updated to reflect the committed changes.