mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-11-25 06:40:18 +00:00
[SCUDO] add cmake options for custom sysroot
These options will allow the SCUDO standalone to be built with custom headers. Specifically, this patch will enable building with the LLVM-libc headers. Reviewed By: abrachet Differential Revision: https://reviews.llvm.org/D135702
This commit is contained in:
parent
9f1f21c49d
commit
b9663ebbf8
@ -57,6 +57,13 @@ option(COMPILER_RT_BUILD_GWP_ASAN "Build GWP-ASan, and link it into SCUDO" ON)
|
||||
mark_as_advanced(COMPILER_RT_BUILD_GWP_ASAN)
|
||||
option(COMPILER_RT_ENABLE_CET "Build Compiler RT with CET enabled" OFF)
|
||||
|
||||
option(COMPILER_RT_SCUDO_STANDALONE_SYSROOT_PATH "Set custom sysroot for building SCUDO standalone" OFF)
|
||||
mark_as_advanced(COMPILER_RT_SCUDO_STANDALONE_SYSROOT_PATH)
|
||||
option(COMPILER_RT_SCUDO_STANDALONE_BUILD_SHARED "Build SCUDO standalone for shared libraries" ON)
|
||||
mark_as_advanced(COMPILER_RT_SCUDO_STANDALONE_BUILD_SHARED)
|
||||
option(COMPILER_RT_BUILD_SCUDO_STANDALONE_WITH_LLVM_LIBC "Build SCUDO standalone with LLVM's libc headers" OFF)
|
||||
mark_as_advanced(COMPILER_RT_BUILD_SCUDO_STANDALONE_WITH_LLVM_LIBC)
|
||||
|
||||
if(FUCHSIA)
|
||||
set(COMPILER_RT_HWASAN_WITH_INTERCEPTORS_DEFAULT OFF)
|
||||
else()
|
||||
|
@ -38,6 +38,10 @@ list(APPEND SCUDO_LINK_FLAGS -ffunction-sections -fdata-sections -Wl,--gc-sectio
|
||||
append_list_if(COMPILER_RT_HAS_NOSTDLIBXX_FLAG -nostdlib++ SCUDO_LINK_FLAGS)
|
||||
append_list_if(CXX_SUPPORTS_UNWINDLIB_NONE_FLAG --unwindlib=none SCUDO_LINK_FLAGS)
|
||||
|
||||
if(COMPILER_RT_SCUDO_STANDALONE_SYSROOT_PATH)
|
||||
list(APPEND SCUDO_CFLAGS "--sysroot=${COMPILER_RT_SCUDO_STANDALONE_SYSROOT_PATH}")
|
||||
endif()
|
||||
|
||||
if(ANDROID)
|
||||
list(APPEND SCUDO_CFLAGS -fno-emulated-tls)
|
||||
|
||||
@ -137,6 +141,14 @@ endif()
|
||||
|
||||
set(SCUDO_LINK_LIBS ${COMPILER_RT_UNWINDER_LINK_LIBS})
|
||||
|
||||
if(COMPILER_RT_BUILD_SCUDO_STANDALONE_WITH_LLVM_LIBC)
|
||||
include_directories(${COMPILER_RT_BINARY_DIR}/../libc/include/)
|
||||
|
||||
set(SCUDO_DEPS libc-headers)
|
||||
|
||||
list(APPEND SCUDO_CFLAGS "-ffreestanding")
|
||||
endif()
|
||||
|
||||
append_list_if(COMPILER_RT_HAS_LIBPTHREAD -pthread SCUDO_LINK_FLAGS)
|
||||
|
||||
append_list_if(FUCHSIA zircon SCUDO_LINK_LIBS)
|
||||
@ -150,17 +162,20 @@ if(COMPILER_RT_HAS_SCUDO_STANDALONE)
|
||||
ARCHS ${SCUDO_STANDALONE_SUPPORTED_ARCH}
|
||||
SOURCES ${SCUDO_SOURCES}
|
||||
ADDITIONAL_HEADERS ${SCUDO_HEADERS}
|
||||
CFLAGS ${SCUDO_CFLAGS})
|
||||
CFLAGS ${SCUDO_CFLAGS}
|
||||
DEPS ${SCUDO_DEPS})
|
||||
add_compiler_rt_object_libraries(RTScudoStandaloneCWrappers
|
||||
ARCHS ${SCUDO_STANDALONE_SUPPORTED_ARCH}
|
||||
SOURCES ${SCUDO_SOURCES_C_WRAPPERS}
|
||||
ADDITIONAL_HEADERS ${SCUDO_HEADERS}
|
||||
CFLAGS ${SCUDO_CFLAGS})
|
||||
CFLAGS ${SCUDO_CFLAGS}
|
||||
DEPS ${SCUDO_DEPS})
|
||||
add_compiler_rt_object_libraries(RTScudoStandaloneCxxWrappers
|
||||
ARCHS ${SCUDO_STANDALONE_SUPPORTED_ARCH}
|
||||
SOURCES ${SCUDO_SOURCES_CXX_WRAPPERS}
|
||||
ADDITIONAL_HEADERS ${SCUDO_HEADERS}
|
||||
CFLAGS ${SCUDO_CFLAGS})
|
||||
CFLAGS ${SCUDO_CFLAGS}
|
||||
DEPS ${SCUDO_DEPS})
|
||||
|
||||
add_compiler_rt_runtime(clang_rt.scudo_standalone
|
||||
STATIC
|
||||
@ -168,6 +183,7 @@ if(COMPILER_RT_HAS_SCUDO_STANDALONE)
|
||||
SOURCES ${SCUDO_SOURCES} ${SCUDO_SOURCES_C_WRAPPERS}
|
||||
ADDITIONAL_HEADERS ${SCUDO_HEADERS}
|
||||
CFLAGS ${SCUDO_CFLAGS}
|
||||
DEPS ${SCUDO_DEPS}
|
||||
OBJECT_LIBS ${SCUDO_OBJECT_LIBS}
|
||||
PARENT_TARGET scudo_standalone)
|
||||
add_compiler_rt_runtime(clang_rt.scudo_standalone_cxx
|
||||
@ -176,18 +192,22 @@ if(COMPILER_RT_HAS_SCUDO_STANDALONE)
|
||||
SOURCES ${SCUDO_SOURCES_CXX_WRAPPERS}
|
||||
ADDITIONAL_HEADERS ${SCUDO_HEADERS}
|
||||
CFLAGS ${SCUDO_CFLAGS}
|
||||
DEPS ${SCUDO_DEPS}
|
||||
PARENT_TARGET scudo_standalone)
|
||||
|
||||
add_compiler_rt_runtime(clang_rt.scudo_standalone
|
||||
SHARED
|
||||
ARCHS ${SCUDO_STANDALONE_SUPPORTED_ARCH}
|
||||
SOURCES ${SCUDO_SOURCES} ${SCUDO_SOURCES_C_WRAPPERS} ${SCUDO_SOURCES_CXX_WRAPPERS}
|
||||
ADDITIONAL_HEADERS ${SCUDO_HEADERS}
|
||||
CFLAGS ${SCUDO_CFLAGS}
|
||||
OBJECT_LIBS ${SCUDO_OBJECT_LIBS}
|
||||
LINK_FLAGS ${SCUDO_LINK_FLAGS}
|
||||
LINK_LIBS ${SCUDO_LINK_LIBS}
|
||||
PARENT_TARGET scudo_standalone)
|
||||
if(COMPILER_RT_SCUDO_STANDALONE_BUILD_SHARED)
|
||||
add_compiler_rt_runtime(clang_rt.scudo_standalone
|
||||
SHARED
|
||||
ARCHS ${SCUDO_STANDALONE_SUPPORTED_ARCH}
|
||||
SOURCES ${SCUDO_SOURCES} ${SCUDO_SOURCES_C_WRAPPERS} ${SCUDO_SOURCES_CXX_WRAPPERS}
|
||||
ADDITIONAL_HEADERS ${SCUDO_HEADERS}
|
||||
CFLAGS ${SCUDO_CFLAGS}
|
||||
DEPS ${SCUDO_DEPS}
|
||||
OBJECT_LIBS ${SCUDO_OBJECT_LIBS}
|
||||
LINK_FLAGS ${SCUDO_LINK_FLAGS}
|
||||
LINK_LIBS ${SCUDO_LINK_LIBS}
|
||||
PARENT_TARGET scudo_standalone)
|
||||
endif()
|
||||
|
||||
add_subdirectory(benchmarks)
|
||||
if(COMPILER_RT_INCLUDE_TESTS)
|
||||
|
Loading…
Reference in New Issue
Block a user