[fpc-devel] Smart-linking on linux/x86-64
Sven Barth
pascaldragon at googlemail.com
Tue Jul 5 08:39:29 CEST 2022
Joost van der Sluis via fpc-devel <fpc-devel at lists.freepascal.org> schrieb
am Di., 5. Juli 2022, 00:17:
>
> But my real issue is this: on Windows, using the internal linker, this
> procedure is also omitted *with* Dwarf debug-data. As you implied.
>
> The problem is, though, that the CFI-information (the FDE) is not
> omitted. This is 'solved' in the internal linker by replacing the
> address with 0. Gdb doesn't mind and I've adapted FpDebug so that it
> allows this too, but this is still invalid, imho.
>
> But as the FDE is written now, as 'one block', without any sections, I
> don't see how the linker could omit the corresponding FDE.
>
> 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?
Regards,
Sven
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20220705/4bc0cbaa/attachment.htm>
More information about the fpc-devel
mailing list