This is the mail archive of the binutils@sourceware.cygnus.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]

BFD: cpu-i960.c: recognise 80960.. as i960 machine names


Hi Guys,

  I am about to check in the following patch, developed in
  collaboration with Su Wenming, to allow the scan_960_mach() function
  to accept these addtional names: 80960KA, 80960KB, 80960CA, 80960MC.

Cheers

2000-05-30  Nick Clifton  <nickc@cygnus.com>

	* cpu-i960.c (scan_960_mach): Accept 80960KA, 80960KB,
	80960CA, 80960MC as valid machine names.

Index: cpu-i960.c
===================================================================
RCS file: /cvs/src//src/bfd/cpu-i960.c,v
retrieving revision 1.1.1.1
diff -p -r1.1.1.1 cpu-i960.c
*** cpu-i960.c	1999/05/03 07:28:55	1.1.1.1
--- cpu-i960.c	2000/05/30 21:26:57
*************** scan_960_mach (ap, string)
*** 34,61 ****
       const char *string;
  {
    unsigned long machine;
  
!   /* Look for the string i960, or somesuch at the front of the string  */
  
!   if (strncmp("i960",string,4) == 0) {
!     string+=4;
!   }
!   else {
!     /* no match, can be us */
!     return false;
!   }
!   if (string[0] == 0) {
!     /* i960 on it's own means core to us*/
!     if (ap->mach == bfd_mach_i960_core) return true;
!     return false;
!   }
  
!   if (string[0] != ':') {
      return false;
!   }
!   string++;
!   if (string[0] == '\0')
      return false;
    if (string[0] == 'c' && string[1] == 'o' && string[2] == 'r' &&
        string[3] == 'e' && string[4] == '\0')
      machine = bfd_mach_i960_core;
--- 34,77 ----
       const char *string;
  {
    unsigned long machine;
+   int i;
+   int fail_because_not_80960 = false;
+   
+   for (i = 0; i < strlen (string); i ++)
+     string[i] = tolower (string[i]);
  
!   /* Look for the string i960 at the front of the string.  */
!   if (strncmp ("i960", string, 4) == 0)
!     {
!       string += 4;
  
!       /* i960 on it's own means core to us.  */
!       if (* string == 0)
! 	return ap->mach == bfd_mach_i960_core;
!       
!       /* "i960:*" is valid, anything else is not.  */
!       if (* string != ':')
! 	return false;
  
!       string ++;
!     }
!   /* In some bfds the cpu-id is written as "80960KA", "80960KB",
!      "80960CA" or "80960MC".  */
!   else if (strncmp ("80960", string, 5) == 0)
!     {
!       string += 5;
! 
!       /* Sett his to true here.  If a correct matching postfix
! 	 is detected below it will be reset to false.  */
!       fail_because_not_80960 = true;
!     }
!   /* No match, can't be us.  */
!   else
      return false;
!   
!   if (* string == '\0')
      return false;
+   
    if (string[0] == 'c' && string[1] == 'o' && string[2] == 'r' &&
        string[3] == 'e' && string[4] == '\0')
      machine = bfd_mach_i960_core;
*************** scan_960_mach (ap, string)
*** 63,82 ****
      machine = bfd_mach_i960_ka_sa;
    else if (strcmp (string, "kb_sb") == 0)
      machine = bfd_mach_i960_kb_sb;
!   else if (string[1] == '\0' || string[2] != '\0') /* rest are 2-char */
      return false;
    else if (string[0] == 'k' && string[1] == 'b')
!     machine = bfd_mach_i960_kb_sb;
    else if (string[0] == 's' && string[1] == 'b')
      machine = bfd_mach_i960_kb_sb;
    else if (string[0] == 'm' && string[1] == 'c')
!     machine = bfd_mach_i960_mc;
    else if (string[0] == 'x' && string[1] == 'a')
      machine = bfd_mach_i960_xa;
    else if (string[0] == 'c' && string[1] == 'a')
!     machine = bfd_mach_i960_ca;
    else if (string[0] == 'k' && string[1] == 'a')
!     machine = bfd_mach_i960_ka_sa;
    else if (string[0] == 's' && string[1] == 'a')
      machine = bfd_mach_i960_ka_sa;
    else if (string[0] == 'j' && string[1] == 'x')
--- 79,98 ----
      machine = bfd_mach_i960_ka_sa;
    else if (strcmp (string, "kb_sb") == 0)
      machine = bfd_mach_i960_kb_sb;
!   else if (string[1] == '\0' || string[2] != '\0') /* rest are 2-char.  */
      return false;
    else if (string[0] == 'k' && string[1] == 'b')
!     { machine = bfd_mach_i960_kb_sb; fail_because_not_80960 = false; }
    else if (string[0] == 's' && string[1] == 'b')
      machine = bfd_mach_i960_kb_sb;
    else if (string[0] == 'm' && string[1] == 'c')
!     { machine = bfd_mach_i960_mc; fail_because_not_80960 = false; }
    else if (string[0] == 'x' && string[1] == 'a')
      machine = bfd_mach_i960_xa;
    else if (string[0] == 'c' && string[1] == 'a')
!     { machine = bfd_mach_i960_ca; fail_because_not_80960 = false; }
    else if (string[0] == 'k' && string[1] == 'a')
!     { machine = bfd_mach_i960_ka_sa; fail_because_not_80960 = false; }
    else if (string[0] == 's' && string[1] == 'a')
      machine = bfd_mach_i960_ka_sa;
    else if (string[0] == 'j' && string[1] == 'x')
*************** scan_960_mach (ap, string)
*** 84,91 ****
    else if (string[0] == 'h' && string[1] == 'x')
      machine = bfd_mach_i960_hx;
    else
      return false;
!   if (machine == ap->mach)   return true;
    return false;
  }
  
--- 100,113 ----
    else if (string[0] == 'h' && string[1] == 'x')
      machine = bfd_mach_i960_hx;
    else
+     return false;
+ 
+   if (fail_because_not_80960)
      return false;
!   
!   if (machine == ap->mach)
!     return true;
!   
    return false;
  }
  

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