[compiler-rt] cadfaf2 - [compiler-rt] Make use of undefined symbols configurable

Petr Hosek via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 22 14:25:50 PDT 2021


Author: Petr Hosek
Date: 2021-06-22T14:25:36-07:00
New Revision: cadfaf2df46faf1dfe86db989583a477f27e22b4

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

LOG: [compiler-rt] Make use of undefined symbols configurable

We want to disable the use of undefined symbols on Fuchsia, but there
are cases where it might be desirable so may it configurable.

Differential Revision: https://reviews.llvm.org/D104728

Added: 
    

Modified: 
    compiler-rt/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/compiler-rt/CMakeLists.txt b/compiler-rt/CMakeLists.txt
index 5d0e617a5406..f5b07cee45c4 100644
--- a/compiler-rt/CMakeLists.txt
+++ b/compiler-rt/CMakeLists.txt
@@ -437,10 +437,18 @@ else()
 endif()
 
 append_list_if(COMPILER_RT_HAS_LIBC c SANITIZER_COMMON_LINK_LIBS)
+if("${CMAKE_SYSTEM_NAME}" STREQUAL "Fuchsia")
+  list(APPEND SANITIZER_COMMON_LINK_LIBS zircon)
+endif()
 
 if("${CMAKE_SYSTEM_NAME}" STREQUAL "Fuchsia")
+  set(SANITIZER_NO_UNDEFINED_SYMBOLS_DEFAULT ON)
+else()
+  set(SANITIZER_NO_UNDEFINED_SYMBOLS_DEFAULT OFF)
+endif()
+option(SANITIZER_NO_UNDEFINED_SYMBOLS "Report error on unresolved symbol references" ${SANITIZER_NO_UNDEFINED_SYMBOLS_DEFAULT})
+if (SANITIZER_NO_UNDEFINED_SYMBOLS)
   list(APPEND SANITIZER_COMMON_LINK_FLAGS -Wl,-z,defs)
-  list(APPEND SANITIZER_COMMON_LINK_LIBS zircon)
 endif()
 
 # TODO: COMPILER_RT_COMMON_CFLAGS and COMPILER_RT_COMMON_LINK_FLAGS are


        


More information about the llvm-commits mailing list