Re: [PATCH 1/3] Implement new Linux target vectors on BFD

Alan Modra
2013-01-30T09:16:47Z

On Wed, Jan 30, 2013 at 04:52:46AM -0200, Sergio Durigan Junior wrote:
> 1) Add new target vectors on the BFD configury system in order to handle
> Linux targets, which will then make it possible to use certain functions
> only on such targets, and

Duplicating targets isn't a really good idea.

If on my x86_64 linux box I want to build a native binutils that also
supports powerpc64, I can configure binutils with
--enable-targets=powerpc64-linux, or get all targets with
--enable-targets=all. The problem with adding bfd targets as you've
done is that now you have two bfd targets that give equally good
matches for powerpc64 objects. So instead of one "best" match we now
have two. elf64-big will also match, and by a quirk of the way
bfd_check_format_matches operates (giving priority to targets
appearing in config.bfd targ_selvec), this match will be chosen over
the better elf64-powerpc-* matches. That means a worse user
experience for say, "objdump -d". A file that used to happily
disassemble now gives you

some_file: file format elf64-big

binutils/objdump: can't disassemble for architecture UNKNOWN!

You may have noticed that we've already made a mess of targets for
ARM, i386, x86_64 and powerpc. I'd rather not see the same happen for
powerpc64 without a really good reason.

--
Alan Modra
Australia Development Lab, IBM