This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug sanitizer/69443] New: -fsanitize=address should add -lpthread to linker call
- From: "hanno at hboeck dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 23 Jan 2016 14:04:54 +0000
- Subject: [Bug sanitizer/69443] New: -fsanitize=address should add -lpthread to linker call
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69443
Bug ID: 69443
Summary: -fsanitize=address should add -lpthread to linker call
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: sanitizer
Assignee: unassigned at gcc dot gnu.org
Reporter: hanno at hboeck dot de
CC: dodji at gcc dot gnu.org, dvyukov at gcc dot gnu.org,
jakub at gcc dot gnu.org, kcc at gcc dot gnu.org
Target Milestone: ---
I encountered a problem when trying to compile various pieces of software with
address sanitizer (happens e.g. with sqlite, openldap, p11-kit, poppler):
* configure script checks whether -lpthread in the linker command is necessary
for pthread support by testing whether pthread_create is available without it.
* with asan it will conclude that -lpthread is not needed because the libasan
provides pthread_create.
* however other pthread functions (e.g. pthread_mutex_create) aren't provided
by libasan, so -lpthread is still needed.
I brought this up on the asan dev list and Konstantin Serebryany noted that in
clang this problem doesn't happen because clang automatically adds -lpthread to
the linker call when asan is enabled. He proposes that gcc should do the same
to avoid this problem.
Here's the discussion on the asan developer list:
https://groups.google.com/forum/#!topic/address-sanitizer/JxnwgrWOLuc