Compilation strategy

Dmitry Olshansky dmitry.olsh at gmail.com
Tue Dec 18 08:48:19 PST 2012


12/18/2012 6:51 PM, Walter Bright пишет:
> On 12/18/2012 1:33 AM, Dmitry Olshansky wrote:
>> More then that - the end result is the same: to avoid carrying junk
>> into an app
>> you (or compiler) still have to put each function in its own section.
>
> That's what COMDATs are.
>
Okay..

>> Doing separate compilation I always (unless doing LTO or template
>> heavy code)
>> see either whole or nothing (D included). Most likely the compiler
>> will do it
>> for you only with a special switch.
>
> dmd emits COMDATs for all global functions.
>
> You can see this by running dumpobj on the output.

Thanks for carrying on this Q.

I'm using objconv by Agner Fog as I haven't got dumpobj (guess I'll buy 
it if need be). However I see comments in dumped asm  that mark section 
boundaries that all functions are indeed in COMDAT sections.

Still linking these object files and disassembling output I see all of 
functions are there intact. I've added debug symbols to the build though 
- could it make optlink keep symbols?

After dropping debug info I can't yet make heads or tails of what's in 
the exe yet but it _seems_ to not include all of the unused code. Gotta 
investigate on a smaller sample.

-- 
Dmitry Olshansky


More information about the Digitalmars-d mailing list