Another big step toward a viable CMake build system for CompilerRT,

ASan, and friends.

This explicitly switches the CompilerRT CMake build to require CMake
version 2.8.8 or newer which provides first-class support for "object"
libraries which consist of a pile of '.o' files -- exactly what is
desired for composing runtime libraries. I've gone ahead and switched to
using this.

I've also added the interception library which I missed initially. And
I've added proper dependencies between the various libraries. With this,
I'm able to build archives for asan that appear to contain all of the
necessary .o files.

The final tweak here is to start setting up the compile flags and macro
defines expected by ASan and its helper libraries. These may not be
entirely correct currently, they're based loosely on my reading of the
old Makefiles. However, they can be tweaked more easily now that they're
wired up properly.

llvm-svn: 159129
This commit is contained in:
Chandler Carruth
2012-06-25 08:40:10 +00:00
parent bbff278c9c
commit c78ad00c07
5 changed files with 85 additions and 10 deletions

View File

@@ -0,0 +1,34 @@
# Build for the runtime interception helper library.
set(INTERCEPTION_SOURCES
interception_linux.cc
interception_mac.cc
interception_win.cc
)
# Only add this C file if we're building on a Mac. Other source files can be
# harmlessly compiled on any platform, but the C file is complained about due
# to pedantic rules about empty translation units.
if (APPLE)
list(APPEND INTERCEPTION_SOURCES mach_override/mach_override.c)
endif ()
set(INTERCEPTION_CFLAGS "-fvisibility=hidden")
set(INTERCEPTION_COMMON_DEFINITIONS
INTERCEPTION_HAS_EXCEPTIONS=1)
if(CAN_TARGET_X86_64)
add_library(RTInterception.x86_64 OBJECT ${INTERCEPTION_SOURCES})
set_property(TARGET RTInterception.x86_64 PROPERTY COMPILE_FLAGS
"${INTERCEPTION_CFLAGS} ${TARGET_X86_64_CFLAGS}")
set_property(TARGET RTInterception.x86_64 APPEND PROPERTY COMPILE_DEFINITIONS
${INTERCEPTION_COMMON_DEFINITIONS})
endif()
if(CAN_TARGET_I386)
add_library(RTInterception.i386 OBJECT ${INTERCEPTION_SOURCES})
set_property(TARGET RTInterception.i386 PROPERTY COMPILE_FLAGS
"${INTERCEPTION_CFLAGS} ${TARGET_I386_CFLAGS}")
set_property(TARGET RTInterception.i386 APPEND PROPERTY COMPILE_DEFINITIONS
${INTERCEPTION_COMMON_DEFINITIONS})
endif()