[Git][ghc/ghc][wip/T18857] fixup ShortText

Moritz Angermann gitlab at gitlab.haskell.org
Fri Nov 13 02:37:53 UTC 2020



Moritz Angermann pushed to branch wip/T18857 at Glasgow Haskell Compiler / GHC


Commits:
71fdb441 by Moritz Angermann at 2020-11-13T02:37:34+00:00
fixup ShortText

- - - - -


1 changed file:

- libraries/ghc-boot/GHC/Data/ShortText.hs


Changes:

=====================================
libraries/ghc-boot/GHC/Data/ShortText.hs
=====================================
@@ -1,6 +1,22 @@
-{-# LANGUAGE BangPatterns, MagicHash, UnboxedTuples, GeneralizedNewtypeDeriving, DerivingStrategies #-}
+{-# LANGUAGE BangPatterns, MagicHash, UnboxedTuples, GeneralizedNewtypeDeriving, DerivingStrategies, CPP #-}
 {-# OPTIONS_GHC -O2 -funbox-strict-fields #-}
-
+-- gross hack: we manuvered ourselves into a position where we can't boot GHC with a LLVM based GHC anymore.
+-- LLVM based GHC's fail to compile memcmp ffi calls.  These end up as memcmp$def in the llvm ir, however we
+-- don't have any prototypes and subsequently the llvm toolchain chokes on them.  Since 7fdcce6d, we use
+-- ShortText for the package database.  This however introduces this very module; which through inlining ends
+-- up bringing memcmp_ByteArray from bytestring:Data.ByteString.Short.Internal into scope, which results in
+-- the memcmp call we choke on.
+--
+-- The solution thusly is to force late binding via the linker instead of inlining when comping with the
+-- bootstrap compiler.  This will produce a slower (slightly less optimised) stage1 compiler only.
+--
+-- See issue 18857. hsyl20 deserves credit for coming up with the idea for the soltuion.
+--
+-- This can be removed when we exit the boot compiler window. Thus once we drop GHC-9.2 as boot compiler,
+-- we can drop this code as well.
+#if GHC_STAGE < 1
+{-# OPTIONS_GHC -fignore-interface-pragmas #-}
+#endif
 -- |
 -- An Unicode string for internal GHC use. Meant to replace String
 -- in places where being a lazy linked is not very useful and a more



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

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/71fdb441d0af4767cb9fc797c3460ce1365e317f
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/20201112/c4855947/attachment.html>


More information about the ghc-commits mailing list