Annoying objcopy message

H. J. Lu hjl@lucon.org
Mon Aug 12 08:13:00 GMT 2002


On Mon, Aug 12, 2002 at 03:41:25PM +0100, Nick Clifton wrote:
> 
>   objcopy -Iihex xxx -Obinary xxx.gz
>   objcopy: Warning: Output file cannot represent architecture UNKNOWN!
> 
> This should really be:
> 
>   objcopy -Iihex xxx -Obinary xxx.gz
> 
> (ie no warning at all).  Since both the input format and the output
> format do not have architectures associated with them, there is
> nothing to warn about.
> 

How about this patch?


H.J.
-------------- next part --------------
2002-08-12  H.J. Lu <hjl@gnu.org>

	* objcopy.c (copy_object): Don't warn about the unsupported
	architecture unless the input target is defaulted or the
	output architecture is different from the input.

--- binutils/objcopy.c.binary	Wed Jun  5 09:10:42 2002
+++ binutils/objcopy.c	Mon Aug 12 08:07:23 2002
@@ -973,7 +973,9 @@ copy_object (ibfd, obfd)
 
   /* Copy architecture of input file to output file.  */
   if (!bfd_set_arch_mach (obfd, bfd_get_arch (ibfd),
-			  bfd_get_mach (ibfd)))
+			  bfd_get_mach (ibfd))
+      && (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)));


More information about the Binutils mailing list