Ticket #5139: 0001-Output-ELF-.size-directives-for-functions.2.patch

File 0001-Output-ELF-.size-directives-for-functions.2.patch, 1.2 KB (added by tibbe, 2 years ago)
  • compiler/nativeGen/X86/Ppr.hs

    From 7cc9be9c5ac49ca0a0d6ca3905ffb5e3e58f0e9a Mon Sep 17 00:00:00 2001
    From: Johan Tibell <johan.tibell@gmail.com>
    Date: Wed, 27 Apr 2011 14:43:51 +0200
    Subject: [PATCH] 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 5fe78e1..f8f4cc1 100644
    a b  
    8787                      <+> pprCLabel_asm (mkDeadStripPreventer $ entryLblToInfoLbl lbl) 
    8888                    else empty 
    8989#endif 
     90   $$ pprSizeDecl (if null info then lbl else entryLblToInfoLbl lbl) 
    9091 
     92-- | Output the ELF .size directive. 
     93pprSizeDecl :: CLabel -> Doc 
     94#if elf_OBJ_FORMAT 
     95pprSizeDecl lbl = 
     96    ptext (sLit "\t.size") <+> pprCLabel_asm lbl 
     97    <> ptext (sLit ", .-") <> pprCLabel_asm lbl 
     98#else 
     99pprSizeDecl _ = empty 
     100#endif 
    91101 
    92102pprBasicBlock :: NatBasicBlock Instr -> Doc 
    93103pprBasicBlock (BasicBlock blockid instrs) =