701-riscv-linux-Don-t-add-latomic-with-pthread.patch 1.3 KB

123456789101112131415161718192021222324252627282930313233343536
  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. Now that we have support for inline subword atomic operations, it is no
  6. longer necessary to link against libatomic. This also fixes testsuite
  7. failures because the framework does not properly set up the linker flags
  8. for finding libatomic.
  9. The use of atomic operations is also independent of the use of libpthread.
  10. gcc/
  11. * config/riscv/linux.h (LIB_SPEC): Don't redefine.
  12. ---
  13. gcc/config/riscv/linux.h | 10 ----------
  14. 1 file changed, 10 deletions(-)
  15. --- a/gcc/config/riscv/linux.h
  16. +++ b/gcc/config/riscv/linux.h
  17. @@ -35,16 +35,6 @@ along with GCC; see the file COPYING3.
  18. #undef MUSL_DYNAMIC_LINKER
  19. #define MUSL_DYNAMIC_LINKER "/lib/ld-musl-riscv" XLEN_SPEC MUSL_ABI_SUFFIX ".so.1"
  20. -/* Because RISC-V only has word-sized atomics, it requries libatomic where
  21. - others do not. So link libatomic by default, as needed. */
  22. -#undef LIB_SPEC
  23. -#ifdef LD_AS_NEEDED_OPTION
  24. -#define LIB_SPEC GNU_USER_TARGET_LIB_SPEC \
  25. - " %{pthread:" LD_AS_NEEDED_OPTION " -latomic " LD_NO_AS_NEEDED_OPTION "}"
  26. -#else
  27. -#define LIB_SPEC GNU_USER_TARGET_LIB_SPEC " -latomic "
  28. -#endif
  29. -
  30. #define ICACHE_FLUSH_FUNC "__riscv_flush_icache"
  31. #define CPP_SPEC "%{pthread:-D_REENTRANT}"