diff options
Diffstat (limited to 'lib/hwasan/CMakeLists.txt')
-rw-r--r-- | lib/hwasan/CMakeLists.txt | 52 |
1 files changed, 30 insertions, 22 deletions
diff --git a/lib/hwasan/CMakeLists.txt b/lib/hwasan/CMakeLists.txt index 3f3a6155590c..42bf4366f192 100644 --- a/lib/hwasan/CMakeLists.txt +++ b/lib/hwasan/CMakeLists.txt @@ -4,39 +4,38 @@ include_directories(..) set(HWASAN_RTL_SOURCES hwasan.cc hwasan_allocator.cc + hwasan_dynamic_shadow.cc hwasan_interceptors.cc hwasan_linux.cc + hwasan_poisoning.cc hwasan_report.cc hwasan_thread.cc - hwasan_poisoning.cc ) set(HWASAN_RTL_CXX_SOURCES hwasan_new_delete.cc) +set(HWASAN_RTL_HEADERS + hwasan.h + hwasan_allocator.h + hwasan_dynamic_shadow.h + hwasan_flags.h + hwasan_flags.inc + hwasan_interface_internal.h + hwasan_mapping.h + hwasan_poisoning.h + hwasan_report.h + hwasan_thread.h) + set(HWASAN_RTL_CFLAGS ${SANITIZER_COMMON_CFLAGS}) append_rtti_flag(OFF HWASAN_RTL_CFLAGS) -append_list_if(COMPILER_RT_HAS_FPIE_FLAG -fPIE HWASAN_RTL_CFLAGS) +append_list_if(COMPILER_RT_HAS_FPIC_FLAG -fPIC HWASAN_RTL_CFLAGS) # Prevent clang from generating libc calls. append_list_if(COMPILER_RT_HAS_FFREESTANDING_FLAG -ffreestanding HWASAN_RTL_CFLAGS) set(HWASAN_DYNAMIC_LINK_FLAGS ${SANITIZER_COMMON_LINK_FLAGS}) -if(ANDROID) -# On Android, -z global does not do what it is documented to do. -# On Android, -z global moves the library ahead in the lookup order, -# placing it right after the LD_PRELOADs. This is used to compensate for the fact -# that Android linker does not look at the dependencies of the main executable -# that aren't dependencies of the current DSO when resolving symbols from said DSO. -# As a net result, this allows running ASan executables without LD_PRELOAD-ing the -# ASan runtime library. -# The above is applicable to L MR1 or newer. - 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) @@ -55,13 +54,18 @@ add_compiler_rt_component(hwasan) add_compiler_rt_object_libraries(RTHwasan ARCHS ${HWASAN_SUPPORTED_ARCH} - SOURCES ${HWASAN_RTL_SOURCES} CFLAGS ${HWASAN_RTL_CFLAGS}) + SOURCES ${HWASAN_RTL_SOURCES} + ADDITIONAL_HEADERS ${HWASAN_RTL_HEADERS} + CFLAGS ${HWASAN_RTL_CFLAGS}) add_compiler_rt_object_libraries(RTHwasan_cxx ARCHS ${HWASAN_SUPPORTED_ARCH} - SOURCES ${HWASAN_RTL_CXX_SOURCES} CFLAGS ${HWASAN_RTL_CFLAGS}) + SOURCES ${HWASAN_RTL_CXX_SOURCES} + ADDITIONAL_HEADERS ${HWASAN_RTL_HEADERS} + CFLAGS ${HWASAN_RTL_CFLAGS}) add_compiler_rt_object_libraries(RTHwasan_dynamic ARCHS ${HWASAN_SUPPORTED_ARCH} - SOURCES ${HWASAN_RTL_SOURCES} ${TSAN_RTL_CXX_SOURCES} + SOURCES ${HWASAN_RTL_SOURCES} ${HWASAN_RTL_CXX_SOURCES} + ADDITIONAL_HEADERS ${HWASAN_RTL_HEADERS} CFLAGS ${HWASAN_DYNAMIC_CFLAGS}) file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/dummy.cc "") @@ -78,7 +82,9 @@ foreach(arch ${HWASAN_SUPPORTED_ARCH}) RTInterception RTSanitizerCommon RTSanitizerCommonLibc - RTUbsan + RTSanitizerCommonCoverage + RTSanitizerCommonSymbolizer + RTUbsan CFLAGS ${HWASAN_RTL_CFLAGS} PARENT_TARGET hwasan) add_compiler_rt_runtime(clang_rt.hwasan_cxx @@ -112,7 +118,9 @@ foreach(arch ${HWASAN_SUPPORTED_ARCH}) RTInterception RTSanitizerCommon RTSanitizerCommonLibc - RTUbsan + RTSanitizerCommonCoverage + RTSanitizerCommonSymbolizer + RTUbsan # The only purpose of RTHWAsan_dynamic_version_script_dummy is to # carry a dependency of the shared runtime on the version script. # Replacing it with a straightforward @@ -126,7 +134,7 @@ foreach(arch ${HWASAN_SUPPORTED_ARCH}) DEFS ${ASAN_DYNAMIC_DEFINITIONS} PARENT_TARGET hwasan) - if(UNIX) + if(SANITIZER_USE_SYMBOLS) add_sanitizer_rt_symbols(clang_rt.hwasan ARCHS ${arch} EXTRA hwasan.syms.extra) |