[PATCH] D78325: [ubsan] Link shared runtime library with a version script.

Evgenii Stepanov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 16 17:51:12 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rG77e3a2e0fe02: [ubsan] Link shared runtime library with a version script. (authored by eugenis).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D78325/new/

https://reviews.llvm.org/D78325

Files:
  compiler-rt/lib/ubsan/CMakeLists.txt


Index: compiler-rt/lib/ubsan/CMakeLists.txt
===================================================================
--- compiler-rt/lib/ubsan/CMakeLists.txt
+++ compiler-rt/lib/ubsan/CMakeLists.txt
@@ -199,21 +199,41 @@
       PARENT_TARGET ubsan)
 
     if (FUCHSIA OR UNIX)
-      add_compiler_rt_runtime(clang_rt.ubsan_standalone
-        SHARED
+      file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/dummy.cpp "")
+      add_compiler_rt_object_libraries(RTUbsan_dynamic_version_script_dummy
         ARCHS ${UBSAN_SUPPORTED_ARCH}
-        OBJECT_LIBS RTSanitizerCommon
-              RTSanitizerCommonLibc
-              RTSanitizerCommonCoverage
-              RTSanitizerCommonSymbolizer
-              RTUbsan
-              RTUbsan_cxx
-              RTUbsan_standalone
-              RTInterception
-        CFLAGS ${UBSAN_CFLAGS}
-        LINK_FLAGS ${SANITIZER_COMMON_LINK_FLAGS}
-        LINK_LIBS ${UBSAN_DYNAMIC_LIBS}
-        PARENT_TARGET ubsan)
+        SOURCES ${CMAKE_CURRENT_BINARY_DIR}/dummy.cpp
+        CFLAGS ${UBSAN_CFLAGS})
+
+      foreach(arch ${UBSAN_SUPPORTED_ARCH})
+        add_sanitizer_rt_version_list(clang_rt.ubsan_standalone-dynamic-${arch}
+                                      LIBS clang_rt.ubsan_standalone-${arch}
+                                           clang_rt.ubsan_standalone_cxx-${arch}
+                                      EXTRA ubsan.syms.extra)
+        set(VERSION_SCRIPT_FLAG
+            -Wl,--version-script,${CMAKE_CURRENT_BINARY_DIR}/clang_rt.ubsan_standalone-dynamic-${arch}.vers)
+        set_property(SOURCE
+          ${CMAKE_CURRENT_BINARY_DIR}/dummy.cpp
+          APPEND PROPERTY
+          OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/clang_rt.ubsan_standalone-dynamic-${arch}.vers)
+
+        add_compiler_rt_runtime(clang_rt.ubsan_standalone
+          SHARED
+          ARCHS ${arch}
+          OBJECT_LIBS RTSanitizerCommon
+                RTSanitizerCommonLibc
+                RTSanitizerCommonCoverage
+                RTSanitizerCommonSymbolizer
+                RTUbsan
+                RTUbsan_cxx
+                RTUbsan_standalone
+                RTInterception
+                RTUbsan_dynamic_version_script_dummy
+          CFLAGS ${UBSAN_CFLAGS}
+          LINK_FLAGS ${UBSAN_LINK_FLAGS} ${VERSION_SCRIPT_FLAG}
+          LINK_LIBS ${UBSAN_DYNAMIC_LIBS}
+          PARENT_TARGET ubsan)
+      endforeach()
 
       set(ARCHS_FOR_SYMBOLS ${UBSAN_SUPPORTED_ARCH})
       list(REMOVE_ITEM ARCHS_FOR_SYMBOLS i386)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D78325.258213.patch
Type: text/x-patch
Size: 2484 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200417/4a58e98a/attachment.bin>


More information about the llvm-commits mailing list