From patchwork Tue Apr 4 08:25:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rainer Orth X-Patchwork-Id: 78914 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2862506vqo; Tue, 4 Apr 2023 01:27:00 -0700 (PDT) X-Google-Smtp-Source: AKy350Y1H7bqmyzUXvtA2eqB5EgE4MdsBQr3goqXipK7fXRPfTatkwKToU+UEXgEPfDrATuP8zT+ X-Received: by 2002:a05:6402:716:b0:502:30e6:1e47 with SMTP id w22-20020a056402071600b0050230e61e47mr1885777edx.13.1680596820456; Tue, 04 Apr 2023 01:27:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680596820; cv=none; d=google.com; s=arc-20160816; b=A9l1jcstDCq3SQm2Un3Ar5P7ACGqmuq6nS/+ubkk+2E5jfUpHwdr5JKCaaL4vLySZA kReiZwOtysFPS+Hvc4tFoML9TggUpcK59VslL/fyl81vi9NWhAp6nf3Qrg2FXw+8mZQy YoJoOaNGnYFwxtXMWRLdtnzLiNNZ4uZBrLrZY2EBpPTz9l+mgr+yRcdd0xq4N5r1qHY5 PWsDPKZya4RXee6O+cqhUkBAdot/EAXYeQCSZwcR43AP0xWV/2tmVuwh64WXO1XFIyEQ rJ0S1Q80nARD+r6BUUwfjV+sPG/wSzBYEE9BoaNUopRt0qLI1HoA9rZbXHTxdbUd+ZfB ksmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:mime-version:user-agent :message-id:date:subject:to:from:dkim-signature:dmarc-filter :delivered-to; bh=StXb5cWTW6+C0Pwbykup4YxAl1LSbs5iHNyM8nhs9vU=; b=U9v4f7sBojOSeKRhj/LJbV1buzawNs9OWZHZckZJui+tMAd7HIv1PP6oScIhzmA6nY 1u1xuLZoGxmI/cq0q+VvvVGSjO6R+fbWSSE4JowX0DWjw2+aR4GVmU1DBD7FV+VJTcL6 pCWT4w57pF8t8BM/IvNWlqkoBW7yExms+K2FaarOtlMGwihUbkuvRcNCRrVoxzB6N6y7 NAnVA3d2HrL6pl1ofcP2kl48ynvmE7B/2gIvuXUrLC2tsx2pEYs2Na8s8zVq+Bj84mZc 6dT1tu/pZSjMfkpfV6tYz0zIIdtlQ506OAkZuqOMlTJIb6QYDKP2nDZw+pKlBwFClFLA H4Ow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@CeBiTec.Uni-Bielefeld.DE header.s=20200306 header.b="QNszZ43/"; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id r10-20020aa7c14a000000b005003e301b87si91209edp.239.2023.04.04.01.27.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Apr 2023 01:27:00 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@CeBiTec.Uni-Bielefeld.DE header.s=20200306 header.b="QNszZ43/"; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 80A4F3857BA4 for ; Tue, 4 Apr 2023 08:26:50 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org 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 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 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762233491581745391?= X-GMAIL-MSGID: =?utf-8?q?1762233491581745391?= 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 # 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