[Bug 251112] Compiling C++ with asan fails by default because libclang_rt.asan-x86_64.so uses symbol pthread_attr_get_np but doesn't link to libpthread.so

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Fri Nov 20 12:01:56 UTC 2020


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=251112

--- Comment #8 from Konstantin Belousov <kib at FreeBSD.org> ---
(In reply to Andrew Stitcher from comment #7)
Stubs do nothing in different ways.  They never load libpthread.  Mostly they
do nothing and return success, like pthread_mutex_lock() stub.  Some very
specific stubs return failure since callers are prepared for it, like
pthread_once() or pthread_key_create().

Basically, stubs allow to compile a library with knowledge of threads, but only
utilize synchronization and other thread-related services if process actually
loaded libpthread.

If we add pthread_attr_get_np() stub to libc, most likely it would do nothing.
It should fit with you description of asan runtime not calling
pthread_attr_get_np() if no threads were spawned.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-bugs mailing list