Incl. fixes for libatomic

Signed-off-by: David Abdurachmanov <davidlt@rivosinc.com>
This commit is contained in:
David Abdurachmanov 2023-05-18 08:53:00 +03:00
parent 95ffd49207
commit cb2b386bb6
Signed by: davidlt
GPG Key ID: 8B7F1DA0E2C9FDBB
3 changed files with 2124 additions and 1 deletions

View File

@ -0,0 +1,41 @@
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(-)
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.39.1

File diff suppressed because it is too large Load Diff

View File

@ -136,7 +136,7 @@
Summary: Various compilers (C, C++, Objective-C, ...) Summary: Various compilers (C, C++, Objective-C, ...)
Name: gcc Name: gcc
Version: %{gcc_version} Version: %{gcc_version}
Release: %{gcc_release}.1.riscv64%{?dist} Release: %{gcc_release}.2.riscv64%{?dist}
# libgcc, libgfortran, libgomp, libstdc++ and crtstuff have # libgcc, libgfortran, libgomp, libstdc++ and crtstuff have
# GCC Runtime Exception. # GCC Runtime Exception.
License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ with exceptions and LGPLv2+ and BSD License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ with exceptions and LGPLv2+ and BSD
@ -294,6 +294,10 @@ Patch101: gcc13-fortran-flogical-as-integer.patch
Patch102: gcc13-fortran-fdec-override-kind.patch Patch102: gcc13-fortran-fdec-override-kind.patch
Patch103: gcc13-fortran-fdec-non-logical-if.patch Patch103: gcc13-fortran-fdec-non-logical-if.patch
# RISCV (atomic)
Patch150: 55088cf384d4c43e280ec794217e32fab64070ba.patch
Patch151: 203f3060dd363361b172f7295f42bb6bf5ac0b3b.patch
# On ARM EABI systems, we do want -gnueabi to be part of the # On ARM EABI systems, we do want -gnueabi to be part of the
# target triple. # target triple.
%ifnarch %{arm} %ifnarch %{arm}
@ -873,6 +877,11 @@ touch -r isl-0.24/m4/ax_prog_cxx_for_build.m4 isl-0.24/m4/ax_prog_cc_for_build.m
%patch -P103 -p1 -b .fortran-fdec-non-logical-if~ %patch -P103 -p1 -b .fortran-fdec-non-logical-if~
%endif %endif
%ifarch riscv64
%patch -P150 -p1 -b .riscv-inline-atomics~
%patch -P151 -p1 -b .riscv-nolibatomic-pthread~
%endif
%ifarch %{arm} %ifarch %{arm}
rm -f gcc/testsuite/go.test/test/fixedbugs/issue19182.go rm -f gcc/testsuite/go.test/test/fixedbugs/issue19182.go
%endif %endif
@ -3469,6 +3478,11 @@ end
%endif %endif
%changelog %changelog
* Thu May 18 2023 David Abdurachmanov <davidlt@rivosinc.com> 13.1.1-2.2.riscv64
- On riscv64 include these backports to fix libatomic issues:
- 55088cf384d4c43e280ec794217e32fab64070ba (from gcc13 branch)
- 203f3060dd363361b172f7295f42bb6bf5ac0b3b (from master branch)
* Sat May 13 2023 David Abdurachmanov <davidlt@rivosinc.com> 13.1.1-2.0.riscv64 * Sat May 13 2023 David Abdurachmanov <davidlt@rivosinc.com> 13.1.1-2.0.riscv64
- Update config.{sub,guess} scripts for ISL - Update config.{sub,guess} scripts for ISL
- Fix annobin plugin Fedora version check - Fix annobin plugin Fedora version check