[fpc-devel] Solaris and binutils 2.22 break fpc linking and workaround

Helmut Hartl helmut.hartl at firmos.at
Tue Nov 20 14:52:15 CET 2012


Hi,

While building under SmartOS in a buildzone
(IllumOS, former OpenSolaris) i have the problem that with
binutils 2.22 the fpc generated linker script line in ppas.sh

/opt/local/bin/gld -melf_x86_64    -s -L. -o my_program link.res

is not working anymore. Because the only targets the new binutils 2.22 
support on solaris are elf_x86_64_sol2 and elf_i386_sol2.

Manually linking with: (after compiling with -Cn)

$/opt/local/bin/gld -melf_x86_64_sol2 -s -L. -o fpmake_packages link.res

is working!

Others have similar problems on gentoo:
http://archives.gentoo.org/gentoo-alt/msg_a4641a1c17ce5f66a05c6440dd5cfc87.xml


The problem is that on SmartOS the build machines and packages default 
to gcc47 with binutils 2.22.

I "fixed" it for me by compiling the compiler only on Openindiana 151a7
(older binutils) with the following  applied trivial patch, and copying 
the resulting compiler(s) (32/64) bit to the
target system. A full build for a 32 bit and a 64 bit fpc went well.

--- ./systems/t_sunos.pas.bak   2012-08-27 12:24:46.000000000 +0200
+++ ./systems/t_sunos.pas       2012-11-04 05:59:23.399713956 +0100
@@ -143,12 +143,12 @@
  }
  {$ifdef x86_64}
  const
-  gld = 'gld -m elf_x86_64 ';
+  gld = 'gld -m elf_x86_64_sol2 ';
    solaris_ld = '/usr/bin/ld -64 ';
  {$endif}
  {$ifdef i386}
  const
-  gld = 'gld ';
+  gld = 'gld -m elf_i386_sol2 ';
    solaris_ld = '/usr/bin/ld ';
  {$endif }
  {$ifdef sparc}


What are the options to fix this properly ?
I did not manage to get it working with the existing comand line 
options.I think it is needed to influence the -m option which fpc 
generates in "t_sunos", depending on an switch stating the usage of 
binutils greater than
a certain version.

helmut



More information about the fpc-devel mailing list