[fpc-devel] Smart-linking on linux/x86-64

Sven Barth pascaldragon at googlemail.com
Tue Jul 5 23:45:32 CEST 2022


Joost van der Sluis via fpc-devel <fpc-devel at lists.freepascal.org> schrieb
am Di., 5. Juli 2022, 22:37:

>
>
>
> Op 05-07-2022 om 08:39 schreef Sven Barth via fpc-devel:
> > Joost van der Sluis via fpc-devel <fpc-devel at lists.freepascal.org
> > <mailto:fpc-devel at lists.freepascal.org>> schrieb am Di., 5. Juli 2022,
> > 00:17:
> >     Any suggestions? Is it possible to place every fde in it's own
> section
> >     to solve this?
> >
> >
> > The problem is that *something* would need to reference the debug
> > sections otherwise they are stripped as well. But as soon as they're
> > referenced whatever code or data *they* reference is kept as well.
> > One of the better solutions might be to write these references as weak
> > symbols (on systems that support this) so at least the data/function
> > isn't kept around.
> > Or the section of the data/function would have to contain a reference to
> > its corresponding debug entry so that it is kept around as long as the
> > function/data is kept around...
> > How does GCC do this?
>
> Apperently GCC does the exact same thing as fpc does on Windows. Replace
> the addresses with 0, and mixup the function-names.
>
> (The link between the CFI and actual code consists of local labels. They
> do not reference the global labels/sections. I guess that is why the
> code is removed, as it's global label is not referenced)
>
> I can adapt fpc so that it does the same on Linux also. So I think I'll
> leave it this way.
>

I think many people would be glad if you'd solve the issue of smart linking
with debug information when an external linker is used. :)

Regards,
Sven

>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20220705/8f640f24/attachment.htm>


More information about the fpc-devel mailing list