summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/safestack/CMakeLists.txt
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2015-06-15 21:08:47 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2015-06-15 21:08:47 +0000
commitb64d0b1e6d5f500201d9d91526bc2bf14cb519d5 (patch)
treed367a76befa617c38aa8f940cee7da3c6cf61808 /compiler-rt/lib/safestack/CMakeLists.txt
parentc4122c17b473a6f9f2a5940a98939209aaaa3dfc (diff)
downloadbcm5719-llvm-b64d0b1e6d5f500201d9d91526bc2bf14cb519d5.tar.gz
bcm5719-llvm-b64d0b1e6d5f500201d9d91526bc2bf14cb519d5.zip
Protection against stack-based memory corruption errors using SafeStack: compiler-rt runtime support library
This patch adds runtime support for the Safe Stack protection to compiler-rt (see http://reviews.llvm.org/D6094 for the detailed description of the Safe Stack). This patch is our implementation of the safe stack on top of compiler-rt. The patch adds basic runtime support for the safe stack to compiler-rt that manages unsafe stack allocation/deallocation for each thread. Original patch by Volodymyr Kuznetsov and others at the Dependable Systems Lab at EPFL; updates and upstreaming by myself. Differential Revision: http://reviews.llvm.org/D6096 llvm-svn: 239763
Diffstat (limited to 'compiler-rt/lib/safestack/CMakeLists.txt')
-rw-r--r--compiler-rt/lib/safestack/CMakeLists.txt28
1 files changed, 28 insertions, 0 deletions
diff --git a/compiler-rt/lib/safestack/CMakeLists.txt b/compiler-rt/lib/safestack/CMakeLists.txt
new file mode 100644
index 00000000000..1c15d079dbb
--- /dev/null
+++ b/compiler-rt/lib/safestack/CMakeLists.txt
@@ -0,0 +1,28 @@
+add_custom_target(safestack)
+
+set(SAFESTACK_SOURCES safestack.cc)
+
+include_directories(..)
+
+set(SAFESTACK_CFLAGS ${SANITIZER_COMMON_CFLAGS})
+
+if(APPLE)
+ # Build universal binary on APPLE.
+ add_compiler_rt_osx_static_runtime(clang_rt.safestack_osx
+ ARCH ${SAFESTACK_SUPPORTED_ARCH}
+ SOURCES ${SAFESTACK_SOURCES}
+ $<TARGET_OBJECTS:RTInterception.osx>
+ $<TARGET_OBJECTS:RTSanitizerCommon.osx>
+ CFLAGS ${SAFESTACK_CFLAGS})
+ add_dependencies(safestack clang_rt.safestack_osx)
+else()
+ # Otherwise, build separate libraries for each target.
+ foreach(arch ${SAFESTACK_SUPPORTED_ARCH})
+ add_compiler_rt_runtime(clang_rt.safestack-${arch} ${arch} STATIC
+ SOURCES ${SAFESTACK_SOURCES}
+ $<TARGET_OBJECTS:RTInterception.${arch}>
+ $<TARGET_OBJECTS:RTSanitizerCommon.${arch}>
+ CFLAGS ${SAFESTACK_CFLAGS})
+ add_dependencies(safestack clang_rt.safestack-${arch})
+ endforeach()
+endif()
OpenPOWER on IntegriCloud