It appears that LD in binutils versions after 2.35 is producing segfault
executables with Free Pascal 2.6.4.  You cannot build a working HelloWorld.

I have written up a full report, please see
  https://gitlab.com/freepascal.org/fpc/source/-/issues/39324

The Free Pascal developers believe this is a regression of a similar LD bug
that previously occurred and was fixed in LD.  They put a
workaround/redesign in later versions of FreePascal, the 3.x series, but
are unable to backport their fix to FPC 2.6.4.
So it needs to be fixed again in binutils LD.

It is very easy to reproduce.
The simplest HelloWorld will yield a segfault executable.  Demonstration:

PROGRAM, put this code in myprog.pas:
program myprog;
begin
writeln('hello');
end.

COMPILE via:
$ /usr/local/fpc-2.6.4/bin/fpc -Xm -va myprog.pas
    -Xm  produces linker map
    -va  gives verbose output

RUN:
$ ./myprog
Segmentation fault


On Gentoo Linux, it works with binutils-2.35, and segfaults with
binutils-2.36 and binutils-2.37, both tested.

If you need any other details or test files, please advise and I will try
to supply.

This is an extremely critical bug. It completely kills the 2.6.x series of
FreePascal, which I and likely many others require to keep running.

Gentoo has already switched to binutils-2.37, and started to mask out
binutils-2.35 by default.  A fix is needed soon, before the older versions
are dropped altogether.

Thanks for your work on binutils.

-- JBThiel

Reply via email to