Op 05-07-2022 om 11:51 schreef Sergei Gorelkin via fpc-devel:
05/07/2022 09:39, Sven Barth via fpc-devel wrote:
Joost van der Sluis via fpc-devel <fpc-devel@lists.freepascal.org
<mailto:fpc-devel@lists.freepascal.org>> schrieb am Di., 5. Juli 2022,
00:17:
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?
As far as I had studied this issue, ld essentially "decompiles" the
monolithic FDE's from object files into internal representation, and
then "compiles" it back, omitting information for the code that won't go
into executable due to smartlinking. It also optimizes for size by using
8- and 16-bit offsets instead of 32-bit ones when possible.
Indeed, that is also what I have seen. ld Adapts the cfi-contents. (It
also removed some mistakes in fpc's implementation)
Regards,
Joost.
_______________________________________________
fpc-devel maillist - fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel