[compiler-rt] 3f77db7 - Add COMPILER_RT_HAS_GC_SECTIONS flag, better to check than WIN32

Russell Gallop via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 28 04:22:49 PST 2021


Author: Russell Gallop
Date: 2021-01-07T17:37:19Z
New Revision: 3f77db722ebf138b94789cc4a19f8672e183ec8c

URL: https://github.com/llvm/llvm-project/commit/3f77db722ebf138b94789cc4a19f8672e183ec8c
DIFF: https://github.com/llvm/llvm-project/commit/3f77db722ebf138b94789cc4a19f8672e183ec8c.diff

LOG: Add COMPILER_RT_HAS_GC_SECTIONS flag, better to check than WIN32

Added: 
    

Modified: 
    compiler-rt/cmake/config-ix.cmake
    compiler-rt/lib/scudo/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/compiler-rt/cmake/config-ix.cmake b/compiler-rt/cmake/config-ix.cmake
index eb266ca3a61c..01efbbd6ba92 100644
--- a/compiler-rt/cmake/config-ix.cmake
+++ b/compiler-rt/cmake/config-ix.cmake
@@ -178,6 +178,8 @@ if(ANDROID)
   check_library_exists(log __android_log_write "" COMPILER_RT_HAS_LIBLOG)
 endif()
 
+check_linker_flag("-Wl,--gc-sections" COMPILER_RT_HAS_GC_SECTIONS)
+
 # Architectures.
 
 # List of all architectures we can target.

diff  --git a/compiler-rt/lib/scudo/CMakeLists.txt b/compiler-rt/lib/scudo/CMakeLists.txt
index b473c23f05c4..f76817f38012 100644
--- a/compiler-rt/lib/scudo/CMakeLists.txt
+++ b/compiler-rt/lib/scudo/CMakeLists.txt
@@ -19,7 +19,7 @@ append_list_if(COMPILER_RT_HAS_OMIT_FRAME_POINTER_FLAG -fno-omit-frame-pointer
 
 set(SCUDO_DYNAMIC_LINK_FLAGS ${SANITIZER_COMMON_LINK_FLAGS})
 # Use gc-sections by default to avoid unused code being pulled in.
-if (!WIN32)
+if (COMPILER_RT_HAS_GC_SECTIONS)
   list(APPEND SCUDO_DYNAMIC_LINK_FLAGS -Wl,--gc-sections)
 endif()
 


        


More information about the llvm-commits mailing list