b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [diff] [blame^] | 1 | From 203f3060dd363361b172f7295f42bb6bf5ac0b3b Mon Sep 17 00:00:00 2001 |
| 2 | From: Andreas Schwab <schwab@suse.de> |
| 3 | Date: Sat, 23 Apr 2022 15:48:42 +0200 |
| 4 | Subject: [PATCH] riscv/linux: Don't add -latomic with -pthread |
| 5 | |
| 6 | Now that we have support for inline subword atomic operations, it is no |
| 7 | longer necessary to link against libatomic. This also fixes testsuite |
| 8 | failures because the framework does not properly set up the linker flags |
| 9 | for finding libatomic. |
| 10 | The use of atomic operations is also independent of the use of libpthread. |
| 11 | |
| 12 | gcc/ |
| 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}" |