public inbox for gentoo-alt@lists.gentoo.org
 help / color / mirror / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download: 
* [gentoo-alt] [PREFIX] Solaris && GNU ld 2.22
@ 2012-02-17 22:06 99% Fabian Groffen
  0 siblings, 0 replies; 1+ results
From: Fabian Groffen @ 2012-02-17 22:06 UTC (permalink / raw
  To: gentoo-alt

[-- Attachment #1: Type: text/plain, Size: 2243 bytes --]

All,

I just ran into this problem myself on all of my Solaris Prefixes.

Problem: after upgrading GNU binutils to 2.22, compiling starts to fail

On x86-based Solaris, any compilation fails with an ld error like this:
  ld: target elf32-i386 not found
sparc-based systems fail when linking against libraries that GNU linker
scripts exist for (e.g. libpcre, or libz) with a similar error.

Cause: starting from GNU ld 2.21 a targets for Solaris were introduced,
*_sol2, that strictly match the Solaris 2 ABI.  In GNU ld 2.22 these
targets are the only ones that work.  GCC 4.5 knows about this, and
targets the *_sol2 targets at configure time.

If you upgrade GNU binutils to 2.22, your system hence breaks when your
GCC wasn't compiled when GNU binutils 2.21 was around on your system.

On sparc-based systems, the problem can be remedied quite easily,
fortunately, by just fixing the GNU ld-scripts to reference the right
target, like so for a 32-bits environment:
  sed -i -e 's/^OUTPUT_FORMAT ( elf32-sparc )$/OUTPUT_FORMAT ( elf32-sparc-sol2 )/' $EPREFIX/usr/lib/lib*.so
or likewise for a 64-bits environment:
  sed -i -e 's/^OUTPUT_FORMAT ( elf64-sparc )$/OUTPUT_FORMAT ( elf64-sparc-sol2 )/' $EPREFIX/usr/lib/lib*.so

Because of a different setup in the GCC spec-file for x86-based systems,
the fix there is much more complicated.  If possible, recompile gcc
before upgrading binutils.  GCC now has a patch that makes it behave
on x86 like sparc, such that the damage is reduced.

Like on sparc, we need to fix the GNU ld-scripts, for 32-bits
environment:
  sed -i -e 's/^OUTPUT_FORMAT ( elf32-i386 )$/OUTPUT_FORMAT ( elf32-i386-sol2 )/' $EPREFIX/usr/lib/lib*.so
or for a 64-bits environment:
  sed -i -e 's/^OUTPUT_FORMAT ( elf64-x86-64 )$/OUTPUT_FORMAT ( elf64-x86-64-sol2 )/' $EPREFIX/usr/lib/lib*.so

With the broken interaction of the compiler with the linker, we have to
hack around it by using a GCC spec-file that won't omit a (wrong) target
when calling the linker.

  gcc -dumpspecs | sed 's/!m64:/m32/' > /var/tmp/specs
  env CC="gcc -specs=/var/tmp/specs" emerge -1 gcc

After this you should have a working compiler again.


-- 
Fabian Groffen
Gentoo on a different level

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

^ permalink raw reply	[relevance 99%]

Results 1-1 of 1 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2012-02-17 22:06 99% [gentoo-alt] [PREFIX] Solaris && GNU ld 2.22 Fabian Groffen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox