summaryrefslogtreecommitdiff
path: root/libraries
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2020-10-17 15:20:46 -0400
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-11-24 02:43:55 -0500
commit2ed3e6c0f179c06828712832d1176519cdfa82a6 (patch)
treee590d6f89d5cdc505f3ec7d58234d77a2492fa65 /libraries
parent9b95d815d718ce671e9e87b8a2eb0534ed5688dd (diff)
downloadhaskell-2ed3e6c0f179c06828712832d1176519cdfa82a6.tar.gz
CmmToLlvm: Declare signature for memcmpwip/angerman/arm64
Otherwise `opt` fails with: error: use of undefined value '@memcmp$def'
Diffstat (limited to 'libraries')
-rw-r--r--libraries/ghc-boot/GHC/Data/ShortText.hs20
1 files changed, 18 insertions, 2 deletions
diff --git a/libraries/ghc-boot/GHC/Data/ShortText.hs b/libraries/ghc-boot/GHC/Data/ShortText.hs
index f51d79864b..108b5a43cd 100644
--- a/libraries/ghc-boot/GHC/Data/ShortText.hs
+++ b/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