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

Joost van der Sluis joost at cnoc.nl
Mon Jul 4 19:52:23 CEST 2022


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?


Regards,

Joost.



program testcfi;

{$mode objfpc}

   procedure JoJo;
   begin
     writeln('Tadaa');
   end;

   procedure NeverCalled;
   begin
     writeln('NeverCalled');
   end;

   procedure NoStackFrame;
   begin
     JoJo;
   end;

begin
   NoStackFrame;
end.


More information about the fpc-devel mailing list