[compiler-rt] r233071 - [ASan] Do not link ASan OSX runtime with -lc++abi (which was added in r233036)

Anna Zaks ganna at apple.com
Tue Mar 24 14:44:41 PDT 2015


Alexey,

I've applied the following patch on top of yours and tested with cmake ninja build plus "ninja check-ubsan" and "ninja check-asan".

Cheers, 
Anna. 

zaks$ git diff
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3e67883..c6cd87d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -304,8 +304,7 @@ if(APPLE)
   set(DARWIN_iossim_CFLAGS
     -mios-simulator-version-min=7.0 -isysroot ${IOSSIM_SDK_DIR})
   set(DARWIN_osx_LINKFLAGS -mmacosx-version-min=${SANITIZER_MIN_OSX_VERSION}
-     -stdlib=libc++
-     -lc++abi)
+     -stdlib=libc++)
   set(DARWIN_iossim_LINKFLAGS
     -Wl,-ios_simulator_version_min,7.0.0
     -mios-simulator-version-min=7.0
diff --git a/lib/ubsan/CMakeLists.txt b/lib/ubsan/CMakeLists.txt
index 8c2d30b..a8b3f61 100644
--- a/lib/ubsan/CMakeLists.txt
+++ b/lib/ubsan/CMakeLists.txt
@@ -31,7 +31,8 @@ if(APPLE)
     add_compiler_rt_darwin_dynamic_runtime(clang_rt.ubsan_${os}_dynamic ${os}
       ARCH ${UBSAN_SUPPORTED_ARCH}
       SOURCES $<TARGET_OBJECTS:RTUbsan.${os}>
-              $<TARGET_OBJECTS:RTSanitizerCommon.${os}>)
+              $<TARGET_OBJECTS:RTSanitizerCommon.${os}>
+      LINKFLAGS -lc++abi)
 
     add_dependencies(ubsan clang_rt.ubsan_${os}_dynamic)
   endforeach()

> On Mar 24, 2015, at 11:36 AM, Alexey Samsonov <vonosmas at gmail.com> wrote:
> 
> On Tue, Mar 24, 2015 at 11:24 AM, Anna Zaks <ganna at apple.com <mailto:ganna at apple.com>> wrote:
> 
>> On Mar 24, 2015, at 10:46 AM, Justin Bogner <mail at justinbogner.com <mailto:mail at justinbogner.com>> wrote:
>> 
>> Alexander Potapenko <glider at google.com <mailto:glider at google.com>> writes:
>>> Author: glider
>>> Date: Tue Mar 24 08:10:55 2015
>>> New Revision: 233071
>>> 
>>> URL: http://llvm.org/viewvc/llvm-project?rev=233071&view=rev <http://llvm.org/viewvc/llvm-project?rev=233071&view=rev>
>>> Log:
>>> [ASan] Do not link ASan OSX runtime with -lc++abi (which was added in r233036)
>>> This should fix the OSX Jenkins build at
>>> http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA_check/ <http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA_check/>
>> 
>> This didn't quite work - compiler-rt doesn't even link after this
>> change:
>> 
>>  Undefined symbols for architecture x86_64:
>>    "typeinfo for __cxxabiv1::__class_type_info", referenced from:
>>        __ubsan::checkDynamicType(void*, void*, unsigned long) in ubsan_type_hash.cc.o
>>        isDerivedFromAtOffset(__cxxabiv1::__class_type_info const*, __cxxabiv1::__class_type_info const*, long) in ubsan_type_hash.cc.o
>>        findBaseAtOffset(__cxxabiv1::__class_type_info const*, long) in ubsan_type_hash.cc.o
>> 
>> See here:
>> 
>>  http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA_build/2492/consoleFull#-158682280549ba4694-19c4-4d7e-bec5-911270d8a58c <http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA_build/2492/consoleFull#-158682280549ba4694-19c4-4d7e-bec5-911270d8a58c>
>> 
>> I've reverted both r233071 and r233036 in r233097 to get things working
>> again.
> 
> If we are reverting all this, 233035 needs to be reverted as well.
> 
> Yes.
> 
> 
> Maybe we should XFAIL the two tests instead?
> 
> No, I just think we should provide -lc++abi only for UBSan. I.e. remove it from DARWIN_osx_LINKFLAGS and instead provide:
> 
>     add_compiler_rt_darwin_dynamic_runtime(clang_rt.ubsan_${os}_dynamic ${os}
>       ARCH ${UBSAN_SUPPORTED_ARCH}
>       SOURCES $<TARGET_OBJECTS:RTUbsan.${os}>
>               $<TARGET_OBJECTS:RTSanitizerCommon.${os}>
>       LINKFLAGS -lc++abi)
> 
> Could you check if it works?
>  
> 
> CC-ing Alexey.
> 
>> 
>>> Modified:
>>>    compiler-rt/trunk/CMakeLists.txt
>>> 
>>> Modified: compiler-rt/trunk/CMakeLists.txt
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/CMakeLists.txt?rev=233071&r1=233070&r2=233071&view=diff <http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/CMakeLists.txt?rev=233071&r1=233070&r2=233071&view=diff>
>>> ==============================================================================
>>> --- compiler-rt/trunk/CMakeLists.txt (original)
>>> +++ compiler-rt/trunk/CMakeLists.txt Tue Mar 24 08:10:55 2015
>>> @@ -304,8 +304,7 @@ if(APPLE)
>>>   set(DARWIN_iossim_CFLAGS
>>>     -mios-simulator-version-min=7.0 -isysroot ${IOSSIM_SDK_DIR})
>>>   set(DARWIN_osx_LINKFLAGS -mmacosx-version-min=${SANITIZER_MIN_OSX_VERSION}
>>> -     -stdlib=libc++
>>> -     -lc++abi)
>>> +     -stdlib=libc++)
>>>   set(DARWIN_iossim_LINKFLAGS
>>>     -Wl,-ios_simulator_version_min,7.0.0
>>>     -mios-simulator-version-min=7.0
>>> 
>>> 
>>> _______________________________________________
>>> llvm-commits mailing list
>>> llvm-commits at cs.uiuc.edu <mailto:llvm-commits at cs.uiuc.edu>
>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits <http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu <mailto:llvm-commits at cs.uiuc.edu>
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits <http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits>
> 
> 
> 
> -- 
> Alexey Samsonov
> vonosmas at gmail.com <mailto:vonosmas at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150324/91c70699/attachment.html>


More information about the llvm-commits mailing list