[Bug 1413474] [NEW] -fsanitize=thread fails to link; needs -ltsan
Chris Halse Rogers
chris at cooperteam.net
Thu Jan 22 05:16:44 UTC 2015
Public bug reported:
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)
** Affects: gcc-defaults (Ubuntu)
Importance: Undecided
Status: New
** Tags: amd64 apport-bug vivid
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to gcc-defaults in Ubuntu.
https://bugs.launchpad.net/bugs/1413474
Title:
-fsanitize=thread fails to link; needs -ltsan
Status in gcc-defaults package in Ubuntu:
New
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)
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/gcc-defaults/+bug/1413474/+subscriptions
More information about the foundations-bugs
mailing list