This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH RFC resent] objcopy -B bfdarch limited to 'binary' input
On Tue, Sep 01, 2009 at 12:33:02PM +0200, Philippe De Muyter wrote:
> On Tue, Sep 01, 2009 at 07:38:10PM +0930, Alan Modra wrote:
> > On Mon, Aug 31, 2009 at 12:17:14PM +0200, Philippe De Muyter wrote:
> > > I see no reason why converting from srec (and other architecture-less formats)
> > > could not benefit also from the -B option.
> >
> > Well, yes, but your patch doesn't actually do anything apart from
> > allowing an option to be parsed without error.
>
> Yes it does : it allows the option to be *used* with srec input files.
>
> But there were many other options here :
> - eliminate the test completely (but why was it put there in the first place)
> - make an exhaustive list of all the formats that do not provide an
> architecture tag (but I do not know all the formats)
> - check if the input format provides an architecture tag (but I do not
> know bfd enough to do that)
OK. I would
a) get rid of bfd_external_binary_architecture, bfd_external_machine,
and the code using them in binary_object_p.
b) In objcopy.c:copy_main, if -B is given, always run bfd_scan_arch on
the -B arg and save the result to, say, binary_arch
c) pass binary_arch to copy_file, and from there down to copy_object,
also via copy_archive.
d) in copy_object, call bfd_get_arch_info (ibfd) and if bfd_arch_unknown
call bfd_set_arch_info, ie. as was done in binary.c
e) Maybe think about returning an error if the input file arch wasn't
bfd_arch_unknown but binary_arch was set. Don't do this for archives
though.
Then probably rethink when all the above doesn't work out. :-)
--
Alan Modra
Australia Development Lab, IBM