From patchwork Wed May 17 09:22:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bo YU X-Patchwork-Id: 95122 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp993435vqo; Wed, 17 May 2023 02:23:36 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6YN01M9OqZBFgqNB9feTYapVVInNR6HdSIqKSbQRU7tFG98L9KMDCXa5ljzh4r4FCa4aeM X-Received: by 2002:a17:907:3f06:b0:966:335a:5b07 with SMTP id hq6-20020a1709073f0600b00966335a5b07mr39312237ejc.62.1684315416194; Wed, 17 May 2023 02:23:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684315416; cv=none; d=google.com; s=arc-20160816; b=Dp0NQmyT2t2zwj8lgQGD0LhlshQ2R3xDmEJyCdiDGUStmqwbmXgGCM5mglHKUeafRv lgXLSqOAfnMFvt/R6zgUhOMnFLkXv8F6YIQrZ09N4FaHF7+f2TMuBd2tyf/5FGG4T+/Z hFsYlBQXL5XrJEbhb12qtGZ8pbEFx8Hj9dcxBDxz459irX/4yJbHJnGGQ5kkSfTE6NXU +fd0hCmIgRoYv3yCgf7U/n4i62TN4ayXzZv/iqkd7CWqs7jPtZBOiKGY1+/yFUXrwfG9 eDbxKlJSSkceKS5Natuz+7bUv1Fj57wVAOIDsl6RPJliuAk7kYyXv8RPQHxPzJTP1Y6t KNHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-disposition:mime-version:message-id:subject:cc:to:date :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=M02bD1sd5X0qxn93g2aisRJWOdWjemEgE2mzCp69isY=; b=TJR82dBRs83xXsPZPZeKC08V+SFz5ThkH5KtAp0Aq/0YstxHTWzuOIK0Nx2IyhlqJb WVnB4UYLvsYNt5I+5N2OVEoupRsosinD/mjuSdQ6lZMDq0S2NErFozMO1zuEpMxh/VvI dQ/Z6ALm9FCPJyeGsmb++2jxUJ40Uo0xGVgZKIeZT899XJrdpfiPNTJcnVnkRDUseqP9 gBWmEhFHYPER6RmQ4JXqy5ufNZLfXIWHxGqzQlhyUYOEU5ArezdoUpvWHXPDiIAacYEZ 8vLRGpa17s6YylfWbauABI+rkSTJScci3Yxe9ymorrGPbraX/Xv4AexoxliXKBNz5u1a nkUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=cIVrMxld; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id sb22-20020a170906edd600b009662c5776f9si15764319ejb.114.2023.05.17.02.23.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 May 2023 02:23:36 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=cIVrMxld; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 0834A3857019 for ; Wed, 17 May 2023 09:23:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0834A3857019 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1684315415; bh=M02bD1sd5X0qxn93g2aisRJWOdWjemEgE2mzCp69isY=; h=Date:To:Cc:Subject:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=cIVrMxldgOrRt8TwfAavoR5iSrvbplEMiL9kcezRNJ1VOKOR53KZONlEjK0GTTXfi tUUxOj7WwhAiB4mbOdJOOl0ut+v1LMooIFfoOxYFWd0gYcxvLqYza/geoG43exWLOx r1UgmGJHyESqdXcXcb4GyShLYD0KeCsRlQzUGkWk= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-pf1-x433.google.com (mail-pf1-x433.google.com [IPv6:2607:f8b0:4864:20::433]) by sourceware.org (Postfix) with ESMTPS id 62C023858D1E for ; Wed, 17 May 2023 09:22:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 62C023858D1E Received: by mail-pf1-x433.google.com with SMTP id d2e1a72fcca58-643a6f993a7so351192b3a.1 for ; Wed, 17 May 2023 02:22:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684315362; x=1686907362; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=M02bD1sd5X0qxn93g2aisRJWOdWjemEgE2mzCp69isY=; b=XLUHSzb3hNjkH2aI7sUeIuDwZpQJEiB9XJ2X9ZkVmdDmqe/ytC2ifDnr6bWRU9B1Yb 5KozOCFXBFfkPGWACjiu2DrjLidWUGYW8of+7bPCkY4qB2vIeY/QyyPtT8KPszG1s+IC 6iY6YxqehrJpiInhM/S5oErkHdq0MeA5yQKmz5pLxFyyD2R47nBhjv42VhNdD+aJmxHS yjjp0XAuqmPDQ/XCCnqDblewY9Pfq7clj+1w6T7iQEMeQ1EIDNY9unOqv4jXZikI1EwB 2oMpZ6oY4aSyp/LOQOTZlS7ImfvDG67otmxZGO1MtNpPt7+QrFFT8dWGX0ii1XfU56Hy REvA== X-Gm-Message-State: AC+VfDyOBqIbJxg0YaAWbpKesebF/d1vDL4atI8Et44rhPg0LZTtTz9i cF09L4b8XMfd/STV68T/t69we2DqKE7KIt/6 X-Received: by 2002:a05:6a00:218c:b0:645:fc7b:63db with SMTP id h12-20020a056a00218c00b00645fc7b63dbmr153722pfi.20.1684315362033; Wed, 17 May 2023 02:22:42 -0700 (PDT) Received: from debian ([47.242.94.15]) by smtp.gmail.com with ESMTPSA id r20-20020a63ec54000000b005305023fed7sm13704937pgj.74.2023.05.17.02.22.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 May 2023 02:22:41 -0700 (PDT) Date: Wed, 17 May 2023 17:22:38 +0800 To: gcc-patches@gcc.gnu.org Cc: palmer@rivosinc.com, kito.cheng@sifive.com, jeffreyalaw@gmail.com, jiawei@iscas.ac.cn Subject: [PATCH 13-backport] riscv/linux: Don't add -latomic with -pthread Message-ID: <20230517092238.imdawv4fkhu466bf@debian> X-PGP-Key: https://github.com/yuzibo/yuzibo.github.io/blob/master/_includes/subkey-signing-06-18-143E4BAF-pub.asc MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-9.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE 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: , X-Patchwork-Original-From: Bo YU via Gcc-patches From: Bo YU Reply-To: Bo YU 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?1766132721832200409?= X-GMAIL-MSGID: =?utf-8?q?1766132721832200409?= Hi, I just want to backport the commit to gcc-13 branch: commit 203f3060dd363361b172f7295f42bb6bf5ac0b3b Author: Andreas Schwab Date: Sat Apr 23 15:48:42 2022 +0200 riscv/linux: Don't add -latomic with -pthread Now that we have support for inline subword atomic operations, it is no longer necessary to link against libatomic. This also fixes testsuite failures because the framework does not properly set up the linker flags for finding libatomic. The use of atomic operations is also independent of the use of libpthread. gcc/ * config/riscv/linux.h (LIB_SPEC): Don't redefine. The discussion is here: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104338#c20 From d376ec41a9affa946df4676c3bf81118d122f281 Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Sat, 23 Apr 2022 15:48:42 +0200 Subject: [PATCH 13-backport] riscv/linux: Don't add -latomic with -pthread Now that we have support for inline subword atomic operations, it is no longer necessary to link against libatomic. This also fixes testsuite failures because the framework does not properly set up the linker flags for finding libatomic. The use of atomic operations is also independent of the use of libpthread. gcc/ * config/riscv/linux.h (LIB_SPEC): Don't redefine. (cherry picked from commit 203f3060dd363361b172f7295f42bb6bf5ac0b3b) --- gcc/config/riscv/linux.h | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/gcc/config/riscv/linux.h b/gcc/config/riscv/linux.h index b9557a75dc7..2fdfd930cf2 100644 --- a/gcc/config/riscv/linux.h +++ b/gcc/config/riscv/linux.h @@ -35,16 +35,6 @@ along with GCC; see the file COPYING3. If not see #undef MUSL_DYNAMIC_LINKER #define MUSL_DYNAMIC_LINKER "/lib/ld-musl-riscv" XLEN_SPEC MUSL_ABI_SUFFIX ".so.1" -/* Because RISC-V only has word-sized atomics, it requries libatomic where - others do not. So link libatomic by default, as needed. */ -#undef LIB_SPEC -#ifdef LD_AS_NEEDED_OPTION -#define LIB_SPEC GNU_USER_TARGET_LIB_SPEC \ - " %{pthread:" LD_AS_NEEDED_OPTION " -latomic " LD_NO_AS_NEEDED_OPTION "}" -#else -#define LIB_SPEC GNU_USER_TARGET_LIB_SPEC " -latomic " -#endif - #define ICACHE_FLUSH_FUNC "__riscv_flush_icache" #define CPP_SPEC "%{pthread:-D_REENTRANT}" -- 2.39.2