[commit: ghc] wip/kavon-nosplit-llvm: fix bug with missing symbols in info table on Linux (3bee4f8)

git at git.haskell.org git at git.haskell.org
Wed May 16 23:21:19 UTC 2018


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

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

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

commit 3bee4f8515db7aa3d644085da431ecf330575983
Author: Kavon Farvardin <kavon at farvard.in>
Date:   Wed May 16 18:13:04 2018 -0500

    fix bug with missing symbols in info table on Linux
    
    [skip-ci]


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

3bee4f8515db7aa3d644085da431ecf330575983
 compiler/llvmGen/LlvmCodeGen/Data.hs | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/compiler/llvmGen/LlvmCodeGen/Data.hs b/compiler/llvmGen/LlvmCodeGen/Data.hs
index 75493d1..355fca0 100644
--- a/compiler/llvmGen/LlvmCodeGen/Data.hs
+++ b/compiler/llvmGen/LlvmCodeGen/Data.hs
@@ -195,7 +195,7 @@ cvtForMangler (Statics _ datum) = do
         --  its corresponding byte string.
         cvtLit (CmmLabelDiffOff srt _ off w) = do
             srtVar <- getGlobalPtr =<< strCLabel_llvm srt
-            let srtLab = asmNameOf srtVar
+            srtLab <- asmNameOf srtVar
             return $ mkDiffOff srtLab off w
 
         cvtLit _ = error "cvtForMangler: unexpected lit."
@@ -220,11 +220,12 @@ cvtForMangler (Statics _ datum) = do
                 eol
             ]
 
-        -- TODO(kavon): consult dflags to put the right number of underscores on the name
-        asmNameOf (LMGlobalVar fs _ _ _ _ _) = let
-                llName = "_" ++ unpackFS fs
-            in
-                B.pack llName
+        asmNameOf (LMGlobalVar fs _ _ _ _ _) = do
+            dflags <- getDynFlags
+            return $ B.pack $ case platformOS (targetPlatform dflags) of
+              OSDarwin -> "_" ++ unpackFS fs
+              OSLinux  -> unpackFS fs
+              _        -> panic "please update cvtForMangler"
 
         asmNameOf _ = error "asmNameOf -- unexpected name kind"
 



More information about the ghc-commits mailing list