[COMMITTED] config: -pthread shouldn't link with -lpthread on Solaris
Rainer Orth
ro@CeBiTec.Uni-Bielefeld.DE
Tue Apr 4 08:25:51 GMT 2023
libpthread has been folded into libc since Solaris 10 and replaced by a
filter on libc. Linking with libpthread thus only creates unnecessary
runtime overhead.
This patch thus removes linking with -lpthread if -pthread/-pthreads is
specified, thus getting rid of the libpthread dependency in libatomic,
libgdruntime, libgomp, libgphobos, and libitm.
Bootstrapped without regressions on i386-pc-solaris2.11 and
sparc-sun-solaris2.11 (both Solaris 11.3 and 11.4).
Committed to trunk.
There are more instances of this issue: both libsanitizer and libgo
unnecessarily link with -lpthread, either unconditionally or due to a
configure test which doesn't check if the library is actually needed.
This can be fixed by consistently using AX_PTHREAD from
config/ax_pthread.m4, but such a fix affects all targets and is clearly
not stage 4 material.
Rainer
--
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University
2023-04-03 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
gcc:
* config/sol2.h (LIB_SPEC): Don't link with -lpthread.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sol2-pthread-no-lpthread.patch
Type: text/x-patch
Size: 446 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20230404/1a783f76/attachment.bin>
More information about the Gcc-patches
mailing list