This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug sanitizer/69443] New: -fsanitize=address should add -lpthread to linker call


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]