[libc] change ASAN condition to generator expression

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.

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D119789
This commit is contained in:
Michael Jones 2022-02-14 15:15:22 -08:00
parent 746c68eafd
commit 148a4b240e
2 changed files with 10 additions and 11 deletions

View File

@ -82,7 +82,7 @@ function(add_entrypoint_library target_name)
list(REMOVE_DUPLICATES all_deps)
set(objects "")
foreach(dep IN LISTS all_deps)
list(APPEND objects $<TARGET_OBJECTS:${dep}>)
list(APPEND objects $<$<STREQUAL:$<TARGET_NAME_IF_EXISTS:${dep}>,${dep}>:$<TARGET_OBJECTS:${dep}>>)
endforeach(dep)
add_library(

View File

@ -210,17 +210,16 @@ if(LLVM_LIBC_INCLUDE_SCUDO)
message(FATAL_ERROR "Architecture ${LIBC_TARGET_ARCHITECTURE} is not supported by SCUDO.
Either disable LLVM_LIBC_INCLUDE_SCUDO or change your target architecture.")
endif()
list(APPEND SCUDO_DEPS RTScudoStandalone.${LIBC_TARGET_ARCHITECTURE}
RTScudoStandaloneCWrappers.${LIBC_TARGET_ARCHITECTURE})
if((LIBC_TARGET_ARCHITECTURE IN_LIST ALL_GWP_ASAN_SUPPORTED_ARCH)
AND COMPILER_RT_BUILD_GWP_ASAN)
list(APPEND SCUDO_DEPS RTGwpAsan.${LIBC_TARGET_ARCHITECTURE}
RTGwpAsanBacktraceLibc.${LIBC_TARGET_ARCHITECTURE}
RTGwpAsanSegvHandler.${LIBC_TARGET_ARCHITECTURE})
elseif(COMPILER_RT_BUILD_GWP_ASAN)
message(WARNING "Architecture ${LIBC_TARGET_ARCHITECTURE} is not supported by GWP-ASan. Skipping.")
endif()
list(APPEND SCUDO_DEPS RTScudoStandalone.${LIBC_TARGET_ARCHITECTURE}
RTScudoStandaloneCWrappers.${LIBC_TARGET_ARCHITECTURE})
list(APPEND SCUDO_DEPS
RTGwpAsan.${LIBC_TARGET_ARCHITECTURE}
RTGwpAsanBacktraceLibc.${LIBC_TARGET_ARCHITECTURE}
RTGwpAsanSegvHandler.${LIBC_TARGET_ARCHITECTURE}
)
add_entrypoint_external(
malloc
DEPENDS