This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Bug in objcopy


Hi,

Please find attached patch which fixes a bug in objcopy. 
Bug Description :
If one wants to convert an binary file in some other format to elf32-h8300 format for target say h8300s, then with following command,
h8300-elf-objcopy -I binary -O elf32-h8300 -B h8300s a.xyz a.o
output file a.o, always gets generated for plain h8300 target.
Objcopy utility was not able to recognize targets other than plain h8300.

Observation was along with architecture, machine flags were not getting passed.

Regards,
Anil

bfd/Changelog - 
2003-10-14  Anil Paranjpe  <anilp1@KPITCummins.com>
      * bfd/binary.c binary_object_p : Pass machine flag along with 							    architecture

binutils/Changelog - 
2003-10-14  Anil Paranjpe  <anilp1@KPITCummins.com>
      * binutils/objcopy.c copy_main : Reads machine flags from arch_info 						   structure

======================================================================
*** bfd/binary.c.old	Sat Nov 30 14:09:35 2002
--- bfd/binary.c	Tue Oct 14 12:25:07 2003
***************
*** 57,60 ****
--- 57,61 ----
     to use when creating binary BFDs.  */
  enum bfd_architecture bfd_external_binary_architecture = bfd_arch_unknown;
+ unsigned long bfd_external_machine = 0;
  
  /* Create a binary object.  Invoked via bfd_set_format.  */
***************
*** 108,112 ****
        if ((bfd_get_arch_info (abfd)->arch == bfd_arch_unknown)
            && (bfd_external_binary_architecture != bfd_arch_unknown))
!         bfd_set_arch_info (abfd, bfd_lookup_arch (bfd_external_binary_architecture, 0));
      }
  
--- 109,113 ----
        if ((bfd_get_arch_info (abfd)->arch == bfd_arch_unknown)
            && (bfd_external_binary_architecture != bfd_arch_unknown))
!         bfd_set_arch_info (abfd, bfd_lookup_arch (bfd_external_binary_architecture, bfd_external_machine));
      }

*** binutils/objcopy.c.old	Tue Jun  3 02:05:15 2003
--- binutils/objcopy.c	Tue Oct 14 12:22:25 2003
***************
*** 391,394 ****
--- 391,395 ----
  /* Defined in bfd/binary.c.  Used to set architecture of input binary files.  */
  extern enum bfd_architecture bfd_external_binary_architecture;
+ extern unsigned long bfd_external_machine;
  
  
***************
*** 2719,2724 ****
  
  	  if (temp_arch_info != NULL)
  	    bfd_external_binary_architecture = temp_arch_info->arch;
! 	  else
  	    fatal (_("architecture %s unknown"), binary_architecture);
  	}
--- 2720,2728 ----
  
  	  if (temp_arch_info != NULL)
+ 	  {
  	    bfd_external_binary_architecture = temp_arch_info->arch;
!             bfd_external_machine             = temp_arch_info->mach;
! 	  }
!           else
  	    fatal (_("architecture %s unknown"), binary_architecture);
  	} 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]