<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">Hm, interesting. Apparently, it’s a side-effect of adding the unconditional “-lc++abi” into the ASan+UBSan dylibs linking command. This causes the interceptors of C++ `new` and `delete` operators to stop working, because the dylib interposers are then linked against the libc++abi symbol:</div><div class=""><br class=""></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class="">$ nm -m .../libclang_rt.asan_osx_dynamic.dylib | grep libc++abi</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class=""> (undefined) weak external __ZdaPv (from libc++abi)</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class=""> (undefined) weak external __ZdaPvRKSt9nothrow_t (from libc++abi)</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class=""> (undefined) weak external __ZdlPv (from libc++abi)</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class=""> (undefined) weak external __ZdlPvRKSt9nothrow_t (from libc++abi)</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class=""> (undefined) weak external __Znam (from libc++abi)</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class=""> (undefined) weak external __ZnamRKSt9nothrow_t (from libc++abi)</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class=""> (undefined) weak external __Znwm (from libc++abi)</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class=""> (undefined) weak external __ZnwmRKSt9nothrow_t (from libc++abi)</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class=""> (undefined) weak external ___cxa_demangle (from libc++abi)</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class=""> (undefined) external ___cxa_throw (from libc++abi)</div></blockquote><div class=""><br class=""></div><div class="">but the test binary imports `__Znam` & friends from libc++, not libc++abi.</div><div class=""><br class=""></div><div class="">Kuba</div><br class=""><div><blockquote type="cite" class=""><div class="">On Mar 24, 2015, at 1:59 PM, Alexander Potapenko <<a href="mailto:glider@google.com" class="">glider@google.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class="">FYI this broke the Jenkins build:<br class=""><a href="http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA_check/2427/" class="">http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA_check/2427/</a><br class="">I've confirmed locally that reverting your patch fixes at least<br class="">large_func_test.cc.<br class=""><br class="">On Tue, Mar 24, 2015 at 2:14 AM, Alexey Samsonov <vonosmas@gmail.com> wrote:<br class=""><blockquote type="cite" class="">Author: samsonov<br class="">Date: Mon Mar 23 18:14:16 2015<br class="">New Revision: 233036<br class=""><br class="">URL: http://llvm.org/viewvc/llvm-project?rev=233036&view=rev<br class="">Log:<br class="">[UBSan] Use shared library for UBSan on OS X (compiler-rt part).<br class=""><br class="">Summary:<br class="">Switch to shared library for UBSan. Add support for building<br class="">UBSan on OSX and iossim by cargo-culting ASan build rules.<br class=""><br class="">Test Plan: regression test suite<br class=""><br class="">Reviewers: zaks.anna, kubabrecka<br class=""><br class="">Subscribers: llvm-commits<br class=""><br class="">Differential Revision: http://reviews.llvm.org/D8473<br class=""><br class="">Modified:<br class=""> compiler-rt/trunk/CMakeLists.txt<br class=""> compiler-rt/trunk/lib/ubsan/CMakeLists.txt<br class=""> compiler-rt/trunk/make/platform/clang_darwin.mk<br class=""> compiler-rt/trunk/test/ubsan/TestCases/TypeCheck/vptr-virtual-base.cpp<br class=""><br class="">Modified: compiler-rt/trunk/CMakeLists.txt<br class="">URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/CMakeLists.txt?rev=233036&r1=233035&r2=233036&view=diff<br class="">==============================================================================<br class="">--- compiler-rt/trunk/CMakeLists.txt (original)<br class="">+++ compiler-rt/trunk/CMakeLists.txt Mon Mar 23 18:14:16 2015<br class="">@@ -304,7 +304,8 @@ if(APPLE)<br class=""> set(DARWIN_iossim_CFLAGS<br class=""> -mios-simulator-version-min=7.0 -isysroot ${IOSSIM_SDK_DIR})<br class=""> set(DARWIN_osx_LINKFLAGS -mmacosx-version-min=${SANITIZER_MIN_OSX_VERSION}<br class="">- -stdlib=libc++)<br class="">+ -stdlib=libc++<br class="">+ -lc++abi)<br class=""> set(DARWIN_iossim_LINKFLAGS<br class=""> -Wl,-ios_simulator_version_min,7.0.0<br class=""> -mios-simulator-version-min=7.0<br class=""><br class="">Modified: compiler-rt/trunk/lib/ubsan/CMakeLists.txt<br class="">URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/ubsan/CMakeLists.txt?rev=233036&r1=233035&r2=233036&view=diff<br class="">==============================================================================<br class="">--- compiler-rt/trunk/lib/ubsan/CMakeLists.txt (original)<br class="">+++ compiler-rt/trunk/lib/ubsan/CMakeLists.txt Mon Mar 23 18:14:16 2015<br class="">@@ -22,13 +22,19 @@ set(UBSAN_CXXFLAGS ${SANITIZER_COMMON_CF<br class=""> add_custom_target(ubsan)<br class=""><br class=""> if(APPLE)<br class="">- # Build universal binary on APPLE.<br class="">- add_compiler_rt_osx_static_runtime(clang_rt.ubsan_osx<br class="">- ARCH ${UBSAN_SUPPORTED_ARCH}<br class="">- SOURCES ${UBSAN_SOURCES} ${UBSAN_CXX_SOURCES}<br class="">- $<TARGET_OBJECTS:RTSanitizerCommon.osx><br class="">- CFLAGS ${UBSAN_CXXFLAGS})<br class="">- add_dependencies(ubsan clang_rt.ubsan_osx)<br class="">+ foreach(os ${SANITIZER_COMMON_SUPPORTED_DARWIN_OS})<br class="">+ add_compiler_rt_darwin_object_library(RTUbsan ${os}<br class="">+ ARCH ${UBSAN_SUPPORTED_ARCH}<br class="">+ SOURCES ${UBSAN_SOURCES} ${UBSAN_CXX_SOURCES}<br class="">+ CFLAGS ${UBSAN_CXXFLAGS})<br class="">+<br class="">+ add_compiler_rt_darwin_dynamic_runtime(clang_rt.ubsan_${os}_dynamic ${os}<br class="">+ ARCH ${UBSAN_SUPPORTED_ARCH}<br class="">+ SOURCES $<TARGET_OBJECTS:RTUbsan.${os}><br class="">+ $<TARGET_OBJECTS:RTSanitizerCommon.${os}>)<br class="">+<br class="">+ add_dependencies(ubsan clang_rt.ubsan_${os}_dynamic)<br class="">+ endforeach()<br class=""> else()<br class=""> # Build separate libraries for each target.<br class=""> foreach(arch ${UBSAN_SUPPORTED_ARCH})<br class=""><br class="">Modified: compiler-rt/trunk/make/platform/clang_darwin.mk<br class="">URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/make/platform/clang_darwin.mk?rev=233036&r1=233035&r2=233036&view=diff<br class="">==============================================================================<br class="">--- compiler-rt/trunk/make/platform/clang_darwin.mk (original)<br class="">+++ compiler-rt/trunk/make/platform/clang_darwin.mk Mon Mar 23 18:14:16 2015<br class="">@@ -119,8 +119,11 @@ UniversalArchs.asan_osx_dynamic := $(cal<br class=""> Configs += asan_iossim_dynamic<br class=""> UniversalArchs.asan_iossim_dynamic := $(call CheckArches,i386 x86_64,asan_iossim_dynamic,$(IOSSIM_SDK))<br class=""><br class="">-Configs += ubsan_osx<br class="">-UniversalArchs.ubsan_osx := $(call CheckArches,i386 x86_64 x86_64h,ubsan_osx,$(OSX_SDK))<br class="">+Configs += ubsan_osx_dynamic<br class="">+UniversalArchs.ubsan_osx_dynamic := $(call CheckArches,i386 x86_64 x86_64h,ubsan_osx_dynamic,$(OSX_SDK))<br class="">+<br class="">+Configs += ubsan_iossim_dynamic<br class="">+UniversalArchs.ubsan_iossim_dynamic := $(call CheckArches,i386 x86_64,ubsan_iossim_dynamic,$(IOSSIM_SDK))<br class=""><br class=""> # Darwin 10.6 has a bug in cctools that makes it unable to use ranlib on our ARM<br class=""> # object files. If we are on that platform, strip out all ARM archs. We still<br class="">@@ -172,24 +175,33 @@ IOSSIM_DEPLOYMENT_ARGS += -isysroot $(IO<br class=""> CFLAGS.eprintf := $(CFLAGS) $(OSX_DEPLOYMENT_ARGS)<br class=""> CFLAGS.10.4 := $(CFLAGS) $(OSX_DEPLOYMENT_ARGS)<br class=""><br class="">+SANITIZER_MACOSX_DEPLOYMENT_ARGS := -mmacosx-version-min=10.7<br class="">+SANITIZER_IOSSIM_DEPLOYMENT_ARGS := -mios-simulator-version-min=7.0 \<br class="">+ -isysroot $(IOSSIM_SDK)<br class="">+SANITIZER_CFLAGS := -fno-builtin -gline-tables-only<br class="">+<br class=""> CFLAGS.asan_osx_dynamic := \<br class="">- $(CFLAGS) -mmacosx-version-min=10.7 \<br class="">+ $(CFLAGS) $(SANITIZER_MACOSX_DEPLOYMENT_ARGS) \<br class="">+ $(SANITIZER_CFLAGS) \<br class=""> -stdlib=libc++ \<br class="">- -fno-builtin \<br class="">- -gline-tables-only \<br class=""> -DMAC_INTERPOSE_FUNCTIONS=1 \<br class=""> -DASAN_DYNAMIC=1<br class=""><br class=""> CFLAGS.asan_iossim_dynamic := \<br class="">- $(CFLAGS) -mios-simulator-version-min=7.0 \<br class="">- -isysroot $(IOSSIM_SDK) \<br class="">- -fno-builtin \<br class="">- -gline-tables-only \<br class="">+ $(CFLAGS) $(SANITIZER_IOSSIM_DEPLOYMENT_ARGS) \<br class="">+ $(SANITIZER_CFLAGS) \<br class=""> -DMAC_INTERPOSE_FUNCTIONS=1 \<br class=""> -DASAN_DYNAMIC=1<br class=""><br class="">-CFLAGS.ubsan_osx := $(CFLAGS) -mmacosx-version-min=10.6 \<br class="">- -fno-builtin<br class="">+CFLAGS.ubsan_osx_dynamic := \<br class="">+ $(CFLAGS) $(SANITIZER_MACOSX_DEPLOYMENT_ARGS) \<br class="">+ $(SANITIZER_CFLAGS) \<br class="">+ -stdlib=libc++<br class="">+<br class="">+CFLAGS.ubsan_iossim_dynamic := \<br class="">+ $(CFLAGS) $(SANITIZER_IOSSIM_DEPLOYMENT_ARGS) \<br class="">+ $(SANITIZER_CFLAGS)<br class="">+<br class=""><br class=""> CFLAGS.ios.i386 := $(CFLAGS) $(IOSSIM_DEPLOYMENT_ARGS)<br class=""> CFLAGS.ios.x86_64 := $(CFLAGS) $(IOSSIM_DEPLOYMENT_ARGS)<br class="">@@ -220,24 +232,29 @@ CFLAGS.profile_ios.armv7k := $(CFLAGS) $<br class=""> CFLAGS.profile_ios.armv7s := $(CFLAGS) $(IOS_DEPLOYMENT_ARGS)<br class=""> CFLAGS.profile_ios.arm64 := $(CFLAGS) $(IOS6_DEPLOYMENT_ARGS)<br class=""><br class="">-# Configure the asan_osx_dynamic library to be built shared.<br class="">+SANITIZER_LDFLAGS := -undefined dynamic_lookup<br class="">+<br class=""> SHARED_LIBRARY.asan_osx_dynamic := 1<br class="">-LDFLAGS.asan_osx_dynamic := -lc++ -undefined dynamic_lookup -install_name @rpath/libclang_rt.asan_osx_dynamic.dylib \<br class="">- -mmacosx-version-min=10.7<br class="">+LDFLAGS.asan_osx_dynamic := -lc++ $(SANITIZER_LDFLAGS) -install_name @rpath/libclang_rt.asan_osx_dynamic.dylib \<br class="">+ $(SANITIZER_MACOSX_DEPLOYMENT_ARGS)<br class=""><br class="">-# Configure the asan_iossim_dynamic library to be built shared.<br class=""> SHARED_LIBRARY.asan_iossim_dynamic := 1<br class="">-# configure+make uses Clang, so we're using isysroot instead of --sysroot<br class="">-# or -Wl,-syslibroot.<br class="">-LDFLAGS.asan_iossim_dynamic := -undefined dynamic_lookup -install_name @rpath/libclang_rt.asan_iossim_dynamic.dylib \<br class="">- -Wl,-ios_simulator_version_min,7.0.0 \<br class="">- -mios-simulator-version-min=7.0 -isysroot $(IOSSIM_SDK)<br class="">+LDFLAGS.asan_iossim_dynamic := $(SANITIZER_LDFLAGS) -install_name @rpath/libclang_rt.asan_iossim_dynamic.dylib \<br class="">+ -Wl,-ios_simulator_version_min,7.0.0 $(SANITIZER_IOSSIM_DEPLOYMENT_ARGS)<br class="">+<br class="">+SHARED_LIBRARY.ubsan_osx_dynamic := 1<br class="">+LDFLAGS.ubsan_osx_dynamic := -lc++ $(SANITIZER_LDFLAGS) -install_name @rpath/libclang_rt.ubsan_osx_dynamic.dylib \<br class="">+ $(SANITIZER_MACOSX_DEPLOYMENT_ARGS)<br class="">+<br class="">+SHARED_LIBRARY.ubsan_iossim_dynamic := 1<br class="">+LDFLAGS.ubsan_iossim_dynamic := $(SANITIZER_LDFLAGS) -install_name @rpath/libclang_rt.ubsan_iossim_dynamic.dylib \<br class="">+ -Wl,-ios_simulator_version_min,7.0.0 $(SANITIZER_IOSSIM_DEPLOYMENT_ARGS)<br class=""><br class=""> ifneq ($(OSX_SDK),)<br class=""> CFLAGS.asan_osx_dynamic += -isysroot $(OSX_SDK)<br class=""> LDFLAGS.asan_osx_dynamic += -isysroot $(OSX_SDK)<br class="">-CFLAGS.ubsan_osx += -isysroot $(OSX_SDK)<br class="">-LDFLAGS.ubsan_osx += -isysroot $(OSX_SDK)<br class="">+CFLAGS.ubsan_osx_dynamic += -isysroot $(OSX_SDK)<br class="">+LDFLAGS.ubsan_osx_dynamic += -isysroot $(OSX_SDK)<br class=""> endif<br class=""><br class=""> FUNCTIONS.eprintf := eprintf<br class="">@@ -260,15 +277,18 @@ FUNCTIONS.profile_ios := $(FUNCTIONS.pro<br class=""> FUNCTIONS.asan_osx_dynamic := $(AsanFunctions) $(AsanCXXFunctions) \<br class=""> $(InterceptionFunctions) \<br class=""> $(SanitizerCommonFunctions) \<br class="">- $(AsanDynamicFunctions)<br class="">+ $(AsanDynamicFunctions)<br class=""><br class=""> FUNCTIONS.asan_iossim_dynamic := $(AsanFunctions) $(AsanCXXFunctions) \<br class=""> $(InterceptionFunctions) \<br class=""> $(SanitizerCommonFunctions) \<br class="">- $(AsanDynamicFunctions)<br class="">+ $(AsanDynamicFunctions)<br class="">+<br class="">+FUNCTIONS.ubsan_osx_dynamic := $(UbsanFunctions) $(UbsanCXXFunctions) \<br class="">+ $(SanitizerCommonFunctions)<br class=""><br class="">-FUNCTIONS.ubsan_osx := $(UbsanFunctions) $(UbsanCXXFunctions) \<br class="">- $(SanitizerCommonFunctions)<br class="">+FUNCTIONS.ubsan_iossim_dynamic := $(UbsanFunctions) $(UbsanCXXFunctions) \<br class="">+ $(SanitizerCommonFunctions)<br class=""><br class=""> CCKEXT_PROFILE_FUNCTIONS := \<br class=""> InstrProfiling \<br class=""><br class="">Modified: compiler-rt/trunk/test/ubsan/TestCases/TypeCheck/vptr-virtual-base.cpp<br class="">URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/ubsan/TestCases/TypeCheck/vptr-virtual-base.cpp?rev=233036&r1=233035&r2=233036&view=diff<br class="">==============================================================================<br class="">--- compiler-rt/trunk/test/ubsan/TestCases/TypeCheck/vptr-virtual-base.cpp (original)<br class="">+++ compiler-rt/trunk/test/ubsan/TestCases/TypeCheck/vptr-virtual-base.cpp Mon Mar 23 18:14:16 2015<br class="">@@ -1,9 +1,6 @@<br class=""> // RUN: %clangxx -frtti -fsanitize=vptr -fno-sanitize-recover=vptr -g %s -O3 -o %t<br class=""> // RUN: not %run %t 2>&1 | FileCheck %s<br class=""><br class="">-// FIXME: This test produces linker errors on Darwin.<br class="">-// XFAIL: darwin<br class="">-<br class=""> struct S { virtual int f() { return 0; } };<br class=""> struct T : virtual S {};<br class=""><br class=""><br class=""><br class="">_______________________________________________<br class="">llvm-commits mailing list<br class="">llvm-commits@cs.uiuc.edu<br class="">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits<br class=""></blockquote><br class=""><br class=""><br class="">-- <br class="">Alexander Potapenko<br class="">Software Engineer<br class="">Google Moscow<br class=""></div></blockquote></div><br class=""></body></html>