[Git][ghc/ghc][master] ghc-prim: Link against libatomic

Marge Bot (@marge-bot) gitlab at gitlab.haskell.org
Sat Jul 22 03:25:24 UTC 2023



Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC


Commits:
fc186b0c by Ilias Tsitsimpis at 2023-07-21T23:25:03-04:00
ghc-prim: Link against libatomic

Commit b4d39adbb58 made 'hs_cmpxchg64()' available to all architectures.
Unfortunately this made GHC to fail to build on armel, since armel needs
libatomic to support atomic operations on 64-bit word sizes.

Configure libraries/ghc-prim/ghc-prim.cabal to link against libatomic,
the same way as we do in rts/rts.cabal.

- - - - -


2 changed files:

- hadrian/src/Rules/Generate.hs
- libraries/ghc-prim/ghc-prim.cabal → libraries/ghc-prim/ghc-prim.cabal.in


Changes:

=====================================
hadrian/src/Rules/Generate.hs
=====================================
@@ -327,6 +327,9 @@ rtsCabalFlags = mconcat
   where
     flag = interpolateCabalFlag
 
+ghcPrimCabalFlags :: Interpolations
+ghcPrimCabalFlags = interpolateCabalFlag "CabalNeedLibatomic" NeedLibatomic
+
 packageVersions :: Interpolations
 packageVersions = foldMap f [ base, ghcPrim, compiler, ghc, cabal, templateHaskell, ghcCompact, array ]
   where
@@ -346,6 +349,7 @@ templateRules :: Rules ()
 templateRules = do
   templateRule "compiler/ghc.cabal" $ projectVersion
   templateRule "rts/rts.cabal" $ rtsCabalFlags
+  templateRule "libraries/ghc-prim/ghc-prim.cabal" $ ghcPrimCabalFlags
   templateRule "driver/ghci/ghci-wrapper.cabal" $ projectVersion
   templateRule "ghc/ghc-bin.cabal" $ projectVersion
   templateRule "utils/iserv/iserv.cabal" $ projectVersion


=====================================
libraries/ghc-prim/ghc-prim.cabal → libraries/ghc-prim/ghc-prim.cabal.in
=====================================
@@ -27,6 +27,9 @@ source-repository head
 custom-setup
     setup-depends: base >= 4 && < 5, process, filepath, directory, Cabal >= 1.23 && < 3.9
 
+flag need-atomic
+  default: @CabalNeedLibatomic@
+
 Library
     default-language: Haskell2010
     other-extensions:
@@ -81,6 +84,10 @@ Library
         -- is just an empty shell.
         extra-libraries: c, m
 
+    if flag(need-atomic)
+        -- for 64-bit atomic ops on armel (#20549)
+        extra-libraries: atomic
+
     if !os(ghcjs)
       c-sources:
           cbits/atomic.c



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/fc186b0c0ac56d6ff6225d3f6607be37770fcb52

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/fc186b0c0ac56d6ff6225d3f6607be37770fcb52
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20230721/fb469523/attachment-0001.html>


More information about the ghc-commits mailing list