toolchain: gcc: backport inline subword atomic support for riscv
RISC-V has no support for subword atomic operations; code currently generates libatomic library calls. This patch changes the default behavior to fast inline subword atomic calls that do not require libatomic. Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
This commit is contained in:
parent
3baa45fbd8
commit
7b4a966de8
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,36 @@
|
|||
From 203f3060dd363361b172f7295f42bb6bf5ac0b3b Mon Sep 17 00:00:00 2001
|
||||
From: Andreas Schwab <schwab@suse.de>
|
||||
Date: Sat, 23 Apr 2022 15:48:42 +0200
|
||||
Subject: [PATCH] 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.
|
||||
---
|
||||
gcc/config/riscv/linux.h | 10 ----------
|
||||
1 file changed, 10 deletions(-)
|
||||
|
||||
--- a/gcc/config/riscv/linux.h
|
||||
+++ b/gcc/config/riscv/linux.h
|
||||
@@ -35,16 +35,6 @@ along with GCC; see the file COPYING3.
|
||||
#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}"
|
|
@ -114,7 +114,7 @@ Date: Tue Jul 31 00:52:27 2007 +0000
|
|||
; On SVR4 targets, it also controls whether or not to emit a
|
||||
--- a/gcc/doc/invoke.texi
|
||||
+++ b/gcc/doc/invoke.texi
|
||||
@@ -9058,6 +9058,17 @@ This option is only supported for C and
|
||||
@@ -9059,6 +9059,17 @@ This option is only supported for C and
|
||||
@option{-Wall} and by @option{-Wpedantic}, which can be disabled with
|
||||
@option{-Wno-pointer-sign}.
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,36 @@
|
|||
From 203f3060dd363361b172f7295f42bb6bf5ac0b3b Mon Sep 17 00:00:00 2001
|
||||
From: Andreas Schwab <schwab@suse.de>
|
||||
Date: Sat, 23 Apr 2022 15:48:42 +0200
|
||||
Subject: [PATCH] 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.
|
||||
---
|
||||
gcc/config/riscv/linux.h | 10 ----------
|
||||
1 file changed, 10 deletions(-)
|
||||
|
||||
--- a/gcc/config/riscv/linux.h
|
||||
+++ b/gcc/config/riscv/linux.h
|
||||
@@ -35,16 +35,6 @@ along with GCC; see the file COPYING3.
|
||||
#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}"
|
|
@ -114,7 +114,7 @@ Date: Tue Jul 31 00:52:27 2007 +0000
|
|||
; On SVR4 targets, it also controls whether or not to emit a
|
||||
--- a/gcc/doc/invoke.texi
|
||||
+++ b/gcc/doc/invoke.texi
|
||||
@@ -9596,6 +9596,17 @@ This option is only supported for C and
|
||||
@@ -9597,6 +9597,17 @@ This option is only supported for C and
|
||||
@option{-Wall} and by @option{-Wpedantic}, which can be disabled with
|
||||
@option{-Wno-pointer-sign}.
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,36 @@
|
|||
From 203f3060dd363361b172f7295f42bb6bf5ac0b3b Mon Sep 17 00:00:00 2001
|
||||
From: Andreas Schwab <schwab@suse.de>
|
||||
Date: Sat, 23 Apr 2022 15:48:42 +0200
|
||||
Subject: [PATCH] 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.
|
||||
---
|
||||
gcc/config/riscv/linux.h | 10 ----------
|
||||
1 file changed, 10 deletions(-)
|
||||
|
||||
--- a/gcc/config/riscv/linux.h
|
||||
+++ b/gcc/config/riscv/linux.h
|
||||
@@ -35,16 +35,6 @@ along with GCC; see the file COPYING3.
|
||||
#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}"
|
|
@ -114,7 +114,7 @@ Date: Tue Jul 31 00:52:27 2007 +0000
|
|||
; On SVR4 targets, it also controls whether or not to emit a
|
||||
--- a/gcc/doc/invoke.texi
|
||||
+++ b/gcc/doc/invoke.texi
|
||||
@@ -10061,6 +10061,17 @@ This option is only supported for C and
|
||||
@@ -10062,6 +10062,17 @@ This option is only supported for C and
|
||||
@option{-Wall} and by @option{-Wpedantic}, which can be disabled with
|
||||
@option{-Wno-pointer-sign}.
|
||||
|
||||
|
|
Loading…
Reference in New Issue