[phobos] large object files and binaries

Steve Schveighoffer schveiguy at yahoo.com
Tue May 3 16:14:05 PDT 2011



I'm going to close 5560 because you are right, the -lib switch did not affect the final executable.  But I still don't understand the discrepancy, what bookkeeping is output for code that isn't generated?  I'm not trying for a witch hunt here, I just can't see how the compiler can change the size of an object file when essentially versioned out code is compiled.


However, there is definitely something wrong with -lib if 2254 is still valid.  I'll work on compiling phobos and druntime without -lib and see if I can repeat the difference in the final executable.


Also, can you explain how to use obj2asm to figure out if code is properly being generated without knowing assembly?  I should say, without knowing how to demangle names in your head as well.  I am not seeing how you do it without knowing these, every trip of mine through obj2asm land is painstakingly slow, and usually ends up with me giving up understanding what's going on.

-Steve




>________________________________
>From: Walter Bright <walter at digitalmars.com>
>To: Steve Schveighoffer <schveiguy at yahoo.com>; Discuss the phobos library for D <phobos at puremagic.com>
>Sent: Tuesday, May 3, 2011 6:22 PM
>Subject: Re: [phobos] large object files and binaries
>
>
>
>
>On 5/3/2011 10:30 AM, Steve Schveighoffer wrote: 
>This is not a fair response to this problem.  When the code size triples (http://d.puremagic.com/issues/show_bug.cgi?id=2254) because you add the -lib switch, and adding unit tests adds to the size of the executable, even when unit tests are turned off (http://d.puremagic.com/issues/show_bug.cgi?id=5560) again, when adding the -lib switch, it's obvious to everyone (but you it seems) that the -lib switch is adding bloat.  Bug 5660 proves that beyond all reasonable doubt.
>Again, this is simply not relevant information. Each obj file has
    bookkeeping overhead required by the ELF file format. By looking at
    the object file size, you have ZERO information about the size of
    code/data making it into the executable.
>
>
>
>>
>>Whether it accounts for all the added bloat, I'm not sure.  obj2asm is a great tool, but I am not an assembly developer, I can't always decipher what's going on.
>You do not need to know a single iota of assembler to understand
    where size is coming from in the output of obj2asm.
>
>
>  the -map switch only tells you what the compiler is outputting,
>No, it doesn't. It tells you what symbols (i.e. functions) made it
    into the executable, and the size contributed by each function.
>
>
>it doesn't tell you if the output contains unnecessary bloat.
>It does if the functions in the executable don't need to be there.
>
>
>
>>
>>Please, at least agree to look at bug 5560, it's irrefutable proof that the -lib switch adds bloat, it cannot get any simpler than that.
>I'm afraid 5560 doesn't prove that. Without looking at the obj2asm
    contents of those .o files, you simply cannot conclude there is any
    bloat in there or if it is nothing more than the ELF bookkeeping.
>
>
>
>>
>>-Steve
>>
>>
>>
>>
>>>________________________________
>>>From: Walter Bright <walter at digitalmars.com>
>>>To: Steve Schveighoffer <schveiguy at yahoo.com>; Discuss the phobos library for D <phobos at puremagic.com>
>>>Sent: Tuesday, May 3, 2011 12:57 PM
>>>Subject: large object files and binaries
>>>
>>>
>>>
>>>
>>>On 5/3/2011 7:39 AM, Steve Schveighoffer wrote: 
>>>Dmd has steadily been making binaries more bloated for the last couple years (many times pointed out in the NG and there are several bugzilla reports).
>>>>
>>>There are two causes of this:
>>>
>>>1. Typeinfo getting larger, and people wanting more
                  features in Typeinfo (like precise gc) so this will
                  continue to increase.
>>>
>>>2. Every phobos module imports and relies on every
                  other one.
>>>
>>>
>>>To find out why .o files are large, run obj2asm on it.
                  To find out why executables are large, compile with
                  the -map switch and examine the linker .map file.
                  <rant>AFAIK, I'm the only person who ever does
                  this.</rant>
>>>
>>>Please, everyone. Once in a while, run obj2asm on the
                  library module you're developing and have a look-see
                  at what is coming out of the compiler.
>>>
>>>
>>>
>>>
>>
_______________________________________________
phobos mailing list phobos at puremagic.com http://lists.puremagic.com/mailman/listinfo/phobos
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/phobos/attachments/20110503/c704e36c/attachment-0001.html>


More information about the phobos mailing list