Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2017-12

linker failed with fpc rpm on CentOS 7

6 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Mattias Gaertner

Hi,

I installed fpc-3.0.4-1.x86_64.rpm from sourceforge on CentOS 7 and compiling even the simplest of programs gives:

/bin/ld: /usr/lib64/fpc/3.0.4/units/x86_64-linux/rtl/cprt0.o: unrecognized relocation (0x2a) in section `.text'
/bin/ld: final link failed: Bad value

Is this known?

Mattias

Pierre Muller
to Mattias Gaertner

Le 12/12/2017 à 20:49, Mattias Gaertner a écrit :

Show quoted text 10 lines
Hi, I installed fpc-3.0.4-1.x86_64.rpm from sourceforge on CentOS 7 and compiling even the simplest of programs gives: /bin/ld: /usr/lib64/fpc/3.0.4/units/x86_64-linux/rtl/cprt0.o: unrecognized relocation (0x2a) in section `.text' /bin/ld: final link failed: Bad value Is this known?

Yes and no ...

Relocation R_X86_64_REX_GOTP (0x2a) is a new relocation type that was recently introduced in GNU binutils 2.26 for x86_64 (aka amd64) CPUs.

This problem has been reported in
https://bugs.freepascal.org/view.php?id=32251

Normally the .tar file should have been generated on a system that uses an earlier GNU binutils version, avoiding the problem if a Free Pascal program is linked using a less recent GNU linker version.

Apparently, we did not check that this was also the case for the RPM file.

Could you please test the tar installer (or copy the rtl/*prt*.o from the tar installation
to /usr/lib64/fpc/3.0.4/units/x86_64-linux/rtl/ directory) and report if this fixes the issue?

Alternatively, upgrading to a GNU linker version 2.26 or above should also fix the linker error.

Pierre Muller

Mattias Gaertner
to Pierre Muller
Show quoted text 8 lines
[...] Normally the .tar file should have been generated on a system that uses an earlier GNU binutils version, avoiding the problem if a Free Pascal program is linked using a less recent GNU linker version. Apparently, we did not check that this was also the case for the RPM file. Could you please test the tar installer

The tar install works.

Mattias

Pierre Muller
to Mattias Gaertner

Le 13/12/2017 à 00:24, Mattias Gaertner a écrit :

Show quoted text 13 lines
On Tue, 12 Dec 2017 23:16:03 +0100 Pierre Muller wrote: > [...] > Normally the .tar file should have been generated on a system that uses > an earlier GNU binutils version, avoiding the problem if > a Free Pascal program is linked using a less recent GNU linker version. > > Apparently, we did not check that this was also the case for the RPM file. > > Could you please test the tar installer The tar install works.

On the failing RPM install,
could you test this file:
ftp://ftp.freepascal.org/pub/fpc/dist/3.0.4/x86_64-linux/x86_64-linux-prt0-pre2.26-binutils.tar.gz

Simply extract it at the base 3.0.4 installation directory, it contains the 4 files that are directly compiled using GNU assembler, but the version from the general tar installer, which was generated on a system with an old GNU binutils version.

Pierre

tar -tvzf x86_64-linux-prt0-pre2.26-binutils.tar.gz -rw-r--r-- muller/muller 2224 2017-10-03 13:56 lib/fpc/3.0.4/units/x86_64-linux/rtl/cprt0.o -rw-r--r-- muller/muller 1880 2017-10-03 13:56 lib/fpc/3.0.4/units/x86_64-linux/rtl/dllprt0.o -rw-r--r-- muller/muller 2504 2017-10-03 13:56 lib/fpc/3.0.4/units/x86_64-linux/rtl/gprt0.o -rw-r--r-- muller/muller 1896 2017-10-03 13:56 lib/fpc/3.0.4/units/x86_64-linux/rtl/prt0.o

Mattias Gaertner
to Pierre Muller
Show quoted text 10 lines
[...] On the failing RPM install, could you test this file: ftp://ftp.freepascal.org/pub/fpc/dist/3.0.4/x86_64-linux/x86_64-linux-prt0-pre2.26-binutils.tar.gz Simply extract it at the base 3.0.4 installation directory, it contains the 4 files that are directly compiled using GNU assembler, but the version from the general tar installer, which was generated on a system with an old GNU binutils version.

It links with warnings:
crtbeginS.o not found, this will probably cause a linking failure crtendS.o not found, this will probably cause a linking failure

And Lazarus runs.

Mattias

Bart
to Mattias Gaertner
Mattias Gaertner wrote
It links with warnings: crtbeginS.o not found, this will probably cause a linking failure crtendS.o not found, this will probably cause a linking failure

IIRC: if you have gcc installed, then these files are somewhere on your system (I forgot how to ask gcc to tell you), then you can adjust the library path in fpc,cfg accordingly.

Bart