[PATCH] D52770: [sanitizer] Use -Wl, -z, global on Android for sanitizers except UBsan
Stephen Hines via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 2 09:21:56 PDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL343599: [sanitizer] Use -Wl,-z,global on Android for sanitizers except UBsan (authored by srhines, committed by ).
Repository:
rL LLVM
https://reviews.llvm.org/D52770
Files:
compiler-rt/trunk/CMakeLists.txt
compiler-rt/trunk/lib/asan/CMakeLists.txt
compiler-rt/trunk/lib/hwasan/CMakeLists.txt
compiler-rt/trunk/lib/scudo/CMakeLists.txt
Index: compiler-rt/trunk/CMakeLists.txt
===================================================================
--- compiler-rt/trunk/CMakeLists.txt
+++ compiler-rt/trunk/CMakeLists.txt
@@ -385,14 +385,6 @@
append_list_if(COMPILER_RT_HAS_LIBC c SANITIZER_COMMON_LINK_LIBS)
-if(ANDROID)
-# Put the Sanitizer shared libraries in the global group. For more details, see
-# android-changes-for-ndk-developers.md#changes-to-library-search-order
- if (COMPILER_RT_HAS_Z_GLOBAL)
- list(APPEND SANITIZER_COMMON_LINK_FLAGS -Wl,-z,global)
- endif()
-endif()
-
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Fuchsia")
list(APPEND SANITIZER_COMMON_LINK_FLAGS -Wl,-z,defs,-z,now,-z,relro)
list(APPEND SANITIZER_COMMON_LINK_LIBS zircon)
Index: compiler-rt/trunk/lib/asan/CMakeLists.txt
===================================================================
--- compiler-rt/trunk/lib/asan/CMakeLists.txt
+++ compiler-rt/trunk/lib/asan/CMakeLists.txt
@@ -75,6 +75,14 @@
set(ASAN_DYNAMIC_LINK_FLAGS ${SANITIZER_COMMON_LINK_FLAGS})
+if(ANDROID)
+# Put most Sanitizer shared libraries in the global group. For more details, see
+# android-changes-for-ndk-developers.md#changes-to-library-search-order
+ if (COMPILER_RT_HAS_Z_GLOBAL)
+ list(APPEND ASAN_DYNAMIC_LINK_FLAGS -Wl,-z,global)
+ endif()
+endif()
+
set(ASAN_DYNAMIC_DEFINITIONS
${ASAN_COMMON_DEFINITIONS} ASAN_DYNAMIC=1)
append_list_if(WIN32 INTERCEPTION_DYNAMIC_CRT ASAN_DYNAMIC_DEFINITIONS)
Index: compiler-rt/trunk/lib/hwasan/CMakeLists.txt
===================================================================
--- compiler-rt/trunk/lib/hwasan/CMakeLists.txt
+++ compiler-rt/trunk/lib/hwasan/CMakeLists.txt
@@ -41,6 +41,14 @@
set(HWASAN_DYNAMIC_LINK_FLAGS ${SANITIZER_COMMON_LINK_FLAGS})
+if(ANDROID)
+# Put most Sanitizer shared libraries in the global group. For more details, see
+# android-changes-for-ndk-developers.md#changes-to-library-search-order
+ if (COMPILER_RT_HAS_Z_GLOBAL)
+ list(APPEND HWASAN_DYNAMIC_LINK_FLAGS -Wl,-z,global)
+ endif()
+endif()
+
set(HWASAN_DYNAMIC_CFLAGS ${HWASAN_RTL_CFLAGS})
append_list_if(COMPILER_RT_HAS_FTLS_MODEL_INITIAL_EXEC
-ftls-model=initial-exec HWASAN_DYNAMIC_CFLAGS)
Index: compiler-rt/trunk/lib/scudo/CMakeLists.txt
===================================================================
--- compiler-rt/trunk/lib/scudo/CMakeLists.txt
+++ compiler-rt/trunk/lib/scudo/CMakeLists.txt
@@ -17,6 +17,14 @@
# Use gc-sections by default to avoid unused code being pulled in.
list(APPEND SCUDO_DYNAMIC_LINK_FLAGS -Wl,--gc-sections)
+if(ANDROID)
+# Put most Sanitizer shared libraries in the global group. For more details, see
+# android-changes-for-ndk-developers.md#changes-to-library-search-order
+ if (COMPILER_RT_HAS_Z_GLOBAL)
+ list(APPEND SCUDO_DYNAMIC_LINK_FLAGS -Wl,-z,global)
+ endif()
+endif()
+
# The minimal Scudo runtime does not inlude the UBSan runtime.
set(SCUDO_MINIMAL_OBJECT_LIBS
RTSanitizerCommonNoTermination
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52770.167957.patch
Type: text/x-patch
Size: 2951 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181002/33db4b7f/attachment.bin>
More information about the llvm-commits
mailing list