[fpc-devel] Smart-linking on linux/x86-64
Joost van der Sluis
joost at cnoc.nl
Tue Jul 5 00:17:02 CEST 2022
Op 04-07-2022 om 23:37 schreef Sven Barth via fpc-devel:
> Am 04.07.2022 um 19:52 schrieb Joost van der Sluis via fpc-devel:
>> Hi all,
>>
>> I have a very small application, see below. One procedure is not
>> called at all.
>>
>> But when I compile with
>>
>> ppcx64 -XX -CX testcfi.pp
>>
>> The P$TESTCFI_$$_NEVERCALLES symbol is still in the executable.
>>
>> On Windows (internal linker) this code is omitted from the executable,
>> but not on Linux.
>>
>> Does anyone know why?
>
> I can't reproduce this with main. But considering that you named the
> test file “testcfi”: do you by chance play around with DWARF data? Cause
> DWARF doesn't support smartlinking on non-Windows, at least not in the
> way FPC generates it...
After your and Michael's response, I've tried it again and I can't
reproduce it anymore either...
I'm still wondering what I did wrong.
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?
Regards,
Joost.
More information about the fpc-devel
mailing list