I am compiling a C library with xcode 4.5.1 on os x 10.7.5.
The size of the library compiled with xcode LLVM is significantly bigger than when I just compile it using plain gcc with makefile passing the same optimisation arguments -Os (terminal without xcode). GCC produces a 130K binary where apple LLVM produces a 300K binary. Same source code same compiler options.
Wether I look at the iphone simulator version of the binary, the arm7 version or arm 7s version i still get arounf 300K binaries when compiling with xcode. I have used nm on the .a and .o objects and there are no unwanted extra symbols in there.
I remember that my library compiled to 170K with earlier versions of xcode running gcc.
I haven't read anywhere that apple LLVM/clang compiler produces bigger executable so my guess is that i might not be using the optimization settings in xcode properly. For instance I get same 300K larger binary size wether I use setting -Os in Xcode or -O0. Even more confusing, my debug binaries are smaller than my release version. Debug have -O0 settings.
Clearly I am missing something.
Any suggestions for reducing my binary size welcome.