guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

12/17: gnu: ghc: Fix build with binutils ≥ 2.39.


From: guix-commits
Subject: 12/17: gnu: ghc: Fix build with binutils ≥ 2.39.
Date: Thu, 18 Jan 2024 07:58:12 -0500 (EST)

jpoiret pushed a commit to branch core-updates
in repository guix.

commit dcb6555b9d5f302b7468d586ebbcffcdde3097c9
Author: Josselin Poiret <dev@jpoiret.xyz>
AuthorDate: Mon Jan 15 23:05:37 2024 +0100

    gnu: ghc: Fix build with binutils ≥ 2.39.
    
    ld warns about exec stack now, making some tests fail.  Fix them (and also
    remove an unwarranted exec stack from libHSrts along with it).
    
    * gnu/packages/patches/ghc-9-StgCRunAsm-only-when-needed.patch
    * gnu/packages/patches/ghc-testsuite-recomp015-execstack.patch: New patches.
    * gnu/local.mk (dist_patch_DATA): Register them.
    * gnu/packages/haskell.scm (ghc-8.6, ghc-8.8, ghc-8.10, ghc-9.0, ghc-9.2,
    ghc-9.4): Use them.
    
    Change-Id: I8e5fc71d7394527d44ff37b1f9bd59d4971ec010
---
 gnu/local.mk                                       |  2 ++
 gnu/packages/haskell.scm                           | 27 ++++++++++++------
 .../ghc-9-StgCRunAsm-only-when-needed.patch        | 33 ++++++++++++++++++++++
 .../ghc-testsuite-recomp015-execstack.patch        | 10 +++++++
 4 files changed, 63 insertions(+), 9 deletions(-)

diff --git a/gnu/local.mk b/gnu/local.mk
index 9ff5705ed6..1c041d3ecc 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1297,9 +1297,11 @@ dist_patch_DATA =                                        
        \
   %D%/packages/patches/geoclue-config.patch                    \
   %D%/packages/patches/gettext-libunicode-update.patch         \
   %D%/packages/patches/ghc-8.0-fall-back-to-madv_dontneed.patch        \
+  %D%/packages/patches/ghc-9-StgCRunAsm-only-when-needed.patch \
   %D%/packages/patches/ghc-9.2-grep-warnings.patch \
   %D%/packages/patches/ghc-testsuite-dlopen-pie.patch          \
   %D%/packages/patches/ghc-testsuite-grep-compat.patch         \
+  %D%/packages/patches/ghc-testsuite-recomp015-execstack.patch \
   %D%/packages/patches/ghc-basement-fix-32bit.patch            \
   %D%/packages/patches/ghc-bytestring-handle-ghc9.patch        \
   %D%/packages/patches/ghc-language-haskell-extract-ghc-8.10.patch     \
diff --git a/gnu/packages/haskell.scm b/gnu/packages/haskell.scm
index 3547c20acb..f17012619e 100644
--- a/gnu/packages/haskell.scm
+++ b/gnu/packages/haskell.scm
@@ -1078,7 +1078,8 @@ interactive environment for the functional language 
Haskell.")
                  "https://www.haskell.org/ghc/dist/";
                  version "/" name "-" version "-testsuite.tar.xz"))
            (patches (search-patches "ghc-testsuite-dlopen-pie.patch"
-                                    "ghc-testsuite-grep-compat.patch"))
+                                    "ghc-testsuite-grep-compat.patch"
+                                    "ghc-testsuite-recomp015-execstack.patch"))
            (sha256
             (base32
              "0pw9r91g2np3i806g2f4f8z4jfdd7mx226cmdizk4swa7av1qf91"))
@@ -1160,7 +1161,8 @@ interactive environment for the functional language 
Haskell.")
                  "https://www.haskell.org/ghc/dist/";
                  version "/ghc-" version "-testsuite.tar.xz"))
            (patches (search-patches "ghc-testsuite-dlopen-pie.patch"
-                                    "ghc-testsuite-grep-compat.patch"))
+                                    "ghc-testsuite-grep-compat.patch"
+                                    "ghc-testsuite-recomp015-execstack.patch"))
            (sha256
             (base32
              "0c55pj2820q26rikhpf636sn4mjgqsxjrl94vsywrh79dxp3k14z"))
@@ -1219,7 +1221,8 @@ interactive environment for the functional language 
Haskell.")
                  "https://www.haskell.org/ghc/dist/";
                  version "/ghc-" version "-testsuite.tar.xz"))
            (patches (search-patches "ghc-testsuite-dlopen-pie.patch"
-                                    "ghc-testsuite-grep-compat.patch"))
+                                    "ghc-testsuite-grep-compat.patch"
+                                    "ghc-testsuite-recomp015-execstack.patch"))
            (sha256
             (base32
              "1zl25gg6bpx5601k8h3cqnns1xfc0nqgwnh8jvn2s65ra3f2g1nz"))
@@ -1302,7 +1305,8 @@ interactive environment for the functional language 
Haskell.")
                                   "/ghc-" version "-src.tar.xz"))
               (sha256
                (base32
-                "15wii8can2r3dcl6jjmd50h2jvn7rlmn05zb74d2scj6cfwl43hl"))))
+                "15wii8can2r3dcl6jjmd50h2jvn7rlmn05zb74d2scj6cfwl43hl"))
+              (patches (search-patches 
"ghc-9-StgCRunAsm-only-when-needed.patch"))))
     (native-inputs
      `(;; GHC 9.0.2 must be built with GHC >= 8.8
        ("ghc-bootstrap" ,ghc-8.10)
@@ -1315,7 +1319,8 @@ interactive environment for the functional language 
Haskell.")
            (sha256
             (base32
              "1m5fzhr4gjn9ni8gxx7ag3fkbw1rspjzgv39mnfb0nkm5mw70v3s"))
-           (patches (search-patches "ghc-9.2-grep-warnings.patch"))
+           (patches (search-patches "ghc-9.2-grep-warnings.patch"
+                                    "ghc-testsuite-recomp015-execstack.patch"))
            (modules '((guix build utils)))
            (snippet
             ;; collections.Iterable was moved to collections.abc in Python 
3.10.
@@ -1347,7 +1352,8 @@ interactive environment for the functional language 
Haskell.")
                                     "/ghc-" version "-src.tar.xz"))
                 (sha256
                  (base32
-                  "07028i0hm74svvq9b3jpkczaj6lsdgn3hgr4wa7diqiq3dypj1h6"))))
+                  "07028i0hm74svvq9b3jpkczaj6lsdgn3hgr4wa7diqiq3dypj1h6"))
+                (patches (search-patches 
"ghc-9-StgCRunAsm-only-when-needed.patch"))))
       (arguments
        (substitute-keyword-arguments (package-arguments base)
          ((#:phases phases '%standard-phases)
@@ -1378,7 +1384,8 @@ interactive environment for the functional language 
Haskell.")
              (sha256
               (base32
                "19ha0hidrijawy53vm2r0sgml5zkl8126mqy7p0pyacmw3k7913l"))
-             (patches (search-patches "ghc-9.2-grep-warnings.patch"))))
+             (patches (search-patches "ghc-9.2-grep-warnings.patch"
+                                      
"ghc-testsuite-recomp015-execstack.patch"))))
          ,@(filter (match-lambda
                      (("ghc-bootstrap" . _) #f)
                      (("ghc-testsuite" . _) #f)
@@ -1468,7 +1475,8 @@ interactive environment for the functional language 
Haskell.")
                                     "/ghc-" version "-src.tar.xz"))
                 (sha256
                  (base32
-                  "1qk7rlqf02s3b6m6sqqngmjq1mxnrz88h159lz6k25gddmdg5kp8"))))
+                  "1qk7rlqf02s3b6m6sqqngmjq1mxnrz88h159lz6k25gddmdg5kp8"))
+                (patches (search-patches 
"ghc-9-StgCRunAsm-only-when-needed.patch"))))
       (arguments
        (substitute-keyword-arguments (package-arguments base)
          ((#:phases phases '%standard-phases)
@@ -1486,7 +1494,8 @@ interactive environment for the functional language 
Haskell.")
                     version "/ghc-" version "-testsuite.tar.xz"))
              (sha256
               (base32
-               "04p2lawxxg3nyv6frzhyjyh3arhqqyh5ka3alxa2pxhcd2hdcja3"))))
+               "04p2lawxxg3nyv6frzhyjyh3arhqqyh5ka3alxa2pxhcd2hdcja3"))
+             (patches (search-patches 
"ghc-testsuite-recomp015-execstack.patch"))))
          ("ghc-alex" ,ghc-alex-bootstrap-for-9.4)
          ("ghc-happy" ,ghc-happy-bootstrap-for-9.4)
          ,@(filter (match-lambda
diff --git a/gnu/packages/patches/ghc-9-StgCRunAsm-only-when-needed.patch 
b/gnu/packages/patches/ghc-9-StgCRunAsm-only-when-needed.patch
new file mode 100644
index 0000000000..3e40da4cc6
--- /dev/null
+++ b/gnu/packages/patches/ghc-9-StgCRunAsm-only-when-needed.patch
@@ -0,0 +1,33 @@
+From d61f742876bdf2cd32e76f7bca389106ad99a316 Mon Sep 17 00:00:00 2001
+From: Ben Gamari <ben@smart-cactus.org>
+Date: Tue, 3 May 2022 12:40:43 -0400
+Subject: [PATCH] rts/ghc.mk: Only build StgCRunAsm.S when it is needed
+
+Previously the make build system unconditionally included StgCRunAsm.S
+in the link, meaning that the RTS would require an execstack
+unnecessarily.
+
+Fixes #21478.
+---
+ rts/ghc.mk | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/rts/ghc.mk b/rts/ghc.mk
+index 36a82f9f2c8..0e56515a569 100644
+--- a/rts/ghc.mk
++++ b/rts/ghc.mk
+@@ -57,8 +57,11 @@ ifneq "$(PORTING_HOST)" "YES"
+ 
+ # unregisterised builds use the mini interpreter
+ ifneq "$(GhcUnregisterised)" "YES"
++# use StgCRunAsm.S on ppc, ppc64, s390x, and riscv64
++ifneq "$(findstring $(TargetArch_CPP), ppc)$(findstring $(TargetArch_CPP), 
ppc64)$(findstring $(TargetArch_CPP), s390x)$(findstring $(TargetArch_CPP), 
riscv64)" ""
+ rts_S_SRCS += rts/StgCRunAsm.S
+ endif
++endif
+ 
+ # select adjustor implementation. This much match the logic in rts.cabal.in.
+ ifneq "$(CLEANING)" "YES"
+-- 
+GitLab
+
diff --git a/gnu/packages/patches/ghc-testsuite-recomp015-execstack.patch 
b/gnu/packages/patches/ghc-testsuite-recomp015-execstack.patch
new file mode 100644
index 0000000000..cdaf5b180d
--- /dev/null
+++ b/gnu/packages/patches/ghc-testsuite-recomp015-execstack.patch
@@ -0,0 +1,10 @@
+--- a/testsuite/tests/driver/recomp015/Makefile   2024-01-13 
16:22:42.643106725 +0100
++++ b/testsuite/tests/driver/recomp015/Makefile   2024-01-13 
16:23:18.406867917 +0100
+@@ -26,6 +26,7 @@
+       # number of sections)
+       '$(TEST_HC)' $(TEST_HC_OPTS) Generate.hs
+       ./Generate > ManySections.s
++      echo '.section .note.GNU-stack,"",@progbits' > ManySections.s
+       echo 'main = putStrLn "Running main..."' > Main.hs
+       '$(TEST_HC)' $(TEST_HC_OPTS) -c ManySections.s
+       '$(TEST_HC)' $(TEST_HC_OPTS) --make -O Main.hs ManySections.o



reply via email to

[Prev in Thread] Current Thread [Next in Thread]