diff options
| author | Alexey Samsonov <samsonov@google.com> | 2014-03-31 13:45:36 +0000 |
|---|---|---|
| committer | Alexey Samsonov <samsonov@google.com> | 2014-03-31 13:45:36 +0000 |
| commit | 78a8435fd6b85abc3348d3ec80d4ef53dd281067 (patch) | |
| tree | d3a41eac880d85f822fa2fd29116dadd1dcc916f /compiler-rt | |
| parent | 66f560903fa3fba322d9b07cd1871da343a6cfe3 (diff) | |
| download | bcm5719-llvm-78a8435fd6b85abc3348d3ec80d4ef53dd281067.tar.gz bcm5719-llvm-78a8435fd6b85abc3348d3ec80d4ef53dd281067.zip | |
[CMake] Rename add_compiler_rt_static_runtime to add_compiler_rt_runtime.
Soon there will be an option to build compiler-rt parts as shared libraries
on Linux. Extracted from http://llvm-reviews.chandlerc.com/D3042
by Yuri Gribov.
llvm-svn: 205183
Diffstat (limited to 'compiler-rt')
| -rw-r--r-- | compiler-rt/cmake/Modules/AddCompilerRT.cmake | 26 | ||||
| -rw-r--r-- | compiler-rt/lib/asan/CMakeLists.txt | 10 | ||||
| -rw-r--r-- | compiler-rt/lib/builtins/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | compiler-rt/lib/dfsan/CMakeLists.txt | 4 | ||||
| -rw-r--r-- | compiler-rt/lib/lsan/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | compiler-rt/lib/msan/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | compiler-rt/lib/profile/CMakeLists.txt | 3 | ||||
| -rw-r--r-- | compiler-rt/lib/sanitizer_common/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | compiler-rt/lib/tsan/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | compiler-rt/lib/tsan/dd/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | compiler-rt/lib/ubsan/CMakeLists.txt | 4 |
11 files changed, 31 insertions, 28 deletions
diff --git a/compiler-rt/cmake/Modules/AddCompilerRT.cmake b/compiler-rt/cmake/Modules/AddCompilerRT.cmake index 48067796099..556ada48ae7 100644 --- a/compiler-rt/cmake/Modules/AddCompilerRT.cmake +++ b/compiler-rt/cmake/Modules/AddCompilerRT.cmake @@ -37,33 +37,37 @@ macro(add_compiler_rt_darwin_object_library name os) COMPILE_DEFINITIONS ${LIB_DEFS}) endmacro() -# Adds static runtime for a given architecture and puts it in the proper -# directory in the build and install trees. -# add_compiler_rt_static_runtime(<name> <arch> -# SOURCES <source files> -# CFLAGS <compile flags> -# DEFS <compile definitions>) -macro(add_compiler_rt_static_runtime name arch) +# Adds static or shared runtime for a given architecture and puts it in the +# proper directory in the build and install trees. +# add_compiler_rt_runtime(<name> <arch> {STATIC,SHARED} +# SOURCES <source files> +# CFLAGS <compile flags> +# DEFS <compile definitions>) +macro(add_compiler_rt_runtime name arch type) if(CAN_TARGET_${arch}) parse_arguments(LIB "SOURCES;CFLAGS;DEFS" "" ${ARGN}) - add_library(${name} STATIC ${LIB_SOURCES}) + add_library(${name} ${type} ${LIB_SOURCES}) # Setup compile flags and definitions. set_target_compile_flags(${name} ${TARGET_${arch}_CFLAGS} ${LIB_CFLAGS}) + set_target_link_flags(${name} + ${TARGET_${arch}_CFLAGS} ${LIB_CFLAGS}) set_property(TARGET ${name} APPEND PROPERTY COMPILE_DEFINITIONS ${LIB_DEFS}) # Setup correct output directory in the build tree. set_target_properties(${name} PROPERTIES - ARCHIVE_OUTPUT_DIRECTORY ${COMPILER_RT_LIBRARY_OUTPUT_DIR}) + ARCHIVE_OUTPUT_DIRECTORY ${COMPILER_RT_LIBRARY_OUTPUT_DIR} + LIBRARY_OUTPUT_DIRECTORY ${COMPILER_RT_LIBRARY_OUTPUT_DIR}) # Add installation command. install(TARGETS ${name} - ARCHIVE DESTINATION ${COMPILER_RT_LIBRARY_INSTALL_DIR}) + ARCHIVE DESTINATION ${COMPILER_RT_LIBRARY_INSTALL_DIR} + LIBRARY DESTINATION ${COMPILER_RT_LIBRARY_INSTALL_DIR}) else() message(FATAL_ERROR "Archtecture ${arch} can't be targeted") endif() endmacro() -# Same as add_compiler_rt_static_runtime, but creates a universal library +# Same as add_compiler_rt_runtime(... STATIC), but creates a universal library # for several architectures. # add_compiler_rt_osx_static_runtime(<name> ARCH <architectures> # SOURCES <source files> diff --git a/compiler-rt/lib/asan/CMakeLists.txt b/compiler-rt/lib/asan/CMakeLists.txt index 5bfb7c1791a..d1c0d801c6d 100644 --- a/compiler-rt/lib/asan/CMakeLists.txt +++ b/compiler-rt/lib/asan/CMakeLists.txt @@ -113,7 +113,7 @@ else() list(APPEND ASAN_RUNTIME_OBJECTS $<TARGET_OBJECTS:RTLSanCommon.${arch}>) endif() - add_compiler_rt_static_runtime(clang_rt.asan-${arch} ${arch} + add_compiler_rt_runtime(clang_rt.asan-${arch} ${arch} STATIC SOURCES ${ASAN_RUNTIME_OBJECTS} CFLAGS ${ASAN_CFLAGS} DEFS ${ASAN_COMMON_DEFINITIONS}) @@ -124,10 +124,10 @@ else() endif() if (WIN32) - add_compiler_rt_static_runtime(clang_rt.asan_dll_thunk-${arch} ${arch} - SOURCES asan_dll_thunk.cc - CFLAGS ${ASAN_CFLAGS} -DASAN_DLL_THUNK - DEFS ${ASAN_COMMON_DEFINITIONS}) + add_compiler_rt_runtime(clang_rt.asan_dll_thunk-${arch} ${arch} STATIC + SOURCES asan_dll_thunk.cc + CFLAGS ${ASAN_CFLAGS} -DASAN_DLL_THUNK + DEFS ${ASAN_COMMON_DEFINITIONS}) add_dependencies(asan clang_rt.asan_dll_thunk-${arch}) endif() endforeach() diff --git a/compiler-rt/lib/builtins/CMakeLists.txt b/compiler-rt/lib/builtins/CMakeLists.txt index 4887c5d0758..0c88893e1a9 100644 --- a/compiler-rt/lib/builtins/CMakeLists.txt +++ b/compiler-rt/lib/builtins/CMakeLists.txt @@ -247,7 +247,7 @@ add_custom_target(builtins) if (NOT WIN32) foreach(arch x86_64 i386 arm) if(CAN_TARGET_${arch}) - add_compiler_rt_static_runtime(clang_rt.${arch} ${arch} + add_compiler_rt_runtime(clang_rt.${arch} ${arch} STATIC SOURCES ${${arch}_SOURCES} CFLAGS "-std=c99") add_dependencies(builtins clang_rt.${arch}) diff --git a/compiler-rt/lib/dfsan/CMakeLists.txt b/compiler-rt/lib/dfsan/CMakeLists.txt index bcf335df95d..18fe3457610 100644 --- a/compiler-rt/lib/dfsan/CMakeLists.txt +++ b/compiler-rt/lib/dfsan/CMakeLists.txt @@ -15,14 +15,14 @@ set(arch "x86_64") if(CAN_TARGET_${arch}) set(DFSAN_CFLAGS ${DFSAN_COMMON_CFLAGS}) append_if(COMPILER_RT_HAS_FPIE_FLAG -fPIE DFSAN_CFLAGS) - add_compiler_rt_static_runtime(clang_rt.dfsan-${arch} ${arch} + add_compiler_rt_runtime(clang_rt.dfsan-${arch} ${arch} STATIC SOURCES ${DFSAN_RTL_SOURCES} $<TARGET_OBJECTS:RTInterception.${arch}> $<TARGET_OBJECTS:RTSanitizerCommon.${arch}> $<TARGET_OBJECTS:RTSanitizerCommonLibc.${arch}> CFLAGS ${DFSAN_CFLAGS}) set(DFSAN_NOLIBC_CFLAGS ${DFSAN_COMMON_CFLAGS} -DDFSAN_NOLIBC) - add_compiler_rt_static_runtime(clang_rt.dfsan-libc-${arch} ${arch} + add_compiler_rt_runtime(clang_rt.dfsan-libc-${arch} ${arch} STATIC SOURCES ${DFSAN_RTL_SOURCES} $<TARGET_OBJECTS:RTSanitizerCommon.${arch}> CFLAGS ${DFSAN_NOLIBC_CFLAGS}) diff --git a/compiler-rt/lib/lsan/CMakeLists.txt b/compiler-rt/lib/lsan/CMakeLists.txt index 8b026be6be8..0924282a6ea 100644 --- a/compiler-rt/lib/lsan/CMakeLists.txt +++ b/compiler-rt/lib/lsan/CMakeLists.txt @@ -38,7 +38,7 @@ elseif(NOT ANDROID) endforeach() foreach(arch ${LSAN_SUPPORTED_ARCH}) - add_compiler_rt_static_runtime(clang_rt.lsan-${arch} ${arch} + add_compiler_rt_runtime(clang_rt.lsan-${arch} ${arch} STATIC SOURCES ${LSAN_SOURCES} $<TARGET_OBJECTS:RTInterception.${arch}> $<TARGET_OBJECTS:RTSanitizerCommon.${arch}> diff --git a/compiler-rt/lib/msan/CMakeLists.txt b/compiler-rt/lib/msan/CMakeLists.txt index 47795e3c8b0..7a53026065d 100644 --- a/compiler-rt/lib/msan/CMakeLists.txt +++ b/compiler-rt/lib/msan/CMakeLists.txt @@ -20,7 +20,7 @@ append_if(COMPILER_RT_HAS_FFREESTANDING_FLAG -ffreestanding MSAN_RTL_CFLAGS) add_custom_target(msan) set(arch "x86_64") if(CAN_TARGET_${arch}) - add_compiler_rt_static_runtime(clang_rt.msan-${arch} ${arch} + add_compiler_rt_runtime(clang_rt.msan-${arch} ${arch} STATIC SOURCES ${MSAN_RTL_SOURCES} $<TARGET_OBJECTS:RTInterception.${arch}> $<TARGET_OBJECTS:RTSanitizerCommon.${arch}> diff --git a/compiler-rt/lib/profile/CMakeLists.txt b/compiler-rt/lib/profile/CMakeLists.txt index 526017f2e93..8d0a5d0d0fc 100644 --- a/compiler-rt/lib/profile/CMakeLists.txt +++ b/compiler-rt/lib/profile/CMakeLists.txt @@ -25,8 +25,7 @@ else() InstrProfilingRuntime.cc) foreach(arch ${PROFILE_SUPPORTED_ARCH}) - add_compiler_rt_static_runtime(clang_rt.profile-${arch} - ${arch} + add_compiler_rt_runtime(clang_rt.profile-${arch} ${arch} STATIC SOURCES ${PROFILE_SOURCES}) add_dependencies(profile clang_rt.profile-${arch}) endforeach() diff --git a/compiler-rt/lib/sanitizer_common/CMakeLists.txt b/compiler-rt/lib/sanitizer_common/CMakeLists.txt index 854aa402443..d28e5e6e3db 100644 --- a/compiler-rt/lib/sanitizer_common/CMakeLists.txt +++ b/compiler-rt/lib/sanitizer_common/CMakeLists.txt @@ -129,7 +129,7 @@ else() DEFS ${SANITIZER_COMMON_DEFINITIONS}) list(APPEND SANITIZER_RUNTIME_LIBRARIES RTSanitizerCommon.${arch} RTSanitizerCommonLibc.${arch}) - add_compiler_rt_static_runtime(clang_rt.san-${arch} ${arch} + add_compiler_rt_runtime(clang_rt.san-${arch} ${arch} STATIC SOURCES $<TARGET_OBJECTS:RTSanitizerCommon.${arch}> $<TARGET_OBJECTS:RTSanitizerCommonLibc.${arch}> CFLAGS ${SANITIZER_CFLAGS} diff --git a/compiler-rt/lib/tsan/CMakeLists.txt b/compiler-rt/lib/tsan/CMakeLists.txt index 4de713843e3..792d259f43a 100644 --- a/compiler-rt/lib/tsan/CMakeLists.txt +++ b/compiler-rt/lib/tsan/CMakeLists.txt @@ -83,7 +83,7 @@ if(CAN_TARGET_x86_64 AND UNIX AND NOT APPLE) set_source_files_properties(${TSAN_ASM_SOURCES} PROPERTIES LANGUAGE C) set(arch "x86_64") - add_compiler_rt_static_runtime(clang_rt.tsan-${arch} ${arch} + add_compiler_rt_runtime(clang_rt.tsan-${arch} ${arch} STATIC SOURCES ${TSAN_SOURCES} ${TSAN_ASM_SOURCES} $<TARGET_OBJECTS:RTInterception.${arch}> $<TARGET_OBJECTS:RTSanitizerCommon.${arch}> diff --git a/compiler-rt/lib/tsan/dd/CMakeLists.txt b/compiler-rt/lib/tsan/dd/CMakeLists.txt index 305e26c078a..a21e2dd57f6 100644 --- a/compiler-rt/lib/tsan/dd/CMakeLists.txt +++ b/compiler-rt/lib/tsan/dd/CMakeLists.txt @@ -26,7 +26,7 @@ add_custom_target(dd) # Deadlock detector is currently supported on 64-bit Linux only. if(CAN_TARGET_x86_64 AND UNIX AND NOT APPLE AND NOT ANDROID) set(arch "x86_64") - add_compiler_rt_static_runtime(clang_rt.dd-${arch} ${arch} + add_compiler_rt_runtime(clang_rt.dd-${arch} ${arch} STATIC SOURCES ${DD_SOURCES} $<TARGET_OBJECTS:RTInterception.${arch}> $<TARGET_OBJECTS:RTSanitizerCommon.${arch}> diff --git a/compiler-rt/lib/ubsan/CMakeLists.txt b/compiler-rt/lib/ubsan/CMakeLists.txt index 33cedeee934..78c0d703d95 100644 --- a/compiler-rt/lib/ubsan/CMakeLists.txt +++ b/compiler-rt/lib/ubsan/CMakeLists.txt @@ -29,11 +29,11 @@ else() # Build separate libraries for each target. foreach(arch ${UBSAN_SUPPORTED_ARCH}) # Main UBSan runtime. - add_compiler_rt_static_runtime(clang_rt.ubsan-${arch} ${arch} + add_compiler_rt_runtime(clang_rt.ubsan-${arch} ${arch} STATIC SOURCES ${UBSAN_SOURCES} CFLAGS ${UBSAN_CFLAGS}) # C++-specific parts of UBSan runtime. Requires a C++ ABI library. - add_compiler_rt_static_runtime(clang_rt.ubsan_cxx-${arch} ${arch} + add_compiler_rt_runtime(clang_rt.ubsan_cxx-${arch} ${arch} STATIC SOURCES ${UBSAN_CXX_SOURCES} CFLAGS ${UBSAN_CFLAGS}) add_dependencies(ubsan |

