Make the cfi target available on more platforms.

On non-Linux targets it just installs the blacklist.

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

llvm-svn: 315215
This commit is contained in:
Peter Collingbourne 2017-10-09 17:07:47 +00:00
parent de0cc39462
commit 107a9f624d
2 changed files with 32 additions and 31 deletions

View File

@ -559,8 +559,7 @@ else()
set(COMPILER_RT_HAS_SAFESTACK FALSE)
endif()
if (COMPILER_RT_HAS_SANITIZER_COMMON AND CFI_SUPPORTED_ARCH AND
OS_NAME MATCHES "Linux")
if (COMPILER_RT_HAS_SANITIZER_COMMON AND CFI_SUPPORTED_ARCH)
set(COMPILER_RT_HAS_CFI TRUE)
else()
set(COMPILER_RT_HAS_CFI FALSE)

View File

@ -1,37 +1,39 @@
add_compiler_rt_component(cfi)
set(CFI_SOURCES cfi.cc)
if(OS_NAME MATCHES "Linux")
set(CFI_SOURCES cfi.cc)
include_directories(..)
include_directories(..)
set(CFI_CFLAGS
${SANITIZER_COMMON_CFLAGS}
)
set(CFI_CFLAGS
${SANITIZER_COMMON_CFLAGS}
)
set(CFI_DIAG_CFLAGS
-DCFI_ENABLE_DIAG=1
)
set(CFI_DIAG_CFLAGS
-DCFI_ENABLE_DIAG=1
)
foreach(arch ${CFI_SUPPORTED_ARCH})
add_compiler_rt_runtime(clang_rt.cfi
STATIC
ARCHS ${arch}
SOURCES ${CFI_SOURCES}
OBJECT_LIBS RTInterception
RTSanitizerCommon
RTSanitizerCommonLibc
CFLAGS ${CFI_CFLAGS}
PARENT_TARGET cfi)
add_compiler_rt_runtime(clang_rt.cfi_diag
STATIC
ARCHS ${arch}
SOURCES ${CFI_SOURCES}
OBJECT_LIBS RTInterception
RTSanitizerCommon
RTSanitizerCommonLibc
RTUbsan
CFLAGS ${CFI_CFLAGS} ${CFI_DIAG_CFLAGS}
PARENT_TARGET cfi)
endforeach()
foreach(arch ${CFI_SUPPORTED_ARCH})
add_compiler_rt_runtime(clang_rt.cfi
STATIC
ARCHS ${arch}
SOURCES ${CFI_SOURCES}
OBJECT_LIBS RTInterception
RTSanitizerCommon
RTSanitizerCommonLibc
CFLAGS ${CFI_CFLAGS}
PARENT_TARGET cfi)
add_compiler_rt_runtime(clang_rt.cfi_diag
STATIC
ARCHS ${arch}
SOURCES ${CFI_SOURCES}
OBJECT_LIBS RTInterception
RTSanitizerCommon
RTSanitizerCommonLibc
RTUbsan
CFLAGS ${CFI_CFLAGS} ${CFI_DIAG_CFLAGS}
PARENT_TARGET cfi)
endforeach()
endif()
add_compiler_rt_resource_file(cfi_blacklist cfi_blacklist.txt cfi)