[GHC] #5139: Output ELF .size directives

GHC cvs-ghc at haskell.org
Wed Apr 27 14:09:55 CEST 2011


#5139: Output ELF .size directives
------------------------------+---------------------------------------------
  Reporter:  tibbe            |          Owner:  tibbe           
      Type:  feature request  |         Status:  new             
  Priority:  normal           |      Milestone:  7.2.1           
 Component:  Compiler         |        Version:  7.0.3           
Resolution:                   |       Keywords:                  
  Testcase:                   |      Blockedby:                  
Difficulty:                   |             Os:  Unknown/Multiple
  Blocking:                   |   Architecture:  Unknown/Multiple
   Failure:  None/Unknown     |  
------------------------------+---------------------------------------------

Comment(by tibbe):

 I've triaged the issue a bit further. Adding the `.size` directive is
 enough to make `dynHelloWorld` fail:

 {{{
 diff --git a/compiler/nativeGen/X86/Ppr.hs b/compiler/nativeGen/X86/Ppr.hs
 index 5fe78e1..f8f4cc1 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) =
 }}}

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5139#comment:8>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler



More information about the Glasgow-haskell-bugs mailing list