public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] riscv: Don't add -latomic with -pthread
@ 2023-05-03 10:55 Andreas Schwab
  2023-05-03 11:03 ` Kito Cheng
  0 siblings, 1 reply; 2+ messages in thread
From: Andreas Schwab @ 2023-05-03 10:55 UTC (permalink / raw)
  To: gcc-patches

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 | 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.40.1


-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

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

* Re: [PATCH] riscv: Don't add -latomic with -pthread
  2023-05-03 10:55 [PATCH] riscv: Don't add -latomic with -pthread Andreas Schwab
@ 2023-05-03 11:03 ` Kito Cheng
  0 siblings, 0 replies; 2+ messages in thread
From: Kito Cheng @ 2023-05-03 11:03 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: gcc-patches

OK, thanks :)

On Wed, May 3, 2023 at 6:55 PM Andreas Schwab via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
> 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 | 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.40.1
>
>
> --
> Andreas Schwab, SUSE Labs, schwab@suse.de
> GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
> "And now for something completely different."

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

end of thread, other threads:[~2023-05-03 11:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-03 10:55 [PATCH] riscv: Don't add -latomic with -pthread Andreas Schwab
2023-05-03 11:03 ` Kito Cheng

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).