[commit: ghc] wip/kavon-nosplit-llvm: temporary fix to workaround travis ci issue (e601e67)

git at git.haskell.org git at git.haskell.org
Wed Oct 4 23:52:54 UTC 2017


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/kavon-nosplit-llvm
Link       : http://ghc.haskell.org/trac/ghc/changeset/e601e67a06451de4b8a5adc069e3af0fc15c0426/ghc

>---------------------------------------------------------------

commit e601e67a06451de4b8a5adc069e3af0fc15c0426
Author: Kavon Farvardin <kavon at farvard.in>
Date:   Wed Oct 4 18:52:14 2017 -0500

    temporary fix to workaround travis ci issue


>---------------------------------------------------------------

e601e67a06451de4b8a5adc069e3af0fc15c0426
 compiler/llvmGen/LlvmMangler.hs | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/compiler/llvmGen/LlvmMangler.hs b/compiler/llvmGen/LlvmMangler.hs
index 25c46dc..9a20092 100644
--- a/compiler/llvmGen/LlvmMangler.hs
+++ b/compiler/llvmGen/LlvmMangler.hs
@@ -81,10 +81,10 @@ type LabRewrite = State -> Rewrite
 -- above that label.
 addInfoTable :: LabelMap ManglerStr -> LabRewrite
 addInfoTable info FirstLabel dflags line = do
-        retPt <- B.stripPrefix labPrefix line
+        retPt <- stripPrefix labPrefix line
         (i, _) <- B.readInt retPt
         statics <- mapLookup (toKey i) info
-        fullName <- B.stripSuffix colon line
+        fullName <- stripSuffix colon line
         return $ B.concat $ (map (\f -> f fullName) statics) ++ [line]
     where
         
@@ -99,6 +99,19 @@ addInfoTable info FirstLabel dflags line = do
         colon = B.pack ":"
         toKey = uniqueToLbl . intToUnique
         
+        -- TODO(kavon): on Travis CI, it seems the bytestring package is out of date, and
+        -- we're missing B.stripSuffix and B.stripPrefix. I've reimplemented them here.
+        -- please remove these when that issue is resolved.
+        stripPrefix pfx line 
+            | B.isPrefixOf pfx line 
+                = Just $ B.drop (B.length pfx) line
+            | otherwise = Nothing
+            
+        stripSuffix sfx line
+            | B.isSuffixOf sfx line
+                = Just $ B.take ((B.length line) - (B.length sfx)) line
+            | otherwise = Nothing
+        
 addInfoTable _ _ _ _ = Nothing
         
 -- | Rewrite a line of assembly source with the given rewrites,



More information about the ghc-commits mailing list