This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Attempt #2
My last e-mail was flagged as spam. So I'll try this again worded
differently.
That was the message I was receiving, and the patch fixed it. So
erverything works now
thanks Nick
I hope this one gets through. There are no exclamation marks in this
e-mail
Dave
On Thu, 2003-12-04 at 09:27, Nick Clifton wrote:
> Hi David,
>
> > http://sources.redhat.com/ml/bug-binutils/2003-q3/msg01482.html
> >
> > Basicly, if strip is run on a binary where target arch != binary arch,
> > then the binary is destroyed.
>
> When you do this, do you get a message like this ?
>
> Warning: Output file cannot represent architecture UNKNOWN!
>
>
> > I think strip should check elf header to make sure that the arch is
> > correct before writing anything.
>
> Would you like to try the patch below and let me know if it works for
> you ?
>
> Cheers
> Nick
>
> 2003-12-04 Nick Clifton <nickc@redhat.com>
>
> * objcopy.c (copy_object): Do not copy the object if the
> output file's format cannot be set to that of the input file.
> If the input file's format is unknown, fail.
>
> Index: binutils/objcopy.c
> ===================================================================
> RCS file: /cvs/src/src/binutils/objcopy.c,v
> retrieving revision 1.57
> diff -c -3 -p -r1.57 objcopy.c
> *** binutils/objcopy.c 11 Nov 2003 17:50:26 -0000 1.57
> --- binutils/objcopy.c 4 Dec 2003 17:28:36 -0000
> *************** copy_object (bfd *ibfd, bfd *obfd)
> *** 1138,1146 ****
> if (!bfd_set_arch_mach (obfd, iarch, imach)
> && (ibfd->target_defaulted
> || bfd_get_arch (ibfd) != bfd_get_arch (obfd)))
> ! non_fatal (_("Warning: Output file cannot represent architecture %s"),
> ! bfd_printable_arch_mach (bfd_get_arch (ibfd),
> ! bfd_get_mach (ibfd)));
>
> if (!bfd_set_format (obfd, bfd_get_format (ibfd)))
> RETURN_NONFATAL (bfd_get_filename (ibfd));
> --- 1138,1156 ----
> if (!bfd_set_arch_mach (obfd, iarch, imach)
> && (ibfd->target_defaulted
> || bfd_get_arch (ibfd) != bfd_get_arch (obfd)))
> ! {
> ! if (bfd_get_arch (ibfd) == bfd_arch_unknown)
> ! fatal (_("Unable to recognise the format of the input file %s"),
> ! bfd_get_filename (ibfd));
> ! else
> ! {
> ! non_fatal (_("Warning: Output file cannot represent architecture %s"),
> ! bfd_printable_arch_mach (bfd_get_arch (ibfd),
> ! bfd_get_mach (ibfd)));
> ! status = 1;
> ! return;
> ! }
> ! }
>
> if (!bfd_set_format (obfd, bfd_get_format (ibfd)))
> RETURN_NONFATAL (bfd_get_filename (ibfd));
>
--
~~~~~~~~~~~~~~~~~~~~~~~~
David Meggy
Engineering
Technical Solutions Inc.
Unit #1 7157 Honeyman St
Delta BC Canada, V4G 1E2
www.techsol.ca
eMail: dmeggy@techsol.ca
Tel: 604 946 TECH (8324)
Fax: 604 946 6445
~~~~~~~~~~~~~~~~~~~~~~~~