From d7ab381f5352fdd9bbd3a4641f7142dc8d838d34 Mon Sep 17 00:00:00 2001 From: Alexey Samsonov Date: Wed, 13 Mar 2013 09:18:30 +0000 Subject: [PATCH] [Sanitizer] Build ASan, TSan and MSan runtimes with -fno-rtti. llvm-svn: 176940 --- compiler-rt/lib/asan/CMakeLists.txt | 4 +++- compiler-rt/lib/msan/CMakeLists.txt | 1 + compiler-rt/lib/tsan/CMakeLists.txt | 4 +++- compiler-rt/make/platform/clang_darwin.mk | 2 +- compiler-rt/make/platform/clang_linux.mk | 8 ++++---- 5 files changed, 12 insertions(+), 7 deletions(-) diff --git a/compiler-rt/lib/asan/CMakeLists.txt b/compiler-rt/lib/asan/CMakeLists.txt index e451e23..3e3505e 100644 --- a/compiler-rt/lib/asan/CMakeLists.txt +++ b/compiler-rt/lib/asan/CMakeLists.txt @@ -30,7 +30,9 @@ set(ASAN_DYLIB_SOURCES include_directories(..) -set(ASAN_CFLAGS ${SANITIZER_COMMON_CFLAGS}) +set(ASAN_CFLAGS + ${SANITIZER_COMMON_CFLAGS} + -fno-rtti) set(ASAN_COMMON_DEFINITIONS ASAN_HAS_EXCEPTIONS=1) diff --git a/compiler-rt/lib/msan/CMakeLists.txt b/compiler-rt/lib/msan/CMakeLists.txt index fa057a6..6f10942 100644 --- a/compiler-rt/lib/msan/CMakeLists.txt +++ b/compiler-rt/lib/msan/CMakeLists.txt @@ -11,6 +11,7 @@ set(MSAN_RTL_SOURCES ) set(MSAN_RTL_CFLAGS ${SANITIZER_COMMON_CFLAGS} + -fno-rtti -fPIE # Prevent clang from generating libc calls. -ffreestanding) diff --git a/compiler-rt/lib/tsan/CMakeLists.txt b/compiler-rt/lib/tsan/CMakeLists.txt index 34e3a2e..ef4b610 100644 --- a/compiler-rt/lib/tsan/CMakeLists.txt +++ b/compiler-rt/lib/tsan/CMakeLists.txt @@ -2,7 +2,9 @@ include_directories(..) -set(TSAN_CFLAGS ${SANITIZER_COMMON_CFLAGS}) +set(TSAN_CFLAGS + ${SANITIZER_COMMON_CFLAGS} + -fno-rtti) # FIXME: Add support for compile flags: # -Wframe-larger-than=512, # -Wglobal-constructors, diff --git a/compiler-rt/make/platform/clang_darwin.mk b/compiler-rt/make/platform/clang_darwin.mk index 5179ce7..61c5b53 100644 --- a/compiler-rt/make/platform/clang_darwin.mk +++ b/compiler-rt/make/platform/clang_darwin.mk @@ -132,7 +132,7 @@ CFLAGS.eprintf := $(CFLAGS) $(OSX_DEPLOYMENT_ARGS) CFLAGS.10.4 := $(CFLAGS) $(OSX_DEPLOYMENT_ARGS) # FIXME: We can't build ASAN with our stub SDK yet. CFLAGS.asan_osx := $(CFLAGS) -mmacosx-version-min=10.5 -fno-builtin \ - -DASAN_FLEXIBLE_MAPPING_AND_OFFSET=1 + -fno-rtti -DASAN_FLEXIBLE_MAPPING_AND_OFFSET=1 CFLAGS.asan_osx_dynamic := \ $(CFLAGS) -mmacosx-version-min=10.5 -fno-builtin \ -DMAC_INTERPOSE_FUNCTIONS=1 \ diff --git a/compiler-rt/make/platform/clang_linux.mk b/compiler-rt/make/platform/clang_linux.mk index 89f7268..d3ddc71 100644 --- a/compiler-rt/make/platform/clang_linux.mk +++ b/compiler-rt/make/platform/clang_linux.mk @@ -86,12 +86,12 @@ CFLAGS.full-i386 := $(CFLAGS) -m32 CFLAGS.full-x86_64 := $(CFLAGS) -m64 CFLAGS.profile-i386 := $(CFLAGS) -m32 CFLAGS.profile-x86_64 := $(CFLAGS) -m64 -CFLAGS.asan-i386 := $(CFLAGS) -m32 -fPIE -fno-builtin \ +CFLAGS.asan-i386 := $(CFLAGS) -m32 -fPIE -fno-builtin -fno-rtti \ -DASAN_FLEXIBLE_MAPPING_AND_OFFSET=1 -CFLAGS.asan-x86_64 := $(CFLAGS) -m64 -fPIE -fno-builtin \ +CFLAGS.asan-x86_64 := $(CFLAGS) -m64 -fPIE -fno-builtin -fno-rtti \ -DASAN_FLEXIBLE_MAPPING_AND_OFFSET=1 -CFLAGS.tsan-x86_64 := $(CFLAGS) -m64 -fPIE -fno-builtin -CFLAGS.msan-x86_64 := $(CFLAGS) -m64 -fPIE -fno-builtin +CFLAGS.tsan-x86_64 := $(CFLAGS) -m64 -fPIE -fno-builtin -fno-rtti +CFLAGS.msan-x86_64 := $(CFLAGS) -m64 -fPIE -fno-builtin -fno-rtti CFLAGS.ubsan-i386 := $(CFLAGS) -m32 -fPIE -fno-builtin CFLAGS.ubsan-x86_64 := $(CFLAGS) -m64 -fPIE -fno-builtin -- 2.7.4