Prevent an abort in the FRV disassembler if the target bfd name is unknown

Alan Modra <[email protected]> Fri, 7 Apr 2017 20:00:10 +0930
Newsgroups gmane.comp.tools.cgen.devel
Message-ID <[email protected]>
This moves one of Nick's patches to where it belongs.  OK to apply?

	PR 20946
	* desc-cpu.scm (lookup_mach_via_bfd_name): Return NULL if the name
	could not be matched.
	(@arch@_cgen_cpu_open): Allow for lookup_mach_via_bfd_name returning
	NULL.

Index: desc-cpu.scm
===================================================================
RCS file: /cvs/src/src/cgen/desc-cpu.scm,v
retrieving revision 1.34
diff -u -p -r1.34 desc-cpu.scm
--- desc-cpu.scm	25 Jul 2016 15:39:06 -0000	1.34
+++ desc-cpu.scm	7 Apr 2017 10:15:20 -0000
@@ -606,7 +606,7 @@ lookup_mach_via_bfd_name (const CGEN_MAC
 	return table;
       ++table;
     }
-  abort ();
+  return NULL;
 }
 
 /* Subroutine of @arch@_cgen_cpu_open to build the hardware table.  */
@@ -820,7 +820,8 @@ CGEN_CPU_DESC
 	    const CGEN_MACH *mach =
 	      lookup_mach_via_bfd_name (@arch@_cgen_mach_table, name);
 
-	    machs |= 1 << mach->num;
+	    if (mach != NULL)
+	      machs |= 1 << mach->num;
 	    break;
 	  }
 	case CGEN_CPU_OPEN_ENDIAN :

-- 
Alan Modra
Australia Development Lab, IBM