blob: 328c7be9ce8ec4acd54a2a45429afee5093e8615 [file] [log] [blame]
b.liue9582032025-04-17 19:18:16 +08001From 203f3060dd363361b172f7295f42bb6bf5ac0b3b Mon Sep 17 00:00:00 2001
2From: Andreas Schwab <schwab@suse.de>
3Date: Sat, 23 Apr 2022 15:48:42 +0200
4Subject: [PATCH] riscv/linux: Don't add -latomic with -pthread
5
6Now that we have support for inline subword atomic operations, it is no
7longer necessary to link against libatomic. This also fixes testsuite
8failures because the framework does not properly set up the linker flags
9for finding libatomic.
10The use of atomic operations is also independent of the use of libpthread.
11
12gcc/
13 * config/riscv/linux.h (LIB_SPEC): Don't redefine.
14---
15 gcc/config/riscv/linux.h | 10 ----------
16 1 file changed, 10 deletions(-)
17
18--- a/gcc/config/riscv/linux.h
19+++ b/gcc/config/riscv/linux.h
20@@ -35,16 +35,6 @@ along with GCC; see the file COPYING3.
21 #undef MUSL_DYNAMIC_LINKER
22 #define MUSL_DYNAMIC_LINKER "/lib/ld-musl-riscv" XLEN_SPEC MUSL_ABI_SUFFIX ".so.1"
23
24-/* Because RISC-V only has word-sized atomics, it requries libatomic where
25- others do not. So link libatomic by default, as needed. */
26-#undef LIB_SPEC
27-#ifdef LD_AS_NEEDED_OPTION
28-#define LIB_SPEC GNU_USER_TARGET_LIB_SPEC \
29- " %{pthread:" LD_AS_NEEDED_OPTION " -latomic " LD_NO_AS_NEEDED_OPTION "}"
30-#else
31-#define LIB_SPEC GNU_USER_TARGET_LIB_SPEC " -latomic "
32-#endif
33-
34 #define ICACHE_FLUSH_FUNC "__riscv_flush_icache"
35
36 #define CPP_SPEC "%{pthread:-D_REENTRANT}"