[cfe-dev] linking and stripping compared to GCC 4.4

Chris Lattner clattner at apple.com
Mon Nov 29 14:45:50 PST 2010


On Nov 29, 2010, at 2:33 PM, Luc Bourhis wrote:

>> Any reason why demo.cpp is 952 bytes for clang and 902 bytes for gcc?
> 
> Different hard drives. They are the same file, I swear.
> 
>> Also, it looks like you're comparing Mac OS X to Linux.
> 
> I ran gcc 4.4 on Linux and clang on MacOS X indeed.
> 
>> The binary format on each is very different.
> 
> Fair enough. I did not take the time to install gcc 4.4 on my MacOS X machine indeed. Nevertheless, this begs the question: is clang++ hampered by MacOS X binary format to such an extent that the -s stripping option has no effect whatsoever? Whereas g++ 4.4 on Linux is able with the same option to significantly reduce the binary size thanks to the superior ELF 64-bit format? Or could clang++ do better as a linker driver on MacOS X here?

It's not just file format.  The two have very different codegen for things like accessing globals (position independent code), ABI differences as well as other things.  You really have to compare on the same machine in the same config to do a useful comparison.

-Chris





More information about the cfe-dev mailing list