[fpc-pascal] Separate debug info for release builds

Martin Frb lazarus at mfriebe.de
Fri Nov 1 16:23:58 CET 2024


On 01/11/2024 16:16, Martin Frb via fpc-pascal wrote:
> On 01/11/2024 15:59, Henry Vermaak via fpc-pascal wrote:
>> When I add -Xg, the compiler writes the debug info into a separate
>> .dbg file and adds a .gnu_debuglink section so the debugger can find
>> the info.  So far so good (and simpler than having the use objcopy).
>>
>> The size of the binary is much larger than building without debug
>> info, though.  E.g. with -O2 it goes from 35K to 188K.
>>

Ok, I misread that.

Thinking you change it to O2 for one of the builds only...

------------
Another factor could be that debug info affects smartlinking. Or leaves 
symbols for the linker in sections that are shared with non-debug info.

But I don't know either of that.

Afaik external debug info is created at the end by using objcopy or 
similar to split the one big exe.

In theory therefore, debug info could have created symbols in sections 
used by the linker, and left behind.
Also debug info may in the worst case have referred code and prevented 
smart linking.

Again, neither of those are know by me.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20241101/65e1b46c/attachment.htm>


More information about the fpc-pascal mailing list