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

Alexey Samsonov vonosmas at gmail.com
Wed Mar 25 12:11:56 PDT 2015


On Wed, Mar 25, 2015 at 10:40 AM, Kuba Brecka <kuba.brecka at gmail.com> wrote:

> Aah, it’s because we have `-undefined dynamic_lookup` linker flag in the
> Makefile-based build, but not in CMake.  Compare the CMake build:
>
> $ nm -mg cmake-build/.../libclang_rt.ubsan_osx_dynamic.dylib | grep ZTIN
>   (undefined) external __ZTIN10__cxxabiv117__class_type_infoE (from
> libc++abi)
>   (undefined) external __ZTIN10__cxxabiv120__si_class_type_infoE (from
> libc++abi)
>   (undefined) external __ZTIN10__cxxabiv121__vmi_class_type_infoE (from
> libc++abi)
>
>
> with the dylib produced by Make:
>
> $ nm -mg make-build/.../libclang_rt.ubsan_osx_dynamic.dylib | grep ZTIN
>   (undefined) external __ZTIN10__cxxabiv117__class_type_infoE (dynamically
> looked up)
>   (undefined) external __ZTIN10__cxxabiv120__si_class_type_infoE
> (dynamically looked up)
>   (undefined) external __ZTIN10__cxxabiv121__vmi_class_type_infoE
> (dynamically looked up)
>
>
> We should probably choose only one method (dynamic_lookup or linking
> libc++abi) and use the same in both build systems.
>

I suggest to delete Makefile-based build :) Alright, I remember, we can't
do it now.

Feel free to modify makefile-based build system as you find necessary.
Personally, I'd prefer to have -lc++abi everywhere - it's always
nicer to specify your dependencies explicitly.


>
> Kuba
>
> On Mar 25, 2015, at 3:10 PM, Kuba Brecka <kuba.brecka at gmail.com> wrote:
>
> Looks like it builds and passes tests now.  But I’m very curious about why
> the Makefile-based build doesn't require “-lc++abi” and it still builds
> fine.  That seems very suspicious to me…
>
> Kuba
>
> On Mar 24, 2015, at 11:00 PM, Alexey Samsonov <vonosmas at gmail.com> wrote:
>
> Thanks! Submitted as r233122. Let me know (and feel free to revert) if it
> still breaks Jenkins or another build.
>
> On Tue, Mar 24, 2015 at 2:44 PM, Anna Zaks <ganna at apple.com> wrote:
>
>> 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> wrote:
>>
>>>
>>> On Mar 24, 2015, at 10:46 AM, Justin Bogner <mail at justinbogner.com>
>>> wrote:
>>>
>>> Alexander Potapenko <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
>>> 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/
>>>
>>>
>>> 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
>>>
>>> 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
>>>
>>> ==============================================================================
>>> --- 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
>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>>
>>> _______________________________________________
>>> llvm-commits mailing list
>>> llvm-commits at cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>>
>>>
>>>
>>
>>
>> --
>> Alexey Samsonov
>> vonosmas at gmail.com
>>
>>
>>
>
>
> --
> Alexey Samsonov
> vonosmas at gmail.com
>
>
>
>


-- 
Alexey Samsonov
vonosmas at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150325/7bf2e4fa/attachment.html>


More information about the llvm-commits mailing list