public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH 13-backport] riscv/linux: Don't add -latomic with -pthread
@ 2023-05-17  9:22 Bo YU
  2023-05-19 17:22 ` Jeff Law
  0 siblings, 1 reply; 2+ messages in thread
From: Bo YU @ 2023-05-17  9:22 UTC (permalink / raw)
  To: gcc-patches; +Cc: palmer, kito.cheng, jeffreyalaw, jiawei


[-- Attachment #1.1: Type: text/plain, Size: 790 bytes --]

Hi,

I just want to backport the commit to gcc-13 branch:

commit 203f3060dd363361b172f7295f42bb6bf5ac0b3b
Author: Andreas Schwab <schwab@suse.de>
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


-- 
Regards,
--
   Bo YU


[-- Attachment #1.2: 0001-riscv-linux-Don-t-add-latomic-with-pthread.patch --]
[-- Type: text/x-diff, Size: 1626 bytes --]

From d376ec41a9affa946df4676c3bf81118d122f281 Mon Sep 17 00:00:00 2001
From: Andreas Schwab <schwab@suse.de>
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


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH 13-backport] riscv/linux: Don't add -latomic with -pthread
  2023-05-17  9:22 [PATCH 13-backport] riscv/linux: Don't add -latomic with -pthread Bo YU
@ 2023-05-19 17:22 ` Jeff Law
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff Law @ 2023-05-19 17:22 UTC (permalink / raw)
  To: Bo YU, gcc-patches; +Cc: palmer, kito.cheng, jiawei



On 5/17/23 03:22, Bo YU wrote:
> Hi,
> 
> I just want to backport the commit to gcc-13 branch:
> 
> commit 203f3060dd363361b172f7295f42bb6bf5ac0b3b
> Author: Andreas Schwab <schwab@suse.de>
> 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
THanks.  I've backported this to gcc-13.
jeff

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-05-19 17:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-17  9:22 [PATCH 13-backport] riscv/linux: Don't add -latomic with -pthread Bo YU
2023-05-19 17:22 ` Jeff Law

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).