[libc-commits] [libc] 148a4b2 - [libc] change ASAN condition to generator expression

Michael Jones via libc-commits libc-commits at lists.llvm.org
Tue Feb 15 16:12:19 PST 2022


Author: Michael Jones
Date: 2022-02-15T16:12:12-08:00
New Revision: 148a4b240e24fb84dd070c644697a571589fbe86

URL: https://github.com/llvm/llvm-project/commit/148a4b240e24fb84dd070c644697a571589fbe86
DIFF: https://github.com/llvm/llvm-project/commit/148a4b240e24fb84dd070c644697a571589fbe86.diff

LOG: [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

Added: 
    

Modified: 
    libc/cmake/modules/LLVMLibCLibraryRules.cmake
    libc/src/stdlib/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/libc/cmake/modules/LLVMLibCLibraryRules.cmake b/libc/cmake/modules/LLVMLibCLibraryRules.cmake
index 14a2bc5f0406d..5d7c6549796a4 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 $<TARGET_OBJECTS:${dep}>)
+    list(APPEND objects $<$<STREQUAL:$<TARGET_NAME_IF_EXISTS:${dep}>,${dep}>:$<TARGET_OBJECTS:${dep}>>)
   endforeach(dep)
 
   add_library(

diff  --git a/libc/src/stdlib/CMakeLists.txt b/libc/src/stdlib/CMakeLists.txt
index d27d86f505b61..d679b068ee313 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


        


More information about the libc-commits mailing list