[PATCH] [compiler-rt] On OS X, explicitly use libc++
Kuba Brecka
kuba.brecka at gmail.com
Wed Mar 25 13:31:02 PDT 2015
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
http://reviews.llvm.org/D8617
Files:
CMakeLists.txt
make/platform/clang_darwin.mk
Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -302,10 +302,12 @@
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})
Index: make/platform/clang_darwin.mk
===================================================================
--- make/platform/clang_darwin.mk
+++ make/platform/clang_darwin.mk
@@ -178,29 +178,27 @@
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,22 +230,22 @@
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
LDFLAGS.asan_iossim_dynamic := $(SANITIZER_LDFLAGS) -install_name @rpath/libclang_rt.asan_iossim_dynamic.dylib \
-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),)
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D8617.22674.patch
Type: text/x-patch
Size: 3308 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150325/a5b98fc2/attachment.bin>
More information about the llvm-commits
mailing list