[GHC] #9577: String literals are wasting space

GHC ghc-devs at haskell.org
Wed Sep 24 15:38:53 UTC 2014


#9577: String literals are wasting space
-------------------------------------+-------------------------------------
              Reporter:  xnyhps      |            Owner:  xnyhps
                  Type:  bug         |           Status:  new
              Priority:  low         |        Milestone:
             Component:  Compiler    |          Version:  7.8.2
  (NCG)                              |         Keywords:
            Resolution:              |     Architecture:  Unknown/Multiple
      Operating System:              |       Difficulty:  Unknown
  Unknown/Multiple                   |       Blocked By:
       Type of failure:  Runtime     |  Related Tickets:
  performance bug                    |
             Test Case:              |
              Blocking:              |
Differential Revisions:              |
-------------------------------------+-------------------------------------

Comment (by xnyhps):

 Documenting what I found about merging duplicate string constants in
 GCC/clang:

 Turning on `-fmerge-constants` with GCC changes the generated assembly:

 {{{
 -       .section        .rodata
 +       .section        .rodata.str1.1,"aMS", at progbits,1
 }}}

 As far as I can tell, this stands for:

 * `a` sets `SHF_ALLOC`
 * `M` sets `SHF_MERGE`
 * `S` sets `SHF_STRINGS`
 * `@progbits` sets `SHT_PROGBITS`
 * The `1` indicates the size of each entry (character)

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


More information about the ghc-tickets mailing list