[llvm-branch-commits] [compiler-rt] 9c0c123 - [CMake][tsan] Remove --sysroot=.

Fangrui Song via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Dec 30 09:35:43 PST 2020


Author: Fangrui Song
Date: 2020-12-30T09:30:58-08:00
New Revision: 9c0c123b0b48772973f8864e36e451ab0c8c7419

URL: https://github.com/llvm/llvm-project/commit/9c0c123b0b48772973f8864e36e451ab0c8c7419
DIFF: https://github.com/llvm/llvm-project/commit/9c0c123b0b48772973f8864e36e451ab0c8c7419.diff

LOG: [CMake][tsan] Remove --sysroot=.

rL254966 added `--sysroot=.` to prevent accidental including system headers.
It caused hassle to FreeBSD (D17383)/NetBSD. The next problem is that
we want to include `features.h` (usually `/usr/include/features.h`) to detect `__GLIBC__`.

At this point it seems that `--sysroot=.` adds lots of inconvenience so we disable it for now.
If there is a better way preventing accidental system header inclusion we can consider it again.

Reviewed By: #sanitizers, vitalybuka

Differential Revision: https://reviews.llvm.org/D93921

Added: 
    

Modified: 
    compiler-rt/lib/tsan/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/tsan/CMakeLists.txt b/compiler-rt/lib/tsan/CMakeLists.txt
index c99b16d8aaa3a..88c6f09e88aa3 100644
--- a/compiler-rt/lib/tsan/CMakeLists.txt
+++ b/compiler-rt/lib/tsan/CMakeLists.txt
@@ -238,21 +238,6 @@ else()
   endforeach()
 endif()
 
-# Make sure that non-platform-specific files don't include any system headers.
-# FreeBSD/NetBSD do not install a number of Clang-provided headers for the
-# compiler in the base system due to incompatibilities between FreeBSD/NetBSD's
-# and Clang's versions. As a workaround do not use --sysroot=. on FreeBSD/NetBSD
-# until this is addressed.
-if(COMPILER_RT_HAS_SYSROOT_FLAG AND NOT CMAKE_SYSTEM_NAME MATCHES "FreeBSD"
-   AND NOT CMAKE_SYSTEM_NAME MATCHES "NetBSD")
-  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})
-  set_source_files_properties(${_tsan_generic_sources}
-    PROPERTIES COMPILE_FLAGS "--sysroot=.")
-endif()
-
 # Build libcxx instrumented with TSan.
 if(COMPILER_RT_LIBCXX_PATH AND
    COMPILER_RT_LIBCXXABI_PATH AND


        


More information about the llvm-branch-commits mailing list