[llvm-bugs] [Bug 27597] New: lib/tsan/go/buildgo.sh does not respect LDFLAGS when linking test binary

via llvm-bugs llvm-bugs at lists.llvm.org
Sun May 1 18:37:55 PDT 2016


https://llvm.org/bugs/show_bug.cgi?id=27597

            Bug ID: 27597
           Summary: lib/tsan/go/buildgo.sh does not respect LDFLAGS when
                    linking test binary
           Product: compiler-rt
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: compiler-rt
          Assignee: unassignedbugs at nondot.org
          Reporter: michael.hudson at canonical.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

buildgo.sh fails on Ubuntu 15.10 because the toolchain defaults to PIE there
currently:

(yakkety-amd64)root at aeglos:/root/trunk/lib/tsan/go# ./buildgo.sh 
gcc gotsan.cc -c -o ./race_linux_amd64.syso -I../rtl -I../..
-I../../sanitizer_common -I../../../include -std=c++11 -m64 -Wall
-fno-exceptions -fno-rtti -DSANITIZER_GO
-DSANITIZER_DEADLOCK_DETECTOR_VERSION=2 -fPIC -ffreestanding
-Wno-maybe-uninitialized -Wno-unused-const-variable -Werror
-Wno-unknown-warning-option -DSANITIZER_DEBUG=0 -O3 -msse3 -fomit-frame-pointer
==27227==ERROR: ThreadSanitizer failed to allocate 0x4000 (16384) bytes at
address 1778c48e40000 (errno: 12)
Segmentation fault (core dumped)

Fixing this requires passing -no-pie to the link, but doing this properly is a
bit of a pain because support for the -no-pie flag is pretty new. It would be
easier for me to work around if linking the test executable respected the
LDFLAGS environment variable:

--- a/lib/tsan/go/buildgo.sh
+++ b/lib/tsan/go/buildgo.sh
@@ -121,7 +121,7 @@
 fi
 $CC $DIR/gotsan.cc -c -o $DIR/race_$SUFFIX.syso $FLAGS $CFLAGS

-$CC test.c $DIR/race_$SUFFIX.syso -m64 -o $DIR/test $OSLDFLAGS
+$CC test.c $DIR/race_$SUFFIX.syso -m64 -o $DIR/test $OSLDFLAGS $LDFLAGS

 export GORACE="exitcode=0 atexit_sleep_ms=0"
 if [ "$SILENT" != "1" ]; then

Would you consider such a change?

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160502/3ebe0971/attachment-0001.html>


More information about the llvm-bugs mailing list