]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - gcc/config/arm/driver-arm.c
Update copyright years.
[thirdparty/gcc.git] / gcc / config / arm / driver-arm.c
index 03e8c90da61d5d8d5391aec7fada7f9097bb05fa..254e5ba53a6130183cf7561913943765a3a56898 100644 (file)
@@ -1,5 +1,5 @@
 /* Subroutines for the gcc driver.
-   Copyright (C) 2011, 2012 Free Software Foundation, Inc.
+   Copyright (C) 2011-2020 Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -17,47 +17,29 @@ You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define IN_TARGET_CODE 1
+
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
 #include "tm.h"
 #include "configargs.h"
 
-struct vendor_cpu {
+struct vendor_cpu
+{
   const char *part_no;
   const char *arch_name;
   const char *cpu_name;
 };
 
-static struct vendor_cpu arm_cpu_table[] = {
-    {"0x926", "armv5te", "arm926ej-s"},
-    {"0xa26", "armv5te", "arm1026ej-s"},
-    {"0xb02", "armv6k", "mpcore"},
-    {"0xb36", "armv6j", "arm1136j-s"},
-    {"0xb56", "armv6t2", "arm1156t2-s"},
-    {"0xb76", "armv6zk", "arm1176jz-s"},
-    {"0xc05", "armv7-a", "cortex-a5"},
-    {"0xc07", "armv7-a", "cortex-a7"},
-    {"0xc08", "armv7-a", "cortex-a8"},
-    {"0xc09", "armv7-a", "cortex-a9"},
-    {"0xc0f", "armv7-a", "cortex-a15"},
-    {"0xc14", "armv7-r", "cortex-r4"},
-    {"0xc15", "armv7-r", "cortex-r5"},
-    {"0xc20", "armv6-m", "cortex-m0"},
-    {"0xc21", "armv6-m", "cortex-m1"},
-    {"0xc23", "armv7-m", "cortex-m3"},
-    {"0xc24", "armv7e-m", "cortex-m4"},
-    {NULL, NULL, NULL}
-};
-
-static struct {
+struct vendor
+{
   const char *vendor_no;
   const struct vendor_cpu *vendor_parts;
-} vendors[] = {
-    {"0x41", arm_cpu_table},
-    {NULL, NULL}
 };
 
+#include "arm-native.h"
+
 /* This will be called by the spec parser in gcc.c when it sees
    a %:local_cpu_detect(args) construct.  Currently it will be called
    with either "arch", "cpu" or "tune" as argument depending on if
@@ -93,14 +75,14 @@ host_detect_local_cpu (int argc, const char **argv)
 
   while (fgets (buf, sizeof (buf), f) != NULL)
     {
-      /* Ensure that CPU implementer is ARM (0x41).  */
+      /* Find the vendor table associated with this implementer.  */
       if (strncmp (buf, "CPU implementer", sizeof ("CPU implementer") - 1) == 0)
        {
          int i;
-         for (i = 0; vendors[i].vendor_no != NULL; i++)
-           if (strstr (buf, vendors[i].vendor_no) != NULL)
+         for (i = 0; vendors_table[i].vendor_no != NULL; i++)
+           if (strstr (buf, vendors_table[i].vendor_no) != NULL)
              {
-               cpu_table = vendors[i].vendor_parts;
+               cpu_table = vendors_table[i].vendor_parts;
                break;
              }
        }
@@ -123,12 +105,11 @@ host_detect_local_cpu (int argc, const char **argv)
        }
     }
 
-  fclose (f);
-
-  if (val == NULL)
-    goto not_found;
-
-  return concat ("-m", argv[0], "=", val, NULL);
+  if (val)
+    {
+      fclose (f);
+      return concat ("-m", argv[0], "=", val, NULL);
+     }
 
 not_found:
   {