Revert "Reland [compiler-rt][CMake] Properly set COMPILER_RT_HAS_LLD"
authorArthur Eubanks <aeubanks@google.com>
Tue, 6 Jun 2023 22:59:26 +0000 (15:59 -0700)
committerArthur Eubanks <aeubanks@google.com>
Tue, 6 Jun 2023 23:01:05 +0000 (16:01 -0700)
This reverts commit fffa05a2bcb548d5189e8c2e52d2ed2e7ebb2498.

This seems to cause hwasan tests to run in environments it didn't run in before.

compiler-rt/CMakeLists.txt
compiler-rt/test/hwasan/TestCases/sizes.cpp
llvm/runtimes/CMakeLists.txt

index 80954df..6489aa1 100644 (file)
@@ -738,8 +738,14 @@ if(COMPILER_RT_USE_LIBCXX)
   endif()
 endif()
 
-if(COMPILER_RT_HAS_TRUNK_LLD AND LLVM_USE_LINKER STREQUAL "lld")
+set(COMPILER_RT_LLD_PATH ${LLVM_MAIN_SRC_DIR}/tools/lld)
+if(EXISTS ${COMPILER_RT_LLD_PATH}/ AND LLVM_TOOL_LLD_BUILD)
   set(COMPILER_RT_HAS_LLD TRUE)
+else()
+  set(COMPILER_RT_LLD_PATH ${LLVM_MAIN_SRC_DIR}/../lld)
+  if(EXISTS ${COMPILER_RT_LLD_PATH}/ AND LLVM_TOOL_LLD_BUILD)
+    set(COMPILER_RT_HAS_LLD TRUE)
+  endif()
 endif()
 
 if(ANDROID)
index e3cc582..2cb70f5 100644 (file)
@@ -19,8 +19,6 @@
 // RUN: %env_hwasan_opts=allocator_may_return_null=1     %run %t new-nothrow max 2>&1
 // RUN:                                                 %run %t usable 2>&1
 
-// REQUIRES: android
-
 // Tests for various edge cases related to sizes, notably the maximum size the
 // allocator can allocate. Tests that an integer overflow in the parameters of
 // calloc is caught.
index 4f2c1a1..75256c1 100644 (file)
@@ -226,10 +226,6 @@ function(runtime_default_target)
 
   set_enable_per_target_runtime_dir()
 
-  if ("lld" IN_LIST LLVM_ENABLE_PROJECTS)
-    list(APPEND extra_args -DCOMPILER_RT_HAS_TRUNK_LLD=TRUE)
-  endif()
-
   llvm_ExternalProject_Add(runtimes
                            ${CMAKE_CURRENT_SOURCE_DIR}/../../runtimes
                            DEPENDS ${ARG_DEPENDS}
@@ -246,7 +242,6 @@ function(runtime_default_target)
                                       ${COMMON_CMAKE_ARGS}
                                       ${RUNTIMES_CMAKE_ARGS}
                                       ${ARG_CMAKE_ARGS}
-                                      ${extra_args}
                            PASSTHROUGH_PREFIXES LLVM_ENABLE_RUNTIMES
                                                 LLVM_USE_LINKER
                                                 ${ARG_PREFIXES}
@@ -339,10 +334,6 @@ function(runtime_register_target name)
 
   set_enable_per_target_runtime_dir()
 
-  if ("lld" IN_LIST LLVM_ENABLE_PROJECTS)
-    list(APPEND ${name}_extra_args -DCOMPILER_RT_HAS_TRUNK_LLD=TRUE)
-  endif()
-
   llvm_ExternalProject_Add(runtimes-${name}
                            ${CMAKE_CURRENT_SOURCE_DIR}/../../runtimes
                            DEPENDS ${ARG_DEPENDS}