summaryrefslogtreecommitdiff
path: root/lib/interception
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2012-06-25 08:40:10 +0000
committerChandler Carruth <chandlerc@gmail.com>2012-06-25 08:40:10 +0000
commita765ffcef39dc37bd6d7e597286fd76fbeb1b9fa (patch)
tree5f1d81ef25692244efc402f812facd20511d09f1 /lib/interception
parent6bae39d1db13f60d3e9b8393e5b9d9eb2ab1b5c0 (diff)
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. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@159129 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/interception')
-rw-r--r--lib/interception/CMakeLists.txt34
1 files changed, 34 insertions, 0 deletions
diff --git a/lib/interception/CMakeLists.txt b/lib/interception/CMakeLists.txt
new file mode 100644
index 000000000..4a0d2cdd2
--- /dev/null
+++ b/lib/interception/CMakeLists.txt
@@ -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()