Backport upstream libatomic patch
See:
0cc08e22d8
Signed-off-by: David Abdurachmanov <davidlt@rivosinc.com>
This commit is contained in:
parent
503c583851
commit
be6bbf8dbc
94
0cc08e22d8aabb67caf4ad8a216de63fd31deb76.patch
Normal file
94
0cc08e22d8aabb67caf4ad8a216de63fd31deb76.patch
Normal file
@ -0,0 +1,94 @@
|
||||
From 0cc08e22d8aabb67caf4ad8a216de63fd31deb76 Mon Sep 17 00:00:00 2001
|
||||
From: Haochen Tong <i@hexchain.org>
|
||||
Date: Mon, 11 Oct 2021 11:40:56 +0800
|
||||
Subject: [PATCH] Check for libatomic dependency for atomic operations
|
||||
|
||||
Some platforms (e.g. RISC-V) require linking against libatomic for some
|
||||
(e.g. sub-word-sized) atomic operations.
|
||||
|
||||
Fixes #19119.
|
||||
|
||||
(cherry picked from commit 90f06a0e015e18c066fe1569fb2add318bec72ca)
|
||||
---
|
||||
configure.ac | 26 ++++++++++++++++++++++++++
|
||||
rts/package.conf.in | 3 +++
|
||||
rts/rts.cabal.in | 5 +++++
|
||||
3 files changed, 34 insertions(+)
|
||||
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index 6eac557b931..53da5170448 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -1230,6 +1230,32 @@ AC_LINK_IFELSE([
|
||||
AC_MSG_RESULT(no)
|
||||
)
|
||||
|
||||
+AC_MSG_CHECKING(whether -latomic is needed for sub-word-sized atomic operations)
|
||||
+AC_LINK_IFELSE([AC_LANG_PROGRAM([[unsigned char a;]], [[__atomic_fetch_or(&a, 1, __ATOMIC_RELAXED);]])],
|
||||
+ [
|
||||
+ AC_MSG_RESULT(no)
|
||||
+ AC_SUBST([CabalNeedLibatomic],[False])
|
||||
+ need_latomic=0
|
||||
+ ],
|
||||
+ [
|
||||
+ _save_LIBS=$LIBS
|
||||
+ LIBS="-latomic"
|
||||
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[unsigned char a;]], [[__atomic_fetch_or(&a, 1, __ATOMIC_RELAXED);]])],
|
||||
+ [
|
||||
+ AC_MSG_RESULT(yes)
|
||||
+ AC_SUBST([CabalNeedLibatomic],[True])
|
||||
+ need_latomic=1
|
||||
+ ],
|
||||
+ [
|
||||
+ AC_SUBST([CabalNeedLibatomic],[False])
|
||||
+ AC_MSG_ERROR([sub-word-sized atomic operations not available.])
|
||||
+ need_latomic=0
|
||||
+ ])
|
||||
+ LIBS=$_save_LIBS
|
||||
+ ])
|
||||
+AC_DEFINE_UNQUOTED([NEED_ATOMIC_LIB], [$need_latomic],
|
||||
+ [Define to 1 if we need -latomic for sub-word atomic operations.])
|
||||
+
|
||||
dnl ** check for eventfd which is needed by the I/O manager
|
||||
AC_CHECK_HEADERS([sys/eventfd.h])
|
||||
AC_CHECK_FUNCS([eventfd])
|
||||
diff --git a/rts/package.conf.in b/rts/package.conf.in
|
||||
index e7379045ed3..b29512c2dea 100644
|
||||
--- a/rts/package.conf.in
|
||||
+++ b/rts/package.conf.in
|
||||
@@ -63,6 +63,9 @@ extra-libraries:
|
||||
, "elf"
|
||||
, "dw" /* for backtraces */
|
||||
#endif
|
||||
+#if NEED_ATOMIC_LIB
|
||||
+ , "atomic"
|
||||
+#endif
|
||||
|
||||
#if defined(INSTALLING)
|
||||
include-dirs: INCLUDE_DIR FFI_INCLUDE_DIR
|
||||
diff --git a/rts/rts.cabal.in b/rts/rts.cabal.in
|
||||
index cebf6795f35..1d6860d8723 100644
|
||||
--- a/rts/rts.cabal.in
|
||||
+++ b/rts/rts.cabal.in
|
||||
@@ -18,6 +18,8 @@ flag libbfd
|
||||
default: @CabalHaveLibbfd@
|
||||
flag mingwex
|
||||
default: @CabalMingwex@
|
||||
+flag need-atomic
|
||||
+ default: @CabalNeedLibatomic@
|
||||
flag libdw
|
||||
default: @CabalHaveLibdw@
|
||||
flag libnuma
|
||||
@@ -111,6 +113,9 @@ library
|
||||
if flag(need-pthread)
|
||||
-- for pthread_getthreadid_np, pthread_create, ...
|
||||
extra-libraries: pthread
|
||||
+ if flag(need-atomic)
|
||||
+ -- for sub-word-sized atomic operations (#19119)
|
||||
+ extra-libraries: atomic
|
||||
if flag(libbfd)
|
||||
-- for debugging
|
||||
extra-libraries: bfd iberty
|
||||
--
|
||||
GitLab
|
||||
|
11
ghc.spec
11
ghc.spec
@ -52,7 +52,7 @@ Version: 8.10.7
|
||||
# - release can only be reset if *all* library versions get bumped simultaneously
|
||||
# (sometimes after a major release)
|
||||
# - minor release numbers for a branch should be incremented monotonically
|
||||
Release: 121.0.riscv64%{?dist}
|
||||
Release: 121.1.riscv64%{?dist}
|
||||
Summary: Glasgow Haskell Compiler
|
||||
|
||||
License: BSD and HaskellReport
|
||||
@ -99,6 +99,8 @@ Patch26: no-missing-haddock-file-warning.patch
|
||||
# see also deprecated ghc_arches defined in ghc-srpm-macros
|
||||
# /usr/lib/rpm/macros.d/macros.ghc-srpm
|
||||
|
||||
Patch30: 0cc08e22d8aabb67caf4ad8a216de63fd31deb76.patch
|
||||
|
||||
BuildRequires: ghc-compiler > 8.6
|
||||
# for ABI hash checking
|
||||
%if %{with abicheck}
|
||||
@ -350,6 +352,10 @@ rm -r libffi-tarballs
|
||||
%patch24 -p1 -b .orig
|
||||
%patch26 -p1 -b .orig
|
||||
|
||||
%ifarch riscv64
|
||||
%patch30 -p1 -b .orig
|
||||
%endif
|
||||
|
||||
%if %{with haddock}
|
||||
%global gen_contents_index gen_contents_index.orig
|
||||
if [ ! -f "libraries/%{gen_contents_index}" ]; then
|
||||
@ -674,6 +680,9 @@ env -C %{ghc_html_libraries_dir} ./gen_contents_index
|
||||
|
||||
|
||||
%changelog
|
||||
* Mon Oct 24 2022 David Abdurachmanov <davidlt@rivosinc.com> - 8.10.7-121.1.riscv64
|
||||
- Backport upstream libatomic patch
|
||||
|
||||
* Mon Oct 24 2022 David Abdurachmanov <davidlt@rivosinc.com> - 8.10.7-121.0.riscv64
|
||||
- Link to libatomic for riscv64
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user