[compiler-rt] r233215 - On OS X, explicitly use libc++

Kuba Brecka kuba.brecka at gmail.com
Wed Mar 25 14:07:20 PDT 2015


Author: kuba.brecka
Date: Wed Mar 25 16:07:20 2015
New Revision: 233215

URL: http://llvm.org/viewvc/llvm-project?rev=233215&view=rev
Log:
On OS X, explicitly use libc++

For OS X builds, both Make and CMake, let's be very explicit about using
libc++ and libc++abi with:

1) -stdlib=libc++ in CFLAGS and LDFLAGS for all platforms
2) -lc++ in LDFLAGS for all platforms
3) switch from -undefined dynamic_lookup to -lc++abi for UBSan in
   Makefile-based builds

Reviewed at http://reviews.llvm.org/D8617


Modified:
    compiler-rt/trunk/CMakeLists.txt
    compiler-rt/trunk/make/platform/clang_darwin.mk

Modified: compiler-rt/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/CMakeLists.txt?rev=233215&r1=233214&r2=233215&view=diff
==============================================================================
--- compiler-rt/trunk/CMakeLists.txt (original)
+++ compiler-rt/trunk/CMakeLists.txt Wed Mar 25 16:07:20 2015
@@ -302,10 +302,12 @@ if(APPLE)
   set(DARWIN_osx_CFLAGS -mmacosx-version-min=${SANITIZER_MIN_OSX_VERSION}
     -stdlib=libc++)
   set(DARWIN_iossim_CFLAGS
+    -stdlib=libc++
     -mios-simulator-version-min=7.0 -isysroot ${IOSSIM_SDK_DIR})
   set(DARWIN_osx_LINKFLAGS -mmacosx-version-min=${SANITIZER_MIN_OSX_VERSION}
-     -stdlib=libc++)
+    -stdlib=libc++ -lc++)
   set(DARWIN_iossim_LINKFLAGS
+    -stdlib=libc++ -lc++
     -Wl,-ios_simulator_version_min,7.0.0
     -mios-simulator-version-min=7.0
     -isysroot ${IOSSIM_SDK_DIR})

Modified: compiler-rt/trunk/make/platform/clang_darwin.mk
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/make/platform/clang_darwin.mk?rev=233215&r1=233214&r2=233215&view=diff
==============================================================================
--- compiler-rt/trunk/make/platform/clang_darwin.mk (original)
+++ compiler-rt/trunk/make/platform/clang_darwin.mk Wed Mar 25 16:07:20 2015
@@ -178,29 +178,27 @@ CFLAGS.10.4		:= $(CFLAGS) $(OSX_DEPLOYME
 SANITIZER_MACOSX_DEPLOYMENT_ARGS := -mmacosx-version-min=10.7
 SANITIZER_IOSSIM_DEPLOYMENT_ARGS := -mios-simulator-version-min=7.0 \
   -isysroot $(IOSSIM_SDK)
-SANITIZER_CFLAGS := -fno-builtin -gline-tables-only
+SANITIZER_CFLAGS := -fno-builtin -gline-tables-only -stdlib=libc++
 
 CFLAGS.asan_osx_dynamic := \
 	$(CFLAGS) $(SANITIZER_MACOSX_DEPLOYMENT_ARGS) \
 	$(SANITIZER_CFLAGS) \
-	-stdlib=libc++ \
 	-DMAC_INTERPOSE_FUNCTIONS=1 \
 	-DASAN_DYNAMIC=1
 
 CFLAGS.asan_iossim_dynamic := \
 	$(CFLAGS) $(SANITIZER_IOSSIM_DEPLOYMENT_ARGS) \
-  $(SANITIZER_CFLAGS) \
+	$(SANITIZER_CFLAGS) \
 	-DMAC_INTERPOSE_FUNCTIONS=1 \
 	-DASAN_DYNAMIC=1
 
 CFLAGS.ubsan_osx_dynamic := \
 	$(CFLAGS) $(SANITIZER_MACOSX_DEPLOYMENT_ARGS) \
-	$(SANITIZER_CFLAGS) \
-	-stdlib=libc++
+	$(SANITIZER_CFLAGS)
 
 CFLAGS.ubsan_iossim_dynamic := \
 	$(CFLAGS) $(SANITIZER_IOSSIM_DEPLOYMENT_ARGS) \
-  $(SANITIZER_CFLAGS)
+	$(SANITIZER_CFLAGS)
 
 
 CFLAGS.ios.i386		:= $(CFLAGS) $(IOSSIM_DEPLOYMENT_ARGS)
@@ -232,10 +230,10 @@ CFLAGS.profile_ios.armv7k := $(CFLAGS) $
 CFLAGS.profile_ios.armv7s := $(CFLAGS) $(IOS_DEPLOYMENT_ARGS)
 CFLAGS.profile_ios.arm64  := $(CFLAGS) $(IOS6_DEPLOYMENT_ARGS)
 
-SANITIZER_LDFLAGS := -undefined dynamic_lookup
+SANITIZER_LDFLAGS := -stdlib=libc++ -lc++
 
 SHARED_LIBRARY.asan_osx_dynamic := 1
-LDFLAGS.asan_osx_dynamic := -lc++ $(SANITIZER_LDFLAGS) -install_name @rpath/libclang_rt.asan_osx_dynamic.dylib \
+LDFLAGS.asan_osx_dynamic := $(SANITIZER_LDFLAGS) -install_name @rpath/libclang_rt.asan_osx_dynamic.dylib \
   $(SANITIZER_MACOSX_DEPLOYMENT_ARGS)
 
 SHARED_LIBRARY.asan_iossim_dynamic := 1
@@ -243,11 +241,11 @@ LDFLAGS.asan_iossim_dynamic := $(SANITIZ
   -Wl,-ios_simulator_version_min,7.0.0 $(SANITIZER_IOSSIM_DEPLOYMENT_ARGS)
 
 SHARED_LIBRARY.ubsan_osx_dynamic := 1
-LDFLAGS.ubsan_osx_dynamic := -lc++ $(SANITIZER_LDFLAGS) -install_name @rpath/libclang_rt.ubsan_osx_dynamic.dylib \
+LDFLAGS.ubsan_osx_dynamic := $(SANITIZER_LDFLAGS) -lc++abi -install_name @rpath/libclang_rt.ubsan_osx_dynamic.dylib \
   $(SANITIZER_MACOSX_DEPLOYMENT_ARGS)
 
 SHARED_LIBRARY.ubsan_iossim_dynamic := 1
-LDFLAGS.ubsan_iossim_dynamic := $(SANITIZER_LDFLAGS) -install_name @rpath/libclang_rt.ubsan_iossim_dynamic.dylib \
+LDFLAGS.ubsan_iossim_dynamic := $(SANITIZER_LDFLAGS) -lc++abi -install_name @rpath/libclang_rt.ubsan_iossim_dynamic.dylib \
   -Wl,-ios_simulator_version_min,7.0.0 $(SANITIZER_IOSSIM_DEPLOYMENT_ARGS)
 
 ifneq ($(OSX_SDK),)





More information about the llvm-commits mailing list