[PATCH] ld/ldlang.c: fatal error on architecture mismatch

Alan Modra amodra@bigpond.net.au
Mon Apr 30 08:46:00 GMT 2007


On Sat, Apr 28, 2007 at 08:57:23PM +0200, Robert Millan wrote:
> $ gcc -m32 -o /dev/null test.c /usr/lib/libsicuuc.a
> /usr/bin/ld: warning: i386:x86-64 architecture of input file `/usr/lib/libsicuuc.a(ubidi.ao)' is incompatible with i386 output
> [...]
> $ echo $?
> 0

Hmm, ld returned success because it managed to resolve any relocations
in libsicuuc.a with the generic linker.  If you were trying to link in
some "foreign" object file, you'd be happy about this result.  So I'm
not completely convinced it is a good idea to turn the warning into an
error, since GNU ld has only given a warning for this situation since
rev 1.1 in CVS.  Note that you can turn warnings into errors by
passing --fatal-warnings to ld, which is probably the right way to
cure autoconf.

I'm not strongly opposed to the patch either, since someone wanting to
link foreign object files can always turn off the error.

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre



More information about the Binutils mailing list