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

Joost van der Sluis joost at cnoc.nl
Tue Jul 5 22:37:36 CEST 2022

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.

Thanks for the help.


More information about the fpc-devel mailing list