From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.CeBiTec.Uni-Bielefeld.DE (smtp.CeBiTec.Uni-Bielefeld.DE [129.70.160.84]) by sourceware.org (Postfix) with ESMTPS id 390023858D1E for ; Tue, 4 Apr 2023 08:25:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 390023858D1E Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=CeBiTec.Uni-Bielefeld.DE Authentication-Results: sourceware.org; spf=none smtp.mailfrom=cebitec.uni-bielefeld.de Received: from localhost (localhost [127.0.0.1]) by smtp.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTP id CEA04AC74B for ; Tue, 4 Apr 2023 10:25:52 +0200 (CEST) X-Virus-Scanned: amavisd-new at CeBiTec.Uni-Bielefeld.DE Received: from smtp.CeBiTec.Uni-Bielefeld.DE ([127.0.0.1]) by localhost (smtp.cebitec.uni-bielefeld.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 8Yl8oc8ba1oR for ; Tue, 4 Apr 2023 10:25:52 +0200 (CEST) Received: from manam.CeBiTec.Uni-Bielefeld.DE (p508558f9.dip0.t-ipconnect.de [80.133.88.249]) (Authenticated sender: ro) by smtp.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTPSA id D2B22AC74A for ; Tue, 4 Apr 2023 10:25:51 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=CeBiTec.Uni-Bielefeld.DE; s=20200306; t=1680596751; bh=wu1aS9S8BvXcvsEtmyvIlRepBecgtX+LMZHLTphzrb4=; h=From:To:Subject:Date:From; b=QNszZ43/W9fVdD0oj5svBVoXEDmLHNzZ55acjdmCXSz6lVPrMjEkEsuqTZu2RR7m1 g+KtMOtk3ewN6hUH4IBil3gvxTGNLwm/c3QhUStq6DvTzAdeaNt7PEErsGoJ/Kev5z EpV7CXXuxXQenZUTjBt/sImDrL2Um8dGD3QUp6uuQijLSl0swYt8mh0Z/DpJuiqmBd uw9aINHnCxUHC4V+iNWZIZC4S+I4rrsC5us0v0Se3VSOQ5UIe1mCGX5Cfk6NA8dMbc mLL5Ozfn+cvNamYtynLbAWHSsTUYezV9mRGl3SFWL9CJIwIJysRteBHCqxrrG3JljI 0pwc/wPlWw1aw== From: Rainer Orth To: gcc-patches@gcc.gnu.org Subject: [COMMITTED] config: -pthread shouldn't link with -lpthread on Solaris Date: Tue, 04 Apr 2023 10:25:51 +0200 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1.90 (usg-unix-v) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Status: No, score=-3793.8 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,GIT_PATCH_0,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: --=-=-= Content-Type: text/plain 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 gcc: * config/sol2.h (LIB_SPEC): Don't link with -lpthread. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=sol2-pthread-no-lpthread.patch # HG changeset patch # Parent 5e543e5a54a480b50f3f8534837cb5ec7ad96a07 config: -pthread shouldn't link with -lpthread on Solaris diff --git a/gcc/config/sol2.h b/gcc/config/sol2.h --- a/gcc/config/sol2.h +++ b/gcc/config/sol2.h @@ -161,7 +161,6 @@ along with GCC; see the file COPYING3. #undef LIB_SPEC #define LIB_SPEC \ "%{!symbolic:\ - %{pthreads|pthread:-lpthread} \ %{p|pg:-ldl} -lc}" #ifndef CROSS_DIRECTORY_STRUCTURE --=-=-=--