Re: Separate debug info for release builds

Nikolay Nikolov via fpc-pascal <[email protected]>
Newsgroups gmane.comp.compilers.free-pascal.general
Message-ID <[email protected]>
On 11/1/24 7:14 PM, Henry Vermaak via fpc-pascal wrote:
> On Fri, 1 Nov 2024 at 16:12, Henry Vermaak <[email protected]> wrote:
>> On Fri, 1 Nov 2024 at 15:49, Martin Frb via fpc-pascal
>> <[email protected]> wrote:
>>> Another factor could be that debug info affects smartlinking. Or leaves symbols for the linker in sections that are shared with non-debug info.
>> This seems to be the problem. I think adding -g turns off
>> smartlinking, which then blows up the binary size, I've just tested
>> with and without (-CX -XX).
> Looks like I can "fix" this by passing --gc-sections to ld.
>
> Are there any fpc devs that can comment on why smart linking gets
> switched off when -g is passed?

Because Free Pascal doesn't support smartlinking+debug info on most 
platforms. The only exception is macOS, where it is actually supported. 
Adding --gc-sections to the linker on other platforms will probably 
result in broken debug info and is not guaranteed to work. Of course, 
you are encouraged to try it and test it, and see if it works, but it 
probably doesn't.

Best regards,

Nikolay

_______________________________________________
fpc-pascal maillist  -  [email protected]
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.