From 0fb8a5356214c47bbb832e89fbb3da1c755eeb73 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Thu, 2 Apr 2020 12:46:28 +0200 Subject: [PATCH] tsan: don't check libc dependency on FreeBSD This check fails on FreeBSD: https://github.com/golang/go/issues/14481#issuecomment-607471193 It is meant to prevent regressions, so disable it on FreeBSD. --- compiler-rt/lib/tsan/go/buildgo.sh | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/compiler-rt/lib/tsan/go/buildgo.sh b/compiler-rt/lib/tsan/go/buildgo.sh index f85cad57185e..6133421318f2 100755 --- a/compiler-rt/lib/tsan/go/buildgo.sh +++ b/compiler-rt/lib/tsan/go/buildgo.sh @@ -66,6 +66,10 @@ if [ "`uname -a | grep Linux`" != "" ]; then ARCHCFLAGS="" fi elif [ "`uname -a | grep FreeBSD`" != "" ]; then + # The resulting object still depends on libc. + # We removed this dependency for Go runtime for other OSes, + # and we should remove it for FreeBSD as well, but there is no pressing need. + DEPENDS_ON_LIBC=1 SUFFIX="freebsd_amd64" OSCFLAGS="-fno-strict-aliasing -fPIC -Werror" ARCHCFLAGS="-m64" @@ -172,10 +176,12 @@ $CC $DIR/gotsan.cpp -c -o $DIR/race_$SUFFIX.syso $FLAGS $CFLAGS $CC $OSCFLAGS $ARCHCFLAGS test.c $DIR/race_$SUFFIX.syso -g -o $DIR/test $OSLDFLAGS $LDFLAGS -# Verify that no glibc specific code is present -if nm $DIR/race_$SUFFIX.syso | grep -q __libc_; then - printf -- '%s seems to link to libc\n' "race_$SUFFIX.syso" - exit 1 +# Verify that no libc specific code is present. +if [ "$DEPENDS_ON_LIBC" != "1" ]; then + if nm $DIR/race_$SUFFIX.syso | grep -q __libc_; then + printf -- '%s seems to link to libc\n' "race_$SUFFIX.syso" + exit 1 + fi fi export GORACE="exitcode=0 atexit_sleep_ms=0"