[commit: ghc] master: LlvmMangler: Rewrite @function symbols to @object (ed67d29)

git at git.haskell.org git at git.haskell.org
Tue Jan 7 14:30:31 UTC 2014


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/ed67d290e7389bd87a6feea269a0275e0f0f5e2f/ghc

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

commit ed67d290e7389bd87a6feea269a0275e0f0f5e2f
Author: Ben Gamari <bgamari.foss at gmail.com>
Date:   Sat Dec 14 12:04:28 2013 -0500

    LlvmMangler: Rewrite @function symbols to @object
    
    Signed-off-by: Austin Seipp <austin at well-typed.com>


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

ed67d290e7389bd87a6feea269a0275e0f0f5e2f
 compiler/llvmGen/LlvmMangler.hs |   16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/compiler/llvmGen/LlvmMangler.hs b/compiler/llvmGen/LlvmMangler.hs
index 8815011..a36d6c1 100644
--- a/compiler/llvmGen/LlvmMangler.hs
+++ b/compiler/llvmGen/LlvmMangler.hs
@@ -51,11 +51,17 @@ llvmFixupAsm dflags f1 f2 = {-# SCC "llvm_mangler" #-} do
     w <- openBinaryFile f2 WriteMode
     ss <- readSections r w
     hClose r
-    let fixed = (map rewriteAVX . fixTables) ss
+    let fixed = (map (rewriteSymType . rewriteAVX) . fixTables) ss
     mapM_ (writeSection w) fixed
     hClose w
     return ()
     
+rewriteSymType :: Section -> Section
+rewriteSymType = rewriteInstructions typeFunc typeObj
+  where
+    typeFunc = B.pack "@function"
+    typeObj = B.pack "@object"
+
 -- | Splits the file contents into its sections
 readSections :: Handle -> Handle -> IO [Section]
 readSections r w = go B.empty [] []
@@ -111,6 +117,10 @@ rewriteVmovap = rewriteInstructions vmovap vmovup
     vmovap, vmovup :: B.ByteString
     vmovap = B.pack "vmovap"
     vmovup = B.pack "vmovup"
+#else /* !REWRITE_AVX */
+rewriteAVX :: Section -> Section
+rewriteAVX = id
+#endif /* !REWRITE_SSE */
 
 rewriteInstructions :: B.ByteString -> B.ByteString -> Section -> Section
 rewriteInstructions matchBS replaceBS (hdr, cts) =
@@ -122,10 +132,6 @@ rewriteInstructions matchBS replaceBS (hdr, cts) =
           (hd,tl) | B.null tl -> hd
                   | otherwise -> hd `B.append` replaceBS `B.append`
                                  loop (B.drop (B.length matchBS) tl)
-#else /* !REWRITE_AVX */
-rewriteAVX :: Section -> Section
-rewriteAVX = id
-#endif /* !REWRITE_SSE */
 
 -- | Reorder and convert sections so info tables end up next to the
 -- code. Also does stack fixups.



More information about the ghc-commits mailing list