Are you talking about gcc or clang?

In clang, the driver adds -lpthread to the linker command.

% clang -fsanitize=address ./heap-buffer-overflow.c -v 2>&1 | grep thread
--color
...-lpthread -lrt -lm -ldl -lgcc...

In gcc looks like this does not happen.
(I'd say this needs to be fixed in gcc, just for compatibility, at least)



On Wed, Jan 20, 2016 at 5:26 AM, 'Dmitry Vyukov' via address-sanitizer <
[email protected]> wrote:

> On Wed, Jan 20, 2016 at 2:22 PM, Hanno Böck <[email protected]> wrote:
> > Hi,
> >
> > I stumbled upon an issue that I'm not sure what the best fix is and
> > wanted to ask people here for opinions.
> >
> > There are a couple of packages that have a check in the configure
> > script that will check for the presence of the pthread_create function.
> > The check works as far as I understand as follows:
> > * check whether pthread_create is available without a flag
> > * check whether pthread_create is available with -lpthread
> >
> > Now here's the problem: libasan contains a pthread_create function.
> > Therefore the configure scripts will assume that pthread is available.
> > However libasan doesn't contain the full pthread functionality, other
> > functions like pthread_mutex_create aren't available.
> >
> > Therefore:
> > * configure script thinks we don't need -lpthread
> > * application uses pthread functionality that's not in libasan
> > * compilation fails
> >
> >
> > I have first encountered this in sqlite, upstream has now fixed this by
> > checking for a different pthread function (patch came from me):
> > https://www.sqlite.org/cgi/src/info/9c3a0dc2e8bf202c
> >
> > Now I wonder - is this a good solution? I know of at least three other
> > packages (poppler, openldap, p11-kit) that have the same issue and
> > wonder if I should send similar patches or if there's a better / more
> > clean solution to this.
>
>
> FWIW you can add -lpthread whenever you add -fsanitize=address.
>
> --
> You received this message because you are subscribed to the Google Groups
> "address-sanitizer" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"address-sanitizer" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to