forked from OSchip/llvm-project
[sanitizers] Pass CMAKE_C_FLAGS into TSan buildgo script
When compiling with ccache, compiler commands get split into smaller steps and clang's default -Wunused-command-line-argument complains about unused include directory arguments. In combination -Werror, compilation aborts. If CMAKE_C_FLAGS contains -Wno-unused-command-line-argument or -Wno-error=unused-command-line-argument, the latter flag is passed into the build script. This is a re-commit. The previous version was reverted because of failing tests. Differential Revision: https://reviews.llvm.org/D96762
This commit is contained in:
parent
4125afc357
commit
ed4230732a
|
@ -113,6 +113,10 @@ set(TSAN_HEADERS
|
|||
set(TSAN_RUNTIME_LIBRARIES)
|
||||
add_compiler_rt_component(tsan)
|
||||
|
||||
if("${CMAKE_C_FLAGS}" MATCHES "-Wno-(error=)?unused-command-line-argument")
|
||||
set(EXTRA_CFLAGS "-Wno-error=unused-command-line-argument ${EXTRA_CFLAGS}")
|
||||
endif()
|
||||
|
||||
if(APPLE)
|
||||
# Ideally we would check the SDK version for the actual platform we are
|
||||
# building for here. To make our lifes easier we assume the host SDK setup is
|
||||
|
@ -156,6 +160,7 @@ if(APPLE)
|
|||
set(BUILDGO_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/go/buildgo.sh)
|
||||
add_custom_target(GotsanRuntimeCheck
|
||||
COMMAND env "CC=${CMAKE_C_COMPILER} ${OSX_SYSROOT_FLAG}"
|
||||
EXTRA_CFLAGS=${EXTRA_CFLAGS}
|
||||
IN_TMPDIR=1 SILENT=1 ${BUILDGO_SCRIPT}
|
||||
DEPENDS tsan ${BUILDGO_SCRIPT}
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/go
|
||||
|
@ -170,6 +175,7 @@ else()
|
|||
set(BUILDGO_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/go/buildgo.sh)
|
||||
add_custom_target(GotsanRuntimeCheck
|
||||
COMMAND env "CC=${CMAKE_C_COMPILER} ${CMAKE_C_COMPILER_ARG1}"
|
||||
EXTRA_CFLAGS=${EXTRA_CFLAGS}
|
||||
IN_TMPDIR=1 SILENT=1 ${BUILDGO_SCRIPT}
|
||||
DEPENDS clang_rt.tsan-${arch} ${BUILDGO_SCRIPT}
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/go
|
||||
|
@ -181,6 +187,7 @@ else()
|
|||
set(BUILDGO_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/go/buildgo.sh)
|
||||
add_custom_target(GotsanRuntimeCheck
|
||||
COMMAND env "CC=${CMAKE_C_COMPILER} ${CMAKE_C_COMPILER_ARG1}"
|
||||
EXTRA_CFLAGS=${EXTRA_CFLAGS}
|
||||
IN_TMPDIR=1 SILENT=1 ${BUILDGO_SCRIPT}
|
||||
DEPENDS clang_rt.tsan-${arch} ${BUILDGO_SCRIPT}
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/go
|
||||
|
@ -192,6 +199,7 @@ else()
|
|||
set(BUILDGO_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/go/buildgo.sh)
|
||||
add_custom_target(GotsanRuntimeCheck
|
||||
COMMAND env "CC=${CMAKE_C_COMPILER} ${CMAKE_C_COMPILER_ARG1}"
|
||||
EXTRA_CFLAGS=${EXTRA_CFLAGS}
|
||||
IN_TMPDIR=1 SILENT=1 ${BUILDGO_SCRIPT}
|
||||
DEPENDS clang_rt.tsan-${arch} ${BUILDGO_SCRIPT}
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/go
|
||||
|
|
|
@ -171,7 +171,7 @@ for F in $SRCS; do
|
|||
cat $F >> $DIR/gotsan.cpp
|
||||
done
|
||||
|
||||
FLAGS=" -I../rtl -I../.. -I../../sanitizer_common -I../../../include -std=c++14 -Wall -fno-exceptions -fno-rtti -DSANITIZER_GO=1 -DSANITIZER_DEADLOCK_DETECTOR_VERSION=2 $OSCFLAGS $ARCHCFLAGS"
|
||||
FLAGS=" -I../rtl -I../.. -I../../sanitizer_common -I../../../include -std=c++14 -Wall -fno-exceptions -fno-rtti -DSANITIZER_GO=1 -DSANITIZER_DEADLOCK_DETECTOR_VERSION=2 $OSCFLAGS $ARCHCFLAGS $EXTRA_CFLAGS"
|
||||
DEBUG_FLAGS="$FLAGS -DSANITIZER_DEBUG=1 -g"
|
||||
FLAGS="$FLAGS -DSANITIZER_DEBUG=0 -O3 -fomit-frame-pointer"
|
||||
if [ "$SUFFIX" = "linux_ppc64le" ]; then
|
||||
|
|
Loading…
Reference in New Issue