[Git][haskell-team/DHG_packages][experimental] ghc: Backport patch to fix armel/armhf

Ilias Tsitsimpis (@iliastsi) gitlab at salsa.debian.org
Wed Dec 27 08:01:33 GMT 2023



Ilias Tsitsimpis pushed to branch experimental at Debian Haskell Group / DHG_packages


Commits:
616ef82d by Ilias Tsitsimpis at 2023-12-26T10:11:03+02:00
ghc: Backport patch to fix armel/armhf

- - - - -


4 changed files:

- p/ghc/debian/changelog
- p/ghc/debian/control
- + p/ghc/debian/patches/fixStgRegStmt-register-width
- p/ghc/debian/patches/series


Changes:

=====================================
p/ghc/debian/changelog
=====================================
@@ -1,3 +1,10 @@
+ghc (9.6.3-1~exp2) experimental; urgency=medium
+
+  * Backport upstream patch to fix build on armel/armhf
+  * Depend on LLVM for loong64
+
+ -- Ilias Tsitsimpis <iliastsi at debian.org>  Tue, 26 Dec 2023 10:08:47 +0200
+
 ghc (9.6.3-1~exp1) experimental; urgency=medium
 
   [ Gianfranco Costamagna ]


=====================================
p/ghc/debian/control
=====================================
@@ -15,7 +15,7 @@ Build-Depends:
   ghc:native (>= 9.2),
   hadrian:native (>= 9.6.3) <!pkg.ghc.nohadrian>,
   hadrian:native (<< 9.7) <!pkg.ghc.nohadrian>,
-  llvm-15 [armel armhf s390x riscv64],
+  llvm-15 [armel armhf s390x riscv64 loong64],
   libgmp-dev,
   libffi-dev,
   libncurses-dev,
@@ -32,7 +32,7 @@ Vcs-Browser: https://salsa.debian.org/haskell-team/DHG_packages/tree/master/p/gh
 Package: ghc
 Architecture: any
 Depends:
-  llvm-15 [armel armhf s390x riscv64],
+  llvm-15 [armel armhf s390x riscv64 loong64],
   gcc,
   libgmp-dev,
   libffi-dev,


=====================================
p/ghc/debian/patches/fixStgRegStmt-register-width
=====================================
@@ -0,0 +1,42 @@
+commit 83775ebb0bbf363d59fef1a7f9802d3981db6558
+Author: Moritz Angermann <moritz.angermann at gmail.com>
+Date:   Mon Oct 9 17:28:47 2023 +0800
+
+    CgUtils.fixStgRegStmt respect register width
+    
+    This change ensure that the reg + offset computation is always of the
+    same size.  Before this we could end up with a 64bit register, and then
+    add a 32bit offset (on 32bit platforms).  This not only would fail type
+    sanity checking, but also incorrectly truncate 64bit values into 32bit
+    values silently on 32bit architectures.
+    
+    (cherry picked from commit dafc47091c9107dcf81e1e80a105f59211927c89)
+    (cherry picked from commit 8e7a2065e433aa56552b335d420b5bf925082078)
+
+Index: b/compiler/GHC/StgToCmm/CgUtils.hs
+===================================================================
+--- a/compiler/GHC/StgToCmm/CgUtils.hs
++++ b/compiler/GHC/StgToCmm/CgUtils.hs
+@@ -173,15 +173,18 @@ fixStgRegStmt platform stmt = fixAssign
+                         BaseReg -> baseAddr
+                         _other  -> CmmLoad baseAddr (globalRegType platform reg) NaturallyAligned
+ 
+-        CmmRegOff (CmmGlobal reg) offset ->
++        CmmRegOff greg@(CmmGlobal reg) offset ->
+             -- RegOf leaves are just a shorthand form. If the reg maps
+             -- to a real reg, we keep the shorthand, otherwise, we just
+             -- expand it and defer to the above code.
++            -- NB: to ensure type correctness we need to ensure the Add
++            --     as well as the Int need to be of the same size as the
++            --     register.
+             case reg `elem` activeStgRegs platform of
+                 True  -> expr
+-                False -> CmmMachOp (MO_Add (wordWidth platform)) [
+-                                    fixExpr (CmmReg (CmmGlobal reg)),
++                False -> CmmMachOp (MO_Add (cmmRegWidth platform greg)) [
++                                    fixExpr (CmmReg greg),
+                                     CmmLit (CmmInt (fromIntegral offset)
+-                                                   (wordWidth platform))]
++                                                   (cmmRegWidth platform greg))]
+ 
+         other_expr -> other_expr


=====================================
p/ghc/debian/patches/series
=====================================
@@ -26,3 +26,4 @@ hurd-cabal-supportrpaths
 hurd-getExecutablePath
 hurd-hadrian-osstring
 hurd-hadrian-supportrpaths
+fixStgRegStmt-register-width



View it on GitLab: https://salsa.debian.org/haskell-team/DHG_packages/-/commit/616ef82d6b84b5b49e1abbb71c5017e7cd7708ba

-- 
View it on GitLab: https://salsa.debian.org/haskell-team/DHG_packages/-/commit/616ef82d6b84b5b49e1abbb71c5017e7cd7708ba
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-haskell-commits/attachments/20231227/b004866e/attachment-0001.htm>


More information about the Pkg-haskell-commits mailing list