From 148a4b240e24fb84dd070c644697a571589fbe86 Mon Sep 17 00:00:00 2001 From: Michael Jones Date: Mon, 14 Feb 2022 15:15:22 -0800 Subject: [PATCH] [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 --- libc/cmake/modules/LLVMLibCLibraryRules.cmake | 2 +- libc/src/stdlib/CMakeLists.txt | 19 +++++++++---------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/libc/cmake/modules/LLVMLibCLibraryRules.cmake b/libc/cmake/modules/LLVMLibCLibraryRules.cmake index 14a2bc5..5d7c654 100644 --- a/libc/cmake/modules/LLVMLibCLibraryRules.cmake +++ b/libc/cmake/modules/LLVMLibCLibraryRules.cmake @@ -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 $) + list(APPEND objects $<$,${dep}>:$>) endforeach(dep) add_library( diff --git a/libc/src/stdlib/CMakeLists.txt b/libc/src/stdlib/CMakeLists.txt index d27d86f..d679b06 100644 --- a/libc/src/stdlib/CMakeLists.txt +++ b/libc/src/stdlib/CMakeLists.txt @@ -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 -- 2.7.4