[commit: ghc] master: Output ELF .size directives for functions (32f24dd)

Ian Lynagh igloo at earth.li
Thu Apr 28 02:17:08 CEST 2011


Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/32f24ddfd9549010dd345733c6f46f67196cacf6

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

commit 32f24ddfd9549010dd345733c6f46f67196cacf6
Author: Johan Tibell <johan.tibell at gmail.com>
Date:   Wed Apr 27 14:43:51 2011 +0200

    Output ELF .size directives for functions
    
    This allows tools like Linux's perf events to display symbol names for
    CMM primops.

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

 compiler/nativeGen/X86/Ppr.hs |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/compiler/nativeGen/X86/Ppr.hs b/compiler/nativeGen/X86/Ppr.hs
index 0f0f9d2..4c3454d 100644
--- a/compiler/nativeGen/X86/Ppr.hs
+++ b/compiler/nativeGen/X86/Ppr.hs
@@ -87,7 +87,17 @@ pprNatCmmTop (CmmProc info lbl (ListGraph blocks)) =
                       <+> pprCLabel_asm (mkDeadStripPreventer $ entryLblToInfoLbl lbl)
                     else empty
 #endif
+   $$ pprSizeDecl (if null info then lbl else entryLblToInfoLbl lbl)
 
+-- | Output the ELF .size directive.
+pprSizeDecl :: CLabel -> Doc
+#if elf_OBJ_FORMAT
+pprSizeDecl lbl =
+    ptext (sLit "\t.size") <+> pprCLabel_asm lbl
+    <> ptext (sLit ", .-") <> pprCLabel_asm lbl
+#else
+pprSizeDecl _ = empty
+#endif
 
 pprBasicBlock :: NatBasicBlock Instr -> Doc
 pprBasicBlock (BasicBlock blockid instrs) =





More information about the Cvs-ghc mailing list