Bug#703230: [gcc-4.8] gcc-4.8: -fsanitize=thread requires -fPIC too
Package: gcc-4.8
Version: 4.8-20130315-1
Severity: normal
--- Please enter the report below this line. ---
GCC says that -pie or -shared is needed to use -fsanitize=thread, but that is not enough on amd64:
$ /usr/bin/gcc-4.8 -fsanitize=thread test.c -pie
/usr/bin/ld.bfd.real: /tmp/ccBEgPXP.o: relocation R_X86_64_PC32 against undefined symbol `__tsan_func_entry' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld.bfd.real: final link failed: Bad value
collect2: error: ld returned 1 exit status
-fPIC is needed too:
$ /usr/bin/gcc-4.8 -fsanitize=thread test.c -pie -fPIC
--- System information. ---
Architecture: amd64
Kernel: Linux 3.8.3
Debian Release: 7.0
500 unstable ftp.ro.debian.org
500 stable ftp.ro.debian.org
1 experimental ftp.ro.debian.org
--- Package information. ---
Depends (Version) | Installed
=====================================-+-===================
gcc-4.8-base (= 4.8-20130315-1) |
cpp-4.8 (= 4.8-20130315-1) |
binutils (>= 2.22) |
libgcc-4.8-dev (= 4.8-20130315-1) |
libc6 (>= 2.14) |
libcloog-isl4 (>= 0.17) |
libgmp10 |
libisl10 (>= 0.10) |
libmpc2 |
libmpfr4 (>= 3.1.1) |
zlib1g (>= 1:1.1.4) |
Recommends (Version) | Installed
==========================-+-============
libc6-dev (>= 2.13-5) |
Suggests (Version) | Installed
=============================================-+-======================
gcc-4.8-multilib |
libmudflap0-4.8-dev (= 4.8-20130315-1) |
gcc-4.8-doc (>= 4.8) |
gcc-4.8-locales (>= 4.8) |
libgcc1-dbg (>= 1:4.8-20130315-1) | 1:4.8-20130315-1
libgomp1-dbg (>= 4.8-20130315-1) |
libitm1-dbg (>= 4.8-20130315-1) |
libatomic1-dbg (>= 4.8-20130315-1) |
libasan0-dbg (>= 4.8-20130315-1) |
libtsan0-dbg (>= 4.8-20130315-1) |
libbacktrace1-dbg (>= 4.8-20130315-1) |
libquadmath0-dbg (>= 4.8-20130315-1) |
libmudflap0-dbg (>= 4.8-20130315-1) |
binutils-gold (>= 2.22) | 2.21.52.20110707-1
Reply to: