[compiler-rt] r254966 - [TSan] Enforce TSan runtime doesn't include system headers with --sysroot flag.

Dimitry Andric via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 2 14:53:19 PST 2016


Note also that this appears to be because during a test-release.sh build, it doesn't the just-built clang 3.8.0 to build compiler-rt, it uses the host compiler instead.  I'm not entirely sure whether that is correct?

-Dimitry

> On 02 Feb 2016, at 23:48, Dimitry Andric via llvm-commits <llvm-commits at lists.llvm.org> wrote:
> 
> Hmm, for me this causes the compiler-rt build to fail on FreeBSD 10, because the sysroot option then points to non-existing directories.  E.g. it gives:
> 
> clang -cc1 version 3.4.1 based upon LLVM 3.4.1 default target x86_64-unknown-freebsd10.2
> ignoring nonexistent directory "./usr/include/c++/v1"
> ignoring nonexistent directory "/usr/bin/../lib/clang/3.4.1/include"
> ignoring nonexistent directory "./usr/include/clang/3.4.1"
> ignoring nonexistent directory "./usr/include"
> #include "..." search starts here:
> #include <...> search starts here:
> /home/dim/llvm-3.8.0/rc2/Phase1/Release/llvmCore-3.8.0-rc2.obj/projects/compiler-rt/lib/tsan
> /home/dim/llvm-3.8.0/rc2/llvm.src/projects/compiler-rt/lib/tsan
> /home/dim/llvm-3.8.0/rc2/Phase1/Release/llvmCore-3.8.0-rc2.obj/include
> /home/dim/llvm-3.8.0/rc2/llvm.src/include
> /usr/local/include
> /home/dim/llvm-3.8.0/rc2/llvm.src/projects/compiler-rt/lib/tsan/..
> End of search list.
> In file included from /home/dim/llvm-3.8.0/rc2/llvm.src/projects/compiler-rt/lib/tsan/rtl/tsan_interceptors.cc:2411:
> /home/dim/llvm-3.8.0/rc2/llvm.src/projects/compiler-rt/lib/tsan/../sanitizer_common/sanitizer_common_interceptors.inc:41:10: fatal error:
>      'stdarg.h' file not found
> #include <stdarg.h>
>         ^
> 1 error generated.
> 
> Note that on FreeBSD 10, clang's internal headers (which normally don't contain stdarg.h, but on my particular build machine they do), are in /usr/include/clang/3.4.1.
> 
> Any reason this can't be fixed using -nostdinc, instead?
> 
> -Dimitry
> 
>> On 08 Dec 2015, at 00:21, Alexey Samsonov via llvm-commits <llvm-commits at lists.llvm.org> wrote:
>> 
>> Author: samsonov
>> Date: Mon Dec  7 17:21:36 2015
>> New Revision: 254966
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=254966&view=rev
>> Log:
>> [TSan] Enforce TSan runtime doesn't include system headers with --sysroot flag.
>> 
>> Modified:
>>   compiler-rt/trunk/cmake/config-ix.cmake
>>   compiler-rt/trunk/lib/tsan/CMakeLists.txt
>> 
>> Modified: compiler-rt/trunk/cmake/config-ix.cmake
>> URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/cmake/config-ix.cmake?rev=254966&r1=254965&r2=254966&view=diff
>> ==============================================================================
>> --- compiler-rt/trunk/cmake/config-ix.cmake (original)
>> +++ compiler-rt/trunk/cmake/config-ix.cmake Mon Dec  7 17:21:36 2015
>> @@ -29,6 +29,7 @@ check_cxx_compiler_flag(-ftls-model=init
>> check_cxx_compiler_flag(-fno-lto             COMPILER_RT_HAS_FNO_LTO_FLAG)
>> check_cxx_compiler_flag(-msse3               COMPILER_RT_HAS_MSSE3_FLAG)
>> check_cxx_compiler_flag(-std=c99             COMPILER_RT_HAS_STD_C99_FLAG)
>> +check_cxx_compiler_flag(--sysroot=.          COMPILER_RT_HAS_SYSROOT_FLAG)
>> 
>> if(NOT WIN32 AND NOT CYGWIN)
>>  # MinGW warns if -fvisibility-inlines-hidden is used.
>> 
>> Modified: compiler-rt/trunk/lib/tsan/CMakeLists.txt
>> URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/CMakeLists.txt?rev=254966&r1=254965&r2=254966&view=diff
>> ==============================================================================
>> --- compiler-rt/trunk/lib/tsan/CMakeLists.txt (original)
>> +++ compiler-rt/trunk/lib/tsan/CMakeLists.txt Mon Dec  7 17:21:36 2015
>> @@ -21,7 +21,6 @@ append_list_if(SANITIZER_LIMIT_FRAME_SIZ
>>               TSAN_RTL_CFLAGS)
>> append_list_if(COMPILER_RT_HAS_WGLOBAL_CONSTRUCTORS_FLAG -Wglobal-constructors
>>               TSAN_RTL_CFLAGS)
>> -# FIXME: Add support for --sysroot=. compile flag:
>> 
>> set(TSAN_SOURCES
>>  rtl/tsan_clock.cc
>> @@ -187,6 +186,18 @@ endif()
>> 
>> add_dependencies(compiler-rt tsan)
>> 
>> +# Make sure that non-platform-specific files don't include any system headers.
>> +if(COMPILER_RT_HAS_SYSROOT_FLAG)
>> +  file(GLOB _tsan_generic_sources rtl/tsan*)
>> +  file(GLOB _tsan_platform_sources rtl/tsan*posix* rtl/tsan*mac*
>> +                                   rtl/tsan*linux*)
>> +  list(REMOVE_ITEM _tsan_generic_sources ${_tsan_platform_sources})
>> +  message(STATUS "platform: ${_tsan_platform_sources}")
>> +  message(STATUS "generic: ${_tsan_generic_sources}")
>> +  set_source_files_properties(${_tsan_generic_sources}
>> +    PROPERTIES COMPILE_FLAGS "--sysroot=.")
>> +endif()
>> +
>> # Build libcxx instrumented with TSan.
>> if(COMPILER_RT_HAS_LIBCXX_SOURCES AND
>>   COMPILER_RT_TEST_COMPILER_ID STREQUAL "Clang")
>> 
>> 
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 194 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160202/81e344dd/attachment.sig>


More information about the llvm-commits mailing list