[sanitizer] Build everything whereever possible with -z text.

Reviewers: pcc, phosek

Subscribers: mgorny, #sanitizers, llvm-commits

Tags: #sanitizers, #llvm

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

llvm-svn: 355164
This commit is contained in:
Evgeniy Stepanov 2019-03-01 01:45:01 +00:00
parent c4b674955c
commit 9ca1755f76
2 changed files with 3 additions and 0 deletions

View File

@ -405,6 +405,7 @@ append_list_if(MINGW -fms-extensions SANITIZER_COMMON_CFLAGS)
# Set common link flags. # Set common link flags.
append_list_if(COMPILER_RT_HAS_NODEFAULTLIBS_FLAG -nodefaultlibs SANITIZER_COMMON_LINK_FLAGS) append_list_if(COMPILER_RT_HAS_NODEFAULTLIBS_FLAG -nodefaultlibs SANITIZER_COMMON_LINK_FLAGS)
append_list_if(COMPILER_RT_HAS_Z_TEXT -Wl,-z,text SANITIZER_COMMON_LINK_FLAGS)
if (COMPILER_RT_USE_BUILTINS_LIBRARY) if (COMPILER_RT_USE_BUILTINS_LIBRARY)
list(APPEND SANITIZER_COMMON_LINK_LIBS ${COMPILER_RT_BUILTINS_LIBRARY}) list(APPEND SANITIZER_COMMON_LINK_LIBS ${COMPILER_RT_BUILTINS_LIBRARY})

View File

@ -142,6 +142,8 @@ check_library_exists(c++ __cxa_throw "" COMPILER_RT_HAS_LIBCXX)
check_library_exists(stdc++ __cxa_throw "" COMPILER_RT_HAS_LIBSTDCXX) check_library_exists(stdc++ __cxa_throw "" COMPILER_RT_HAS_LIBSTDCXX)
# Linker flags. # Linker flags.
check_linker_flag("-Wl,-z,text" COMPILER_RT_HAS_Z_TEXT)
if(ANDROID) if(ANDROID)
check_linker_flag("-Wl,-z,global" COMPILER_RT_HAS_Z_GLOBAL) check_linker_flag("-Wl,-z,global" COMPILER_RT_HAS_Z_GLOBAL)
check_library_exists(log __android_log_write "" COMPILER_RT_HAS_LIBLOG) check_library_exists(log __android_log_write "" COMPILER_RT_HAS_LIBLOG)