[phobos] large object files and binaries

Michel Fortin michel.fortin at michelf.com
Tue May 3 17:47:45 PDT 2011


Le 2011-05-03 à 18:13, Walter Bright a écrit :

> On 5/3/2011 1:32 PM, Michel Fortin wrote:
>> 
>> DMD emits code in a special "multiobj" mode when using the -lib switch. I had to disable this in my Objective-C-aware branch of the compiler because it didn't play well with Objective-C class definitions (maybe I could make it work, but I have more pressing things to do).
>> 
>> Now, I observe that Phobos compiled with my modified DMD makes 2501452 bytes, whereas the one that comes bundled with DMD makes 6646800 bytes... Granted, it's not exactly the same version of Phobos and druntime (I'm probably a little behind but with a few things added to my druntime branch), but the stunning difference leads me to believe "multiobj" might be the cause for this difference in size.
> 
> The size of libphobos.a has *nothing* to do with the size of an executable linked with Phobos.
> 
> Multiobj will increase the size of the library simply because there's a lot of bookkeeping overhead for each .o file - overhead that does not go into the executable

Yeah, indeed. Creating many small object files instead of one is obviously going to add overhead.

I thought Steve said that the executable size went up when using -lib, which could have indicated a bug with multiobj.

-- 
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/





More information about the phobos mailing list