-fsanitize=thread fails to link; needs -ltsan

Bug #1413474 reported by Chris Halse Rogers
14
This bug affects 3 people
Affects Status Importance Assigned to Milestone
gcc-5 (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

When passing -fsanitize=thread to gcc, it fails to pass -ltsan through to the linker, causing linking to fail.

For example:
> gcc -std=c99 -fsanitize=thread -fPIC -pie -o epoll_test epoll_test.c
/tmp/cc8yFwPg.o: In function `main':
epoll_test.c:(.text+0x30): undefined reference to `__tsan_func_entry'
epoll_test.c:(.text+0x58): undefined reference to `__tsan_write4'
epoll_test.c:(.text+0x6b): undefined reference to `__tsan_read4'
epoll_test.c:(.text+0x7e): undefined reference to `__tsan_write4'
epoll_test.c:(.text+0x8d): undefined reference to `__tsan_read4'
epoll_test.c:(.text+0xd1): undefined reference to `__tsan_read4'
epoll_test.c:(.text+0x155): undefined reference to `__tsan_read4'
epoll_test.c:(.text+0x1b0): undefined reference to `__tsan_read4'
epoll_test.c:(.text+0x20b): undefined reference to `__tsan_read4'
/tmp/cc8yFwPg.o:epoll_test.c:(.text+0x231): more undefined references to `__tsan_read4' follow
/tmp/cc8yFwPg.o: In function `main':
epoll_test.c:(.text+0x383): undefined reference to `__tsan_func_exit'
/tmp/cc8yFwPg.o: In function `_GLOBAL__sub_I_00099_0_epoll_test.c':
epoll_test.c:(.text+0x3ac): undefined reference to `__tsan_init'
collect2: error: ld returned 1 exit status

ProblemType: Bug
DistroRelease: Ubuntu 15.04
Package: gcc 4:4.9.2-1ubuntu1
ProcVersionSignature: Ubuntu 3.18.0-9.10-generic 3.18.2
Uname: Linux 3.18.0-9-generic x86_64
ApportVersion: 2.15.1-0ubuntu2
Architecture: amd64
CurrentDesktop: Unity
Date: Thu Jan 22 16:13:08 2015
InstallationDate: Installed on 2013-08-06 (533 days ago)
InstallationMedia: Ubuntu 13.04 "Raring Ringtail" - Release amd64 (20130424)
SourcePackage: gcc-defaults
UpgradeStatus: Upgraded to vivid on 2013-08-06 (533 days ago)

Related branches

Revision history for this message
Chris Halse Rogers (raof) wrote :
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in gcc-defaults (Ubuntu):
status: New → Confirmed
Matthias Klose (doko)
affects: gcc-defaults (Ubuntu) → gcc-5 (Ubuntu)
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package gcc-5 - 5.3.1-11ubuntu1

---------------
gcc-5 (5.3.1-11ubuntu1) xenial; urgency=medium

  * Update to SVN 20160311 (r234142, 5.3.1) from the gcc-5-branch.
    - Fix PR tree-optimization/69666, PR middle-end/69920, PR c++/67364.
  * Update the ibm branch to 20160310. LP: #1554644.
  * When configured to link with --as-needed by default, always link the
    sanitizer libraries with --no-as-needed. LP: #1413474

gcc-5 (5.3.1-11) unstable; urgency=medium

  [ Matthias Klose ]
  * Update to SVN 20160307 (r234017, 5.3.1) from the gcc-5-branch.
    - s390x backend backports.
    - Fix PR target/69625 (s390x), PR other/69006, PR tree-optimization/69776,
      PR c++/67364, PR c++/68049, PR target/65932 (ARM32),
      PR target/67714 (ARM32), PR target/70059 (x86), PR rtl-optimization/70007,
      PR tree-optimization/69740, PR tree-optimization/69740, PR c++/67364,
      PR c++/51406, PR c++/67364, PR c++/69261, PR c++/68087, PR c++/67104,
      PR c++/51489, PR c++/69995, PR c++/69995, PR c++/65985.
  * Fix m68k packaging typo. Closes: #815895.
  * Remove powerpcspe specific patch, integrated upstream. Closes: #816048.

  [ Svante Signell ]
  * patches/ada-hurd.diff: Update. Closes: #815967.

 -- Matthias Klose <email address hidden> Fri, 11 Mar 2016 16:56:02 +0100

Changed in gcc-5 (Ubuntu):
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.