[compiler-rt] r189010 - [lsan] Build standalone LSan with -fno-rtti.

Kostya Serebryany kcc at google.com
Thu Aug 22 07:20:35 PDT 2013


you can use dlsym to make sure there is no C++


On Thu, Aug 22, 2013 at 6:18 PM, Sergey Matveev <earthdok at google.com> wrote:

> Building in C mode doesn't guarantee that we're not linking libstdc++
>
> E.g.:
>
> clang -fsanitize=leak --driver-mode=g++ -x c source.c
>
> On Thu, Aug 22, 2013 at 5:55 PM, Kostya Serebryany <kcc at google.com> wrote:
>
>> this is easy to solve: put #ifdef __cplusplus #error into the code
>>
>>
>> On Thu, Aug 22, 2013 at 5:50 PM, Sergey Matveev <earthdok at google.com>wrote:
>>
>>> That would require the clang_lsan substitution to expand to clang and
>>> not clang++. It's possible, but someone could unknowingly change the
>>> substitution back to clang++ in the config and turn the test into a no-op.
>>>
>>>
>>> On Thu, Aug 22, 2013 at 5:46 PM, Alexey Samsonov <samsonov at google.com>wrote:
>>>
>>>> Can you add a C sanity check lit-test (that would verify that C program
>>>> compiles and links fine with LSan and LSan + ASan)? See
>>>> sanity_check_pure_c.c in ASan test suite.
>>>>
>>>>
>>>> On Thu, Aug 22, 2013 at 5:23 PM, Sergey Matveev <earthdok at google.com>wrote:
>>>>
>>>>> Author: smatveev
>>>>> Date: Thu Aug 22 08:23:22 2013
>>>>> New Revision: 189010
>>>>>
>>>>> URL: http://llvm.org/viewvc/llvm-project?rev=189010&view=rev
>>>>> Log:
>>>>> [lsan] Build standalone LSan with -fno-rtti.
>>>>>
>>>>> Fix issue where C code could not be built with -fsanitize=leak.
>>>>>
>>>>> Modified:
>>>>>     compiler-rt/trunk/lib/lsan/CMakeLists.txt
>>>>>     compiler-rt/trunk/lib/lsan/tests/CMakeLists.txt
>>>>>
>>>>> Modified: compiler-rt/trunk/lib/lsan/CMakeLists.txt
>>>>> URL:
>>>>> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/CMakeLists.txt?rev=189010&r1=189009&r2=189010&view=diff
>>>>>
>>>>> ==============================================================================
>>>>> --- compiler-rt/trunk/lib/lsan/CMakeLists.txt (original)
>>>>> +++ compiler-rt/trunk/lib/lsan/CMakeLists.txt Thu Aug 22 08:23:22 2013
>>>>> @@ -1,7 +1,8 @@
>>>>>  include_directories(..)
>>>>>
>>>>>  set(LSAN_CFLAGS
>>>>> -  ${SANITIZER_COMMON_CFLAGS})
>>>>> +  ${SANITIZER_COMMON_CFLAGS}
>>>>> +  -fno-rtti)
>>>>>
>>>>>  set(LSAN_COMMON_SOURCES
>>>>>    lsan_common.cc
>>>>>
>>>>> Modified: compiler-rt/trunk/lib/lsan/tests/CMakeLists.txt
>>>>> URL:
>>>>> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/tests/CMakeLists.txt?rev=189010&r1=189009&r2=189010&view=diff
>>>>>
>>>>> ==============================================================================
>>>>> --- compiler-rt/trunk/lib/lsan/tests/CMakeLists.txt (original)
>>>>> +++ compiler-rt/trunk/lib/lsan/tests/CMakeLists.txt Thu Aug 22
>>>>> 08:23:22 2013
>>>>> @@ -9,7 +9,7 @@ set(LSAN_TESTS_SRC
>>>>>    lsan_dummy_unittest.cc)
>>>>>
>>>>>  set(LSAN_TESTS_CFLAGS
>>>>> -  ${LSAN_CFLAGS}
>>>>> +  ${SANITIZER_COMMON_CFLAGS}
>>>>>    ${COMPILER_RT_GTEST_INCLUDE_CFLAGS}
>>>>>    -I${COMPILER_RT_SOURCE_DIR}/lib
>>>>>    -I${LSAN_SRC_DIR})
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> llvm-commits mailing list
>>>>> llvm-commits at cs.uiuc.edu
>>>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Alexey Samsonov, MSK
>>>>
>>>
>>>
>>> _______________________________________________
>>> llvm-commits mailing list
>>> llvm-commits at cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130822/a8210511/attachment.html>


More information about the llvm-commits mailing list