Regarding stripping and -g

David Nadlinger code at klickverbot.at
Tue Jun 18 14:51:50 PDT 2013


On 18 Jun 2013, at 1:09, bearophile wrote:
> What's the difference between the stripped (3) and the stripped 
> program compiled with -g (4)?

If you build with -g, the debug version of druntime/Phobos is linked 
instead.

> Is it a good idea to make ldmd2 also strip the exe binary if the -g 
> switch is not used?

Probably not, as that typically also makes backtraces rather unusable. 
We should look into other ways to reduce the executable size at some 
point though – currently, we don't allow the linker to easily strip 
out as much unused data as there would be possible (along the lines of 
-ffunction-sections resp. --gc-sections).

One thing I also want to look into is to automatically internalize 
everything on building executables that is not needed to be visible 
(like _Dmain, which is called from druntime). It would e.g. allow the 
LLVM optimizer to discard functions that have been inlined into all 
their callers, etc.

David


More information about the digitalmars-d-ldc mailing list