gcc vs. clang builds of 7.8.3 on OS X

Mark Lentczner mark.lentczner at gmail.com
Sun Jul 13 06:48:53 UTC 2014


The clang executable size mystery deepens:

The sizes are indeed waaaay big:

7.4M test-files-clang/test*
4.5M test-files-clang/test-stripped*
1.4M test-files-gcc/test*
1.1M test-files-gcc/test-stripped*


Looking at the load info from the stripped versions, it is all in the main
text segment:

                           test-files-clang/load   test-files-gcc/load
__TEXT.__text            :             3,554,134               833,502
__TEXT.__stubs           :                   876                   672
__TEXT.__stub_helper     :                 1,476                 1,136
__TEXT.__const           :                59,040                32,104
__TEXT.__cstring         :                24,156                24,900
__TEXT.__dof_HaskellEv   :                 4,774                 4,774
__TEXT.__eh_frame        :                22,976                46,664
__DATA.__got             :                 1,264                   880
__DATA.__nl_symbol_ptr   :                    16                    16
__DATA.__la_symbol_ptr   :                 1,168                   896
__DATA.__mod_init_func   :                     8                     8
__DATA.__const           :               130,048                79,744
__DATA.__data            :               231,848                22,904
__DATA.__common          :                45,924                46,092
__DATA.__bss             :                   856                   840
TOTAL SIZE               :             4,078,564             1,095,132


But, the compiled sizes are identical:

1.9K test-files-clang/Main.o
1.9K test-files-gcc/Main.o


And, after dumping the link command, and looking up all the libs linked in
(identical set in both cases), the clang libs are actually *smaller:*

13,004,272 ...clang.../lib/ghc-7.8.3/base-4.7.0.1/libHSbase-4.7.0.1.a
   792,352
...clang.../lib/ghc-7.8.3/ghc-prim-0.3.1.0/libHSghc-prim-0.3.1.0.a
 1,010,824
...clang.../lib/ghc-7.8.3/integer-gmp-0.5.1.0/libHSinteger-gmp-0.5.1.0.a
    55,816 ...clang.../lib/ghc-7.8.3/rts-1.0/libCffi.a
   565,112 ...clang.../lib/ghc-7.8.3/rts-1.0/libHSrts.a

24,378,416 ...gcc.../lib/ghc-7.8.3/base-4.7.0.1/libHSbase-4.7.0.1.a
 1,253,176 ...gcc.../lib/ghc-7.8.3/ghc-prim-0.3.1.0/libHSghc-prim-0.3.1.0.a
 1,014,280
...gcc.../lib/ghc-7.8.3/integer-gmp-0.5.1.0/libHSinteger-gmp-0.5.1.0.a
    57,984 ...gcc.../lib/ghc-7.8.3/rts-1.0/libCffi.a
   556,432 ...gcc.../lib/ghc-7.8.3/rts-1.0/libHSrts.a

So now I'm totally mystified! What is in that 3M of extra text segment?!?!?

- Mark
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/ghc-devs/attachments/20140712/5a4ea057/attachment.html>


More information about the ghc-devs mailing list