public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [patch,avr]: Fix various problems with specs and specs file generation.
@ 2015-03-02 19:40 Georg-Johann Lay
  2015-03-03  7:46 ` Denis Chertykov
  2015-03-03 13:20 ` Senthil Kumar Selvaraj
  0 siblings, 2 replies; 23+ messages in thread
From: Georg-Johann Lay @ 2015-03-02 19:40 UTC (permalink / raw)
  To: Denis Chertykov; +Cc: GCC Patches, Joerg Wunsch, Joern Rennecke

[-- Attachment #1: Type: text/plain, Size: 2064 bytes --]

The new specs file generation introduces several problems.  This patch

- Fix build warnings

- Clean up unused code and the old, now dead specs definitions.

- Removes unused files and adjust build scripts / rules.

- Issues with avr-libc awareness:

-- Makes specs-generation aware of avr-libc (include tm.h in build script and 
depend on WITH_AVRLIBC).

-- avr-libc implements functions in libm.a which usually live in libgcc, hence 
add -lm to libgcc_spec, cf. PR54461.

-- The new libdev.a is a feature of avr-libc and not available with, e.g., 
newlib.  Hence remove it from lib_spec if the compiler is not configured for 
avr-libc (--with-avrlibc=no).

- Many minor issues with option propagation.

- -march had been added to multilib generation some time ago, but 
driver_self_spec was not aware of that option.


Ok for trunk?


BTW, anyone knows what -march= is good for?  It allows all kinds of silly 
option combinations like "-march=avrtiny -mmcu=atmega8" without any complaints.

What's wrong with -mmcu=avr* ? All architecture names start with "avr", and 
/no/ device name starts /with/ "avr", hence -mmcu= should be fine and work as 
smooth as in the last 10 years.

Why that -march= option?  If there is not a good reason for -march=, I'd 
propose to clean it up and use -mmcu=avr* instead.


Johann


gcc/
	Fix various problems with specs file generation.

	* config.gcc (extra_gcc_objs) [avr]: Remove.

	* config/avr/driver-avr.c: Remove file.
	* config/avr/t-avr (driver-avr.o): Remove rule.
	(gen-avr-mmcu-specs): Use CXX_FOR_BUILD, CXXFLAGS_FOR_BUILD and
	INCLUDES to build.  Depend on TM_H.
	* config/avr/gen-avr-mmcu-specs.c: Tidy up code.  Fix various
	build warnings.  Fix non-matching types and non-existing %-codes.
	(tm.h): Include.
	(*lib) [!WITH_AVRLIBC]: Don't link libdev.a.
	(*libgcc) [WITH_AVRLIBC]: Add "-lm".
	* config/avr/avrlibc.h (LIBGCC_SPEC): Remove definition.
	* config/avr/avr.h (DRIVER_SELF_SPECS): Fix handling of -march=.
	(CPP_SPEC, CC1PLUS_SPEC, ASM_SPEC, LINK_SPEC, LIB_SPEC)
	(LIBGCC_SPEC): Remove definitions.


[-- Attachment #2: fix-specs.diff --]
[-- Type: text/x-patch, Size: 12997 bytes --]

Index: config.gcc
===================================================================
--- config.gcc	(revision 220854)
+++ config.gcc	(working copy)
@@ -1103,7 +1103,6 @@ avr-*-*)
 	fi
 	tmake_file="${tmake_file} avr/t-avr avr/t-multilib"
 	use_gcc_stdint=wrap
-	extra_gcc_objs="driver-avr.o avr-devices.o"
 	extra_objs="avr-devices.o avr-log.o"
 	;;
 bfin*-elf*)
Index: config/avr/t-avr
===================================================================
--- config/avr/t-avr	(revision 221028)
+++ config/avr/t-avr	(working copy)
@@ -16,10 +16,6 @@
 # along with GCC; see the file COPYING3.  If not see
 # <http://www.gnu.org/licenses/>.
 
-driver-avr.o: $(srcdir)/config/avr/driver-avr.c \
-  $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H)
-	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $<
-
 avr-devices.o: $(srcdir)/config/avr/avr-devices.c \
   $(srcdir)/config/avr/avr-mcus.def \
   $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H)
@@ -69,8 +65,8 @@ gen-avr-mmcu-texi$(build_exeext): $(srcd
 
 gen-avr-mmcu-specs$(build_exeext): $(srcdir)/config/avr/gen-avr-mmcu-specs.c \
   $(AVR_MCUS) $(srcdir)/config/avr/avr-devices.c \
-  $(srcdir)/config/avr/avr-arch.h
-	$(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $< -o $@
+  $(srcdir)/config/avr/avr-arch.h $(TM_H)
+	$(CXX_FOR_BUILD) $(CXXFLAGS_FOR_BUILD) $< -o $@ $(INCLUDES)
 
 $(srcdir)/doc/avr-mmcu.texi: gen-avr-mmcu-texi$(build_exeext)
 	$(RUN_GEN) ./$< > $@
Index: config/avr/gen-avr-mmcu-specs.c
===================================================================
--- config/avr/gen-avr-mmcu-specs.c	(revision 221028)
+++ config/avr/gen-avr-mmcu-specs.c	(working copy)
@@ -26,9 +26,30 @@
 #include "avr-arch.h"
 #include "avr-devices.c"
 
+#define GCC_DEFAULTS_H
+
+#include "tm.h"
+
+#if defined (WITH_AVRLIBC)
+static const bool with_avrlibc = true;
+#else
+static const bool with_avrlibc = false;
+#endif /* WITH_AVRLIBC */
+
+
+/* Return true iff STR starts with PREFIX.  */
+
+static bool
+str_prefix_p (const char *str, const char *prefix)
+{
+  return 0 == strncmp (str, prefix, strlen (prefix));
+}
+
+
 static void
 print_mcu (const avr_mcu_t *mcu)
 {
+  const char *sp8_spec;
   const avr_mcu_t *arch_mcu;
 
   for (arch_mcu = mcu; arch_mcu->macro; )
@@ -37,100 +58,121 @@ for (arch_mcu = mcu; arch_mcu->macro; )
     exit (EXIT_FAILURE);
 
   char name[100];
-  if (snprintf (name, sizeof name, "specs-%s", mcu->name) >= sizeof name)
+  if (snprintf (name, sizeof name, "specs-%s", mcu->name) >= (int) sizeof name)
    exit (EXIT_FAILURE);
 
   FILE *f = fopen (name ,"w");
 
-  const char *sp8, *errata_skip, *rmw;
-  /* Leave "avr2" and "avr25" alone.  These two architectures are
-     the only ones that mix devices with 8-bit SP and 16-bit SP.  */
+  bool errata_skip = 0 != (mcu->dev_attribute & AVR_ERRATA_SKIP);
+  bool rmw = 0 != (mcu->dev_attribute & AVR_ISA_RMW);
+  bool sp8 = 0 != (mcu->dev_attribute & AVR_SHORT_SP);
+
   if (mcu->macro == NULL
       && (mcu->arch == ARCH_AVR2 || mcu->arch == ARCH_AVR25))
-    sp8 = "";
-
-  sp8 = ((mcu->dev_attribute & AVR_SHORT_SP)
-	 ? " -msp8" : " %<msp8");
+    {
+      // Leave "avr2" and "avr25" alone.  These two architectures are
+      // the only ones that mix devices with 8-bit SP and 16-bit SP.
+      sp8_spec = "";
+    }
+  else
+    {
+      sp8_spec = sp8
+        ? " -msp8"
+        : " %<msp8";
+    }
 
-  errata_skip = (mcu->dev_attribute & AVR_ERRATA_SKIP) ? " -mskip-bug" : "";
-  rmw = (mcu->dev_attribute & AVR_ISA_RMW) ? "%{!mno-rmw: -mrmw}" : "";
+  const char *errata_skip_spec = errata_skip
+    ? " %{!mno-skip-bug:-mskip-bug}"
+    : " %{!mskip-bug:-mno-skip-bug}";
+
+  const char *rmw_spec = rmw
+    ? " %{!mno-rmw: -mrmw}"
+    : " %{mrmw}";
 
   const char *arch_name = avr_arch_types[mcu->arch].arch_name;
 
-  fprintf (f, "*self_spec:\n%%{!march=*:-march=%s}%s\n\n", arch_name, sp8);
+  fprintf (f, "*self_spec:\n"
+           " %%{!march=*:-march=%s}"
+           " %s\n\n", arch_name, sp8_spec);
 
   if (mcu->macro)
     fprintf (f, "*cpp:\n-D__AVR_DEV_LIB_NAME__=%s -D%s "
 	     "-D__AVR_DEVICE_NAME__=%s\n\n",
 	     mcu->library_name, mcu->macro, mcu->name);
 
-  fprintf (f, "*cc1:\n%s%s", errata_skip, rmw);
+  fprintf (f, "*cc1:\n%s%s", errata_skip_spec, rmw_spec);
   if (mcu->n_flash != arch_mcu->n_flash)
     fprintf (f, " %%{!mn-flash:-mn-flash=%d}", mcu->n_flash);
   fprintf (f, "\n\n");
-  fprintf (f, "*cc1plus:\n%s%s ", errata_skip, rmw);
+
+  fprintf (f, "*cc1plus:\n%s%s ", errata_skip_spec, rmw_spec);
   if (mcu->n_flash != arch_mcu->n_flash)
-    fprintf (f, "%%{!mn-flash:-mn-flash=%d}", mcu->n_flash);
-  fprintf (f, "%%{!frtti: -fno-rtti}"
-	   "%%{!fenforce-eh-specs: -fno-enforce-eh-specs}"
-	   "%%{!fexceptions: -fno-exceptions}\n\n");
-
-  fprintf (f, "*asm:\n%%{march=*:-mmcu=%%*}%{mrelax: --mlink-relax}%s\n\n",
-	   *errata_skip ? "" : " -mno-skip-bug");
-
-  fprintf (f, "*link:\n%%{mrelax:--relax");
-  if (strncmp (mcu->name, "at90usb8", strlen ("at90usb8")) == 0)
-    fprintf (f, "%%{mpmem-wrap-around: --pmem-wrap-around=8k}");
-  if (strncmp (mcu->name, "atmega16", strlen ("atmega16")) == 0)
-    fprintf (f, "%%{mpmem-wrap-around: --pmem-wrap-around=16k}");
-  if (strncmp (mcu->name, "atmega32", strlen ("atmega32")) == 0
-      || strncmp (mcu->name, "at90can32", strlen ("at90can32")) == 0)
-    fprintf (f, "%%{mpmem-wrap-around: --pmem-wrap-around=32k}");
-  if (strncmp (mcu->name, "atmega64", strlen ("atmega64")) == 0
-      || strncmp (mcu->name, "at90can64", strlen ("at90can64")) == 0
-      || strncmp (mcu->name, "at90usb64", strlen ("at90usb64")) == 0)
-    fprintf (f, "%%{mpmem-wrap-around: --pmem-wrap-around=64k}");
-  fprintf (f, "} %%{march=*:-m%%*}");
+    fprintf (f, " %%{!mn-flash:-mn-flash=%d}", mcu->n_flash);
+  fprintf (f, (" %%{!frtti: -fno-rtti}"
+               " %%{!fenforce-eh-specs: -fno-enforce-eh-specs}"
+               " %%{!fexceptions: -fno-exceptions}\n\n"));
+
+  fprintf (f, "*asm:\n"
+           " %%{march=*:-mmcu=%%*}"
+           " %%{mrelax: --mlink-relax}"
+           " %s%s\n\n", rmw_spec, (errata_skip
+                                  ? " %{mno-skip-bug}"
+                                  : " %{!mskip-bug:-mno-skip-bug}"));
+  fprintf (f, "*link:\n"
+           " %%{mrelax:--relax");
+  {
+    int wrap_k =
+      str_prefix_p (mcu->name, "at90usb8") ? 8
+      : str_prefix_p (mcu->name, "atmega16") ? 16
+      : (str_prefix_p (mcu->name, "atmega32")
+         || str_prefix_p (mcu->name, "at90can32")) ? 32
+      : (str_prefix_p (mcu->name, "atmega64")
+        || str_prefix_p (mcu->name, "at90can64")
+        || str_prefix_p (mcu->name, "at90usb64")) ? 64
+      : 0;
+
+    if (wrap_k)
+      fprintf (f, " %%{mpmem-wrap-around: --pmem-wrap-around=%dk}", wrap_k);
+  }
+  fprintf (f, "}"
+           " %%{march=*:-m%%*}");
+
   if (mcu->data_section_start
       != avr_arch_types[mcu->arch].default_data_section_start)
     fprintf (f, " -Tdata 0x%lX", 0x800000UL + mcu->data_section_start);
+
   if (mcu->text_section_start != 0x0)
-    fprintf (f, " -Ttext 0x%lX", mcu->text_section_start);
+    fprintf (f, " -Ttext 0x%lX", 0UL + mcu->text_section_start);
 
   fprintf (f, " %%{shared:%%eshared is not supported}\n\n");
 
+  bool has_libs = mcu->arch != ARCH_AVR1;
+
   fprintf (f, "*lib:\n");
-  if (strncmp (mcu->name, "mmcu=at90s1", strlen ("mmcu=at90s1")) != 0
-      && strncmp (mcu->name, "mmcu=attiny11", strlen ("mmcu=attiny11")) != 0
-      && strncmp (mcu->name, "mmcu=attiny12", strlen ("mmcu=attiny12")) != 0
-      && strncmp (mcu->name, "mmcu=attiny15", strlen ("mmcu=attiny15")) != 0
-      && strncmp (mcu->name, "mmcu=attiny28", strlen ("mmcu=attiny28")) != 0)
+  if (has_libs)
     {
       fprintf (f, "-lc");
-      if (mcu->macro)
+      if (with_avrlibc
+          && mcu->macro)
 	fprintf (f, " dev/%s/libdev.a%%s", mcu->name);
     }
   fprintf (f, "\n\n");
 
   fprintf (f, "*libgcc:\n");
-  if (strncmp (mcu->name, "mmcu=at90s1", strlen ("mmcu=at90s1")) != 0
-      && strncmp (mcu->name, "mmcu=attiny11", strlen ("mmcu=attiny11")) != 0
-      && strncmp (mcu->name, "mmcu=attiny12", strlen ("mmcu=attiny12")) != 0
-      && strncmp (mcu->name, "mmcu=attiny15", strlen ("mmcu=attiny15")) != 0
-      && strncmp (mcu->name, "mmcu=attiny28", strlen ("mmcu=attiny28")) != 0)
-    fprintf (f, "-lgcc");
+  if (has_libs)
+    fprintf (f, with_avrlibc
+             ? "-lgcc -lm"
+             : "-lgcc");
   fprintf (f, "\n\n");
 
-  fprintf (f, "*startfile:\ndev/%s/crt1.o%%s\n\n", mcu->name);
+  fprintf (f, "*startfile:\n"
+           "dev/%s/crt1.o%%s\n\n", mcu->name);
 }
 
+
 int main (void)
 {
-  enum avr_arch arch = ARCH_UNKNOWN;
-  size_t i, n_mcus = 0;
-  const avr_mcu_t *mcu;
-
-  for (mcu = avr_mcu_types; mcu->name; mcu++)
+  for (const avr_mcu_t *mcu = avr_mcu_types; mcu->name; mcu++)
     print_mcu (mcu);
 
   return EXIT_SUCCESS;
Index: config/avr/driver-avr.c
===================================================================
--- config/avr/driver-avr.c	(revision 221028)
+++ config/avr/driver-avr.c	(working copy)
@@ -1,30 +0,0 @@
-/* Subroutines for the gcc driver.
-   Copyright (C) 2009-2015 Free Software Foundation, Inc.
-   Contributed by Anatoly Sokolov <aesok@post.ru>
-
-This file is part of GCC.
-
-GCC is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 3, or (at your option)
-any later version.
-
-GCC is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-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/>.  */
-
-#include "config.h"
-#include "system.h"
-#include "coretypes.h"
-#include "tm.h"
-
-/* Current architecture.  */
-const avr_arch_t *avr_current_arch = NULL;
-
-/* Current device.  */
-const avr_mcu_t *avr_current_device = NULL;
Index: config/avr/avrlibc.h
===================================================================
--- config/avr/avrlibc.h	(revision 221028)
+++ config/avr/avrlibc.h	(working copy)
@@ -19,11 +19,13 @@ You should have received a copy of the G
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
-/* AVR-Libc implements functions from libgcc.a in libm.a, see PR54461.  */
+/* AVR-Libc implements functions from libgcc.a in libm.a, see PR54461.
+   More AVR-Libc specific specs originate from gen-avr-mmcu-specs.c:
 
-#undef  LIBGCC_SPEC
-#define LIBGCC_SPEC                                                     \
-  "%{!mmcu=at90s1*:%{!mmcu=attiny11:%{!mmcu=attiny12:%{!mmcu=attiny15:%{!mmcu=attiny28: -lgcc -lm }}}}}"
+   - LIBGCC_SPEC (*libgcc)
+   - LIB_SPEC (*lib)
+   
+*/
 
 #undef  LINK_GCC_C_SEQUENCE_SPEC
 #define LINK_GCC_C_SEQUENCE_SPEC \
Index: config/avr/avr.h
===================================================================
--- config/avr/avr.h	(revision 221028)
+++ config/avr/avr.h	(working copy)
@@ -492,42 +492,18 @@ typedef struct avr_args
 #define ADJUST_INSN_LENGTH(INSN, LENGTH)                \
     (LENGTH = avr_adjust_insn_length (INSN, LENGTH))
 
-#define DRIVER_SELF_SPECS " %{mmcu=*:-specs=device-specs/specs-%*%s %<mmcu=*} "
-#define CPP_SPEC ""
+#define DRIVER_SELF_SPECS                                       \
+  " %{!mmcu=*:%{!march=*:-specs=device-specs/specs-avr2%s} "    \
+  "           %{march=*:-specs=device-specs/specs-%*%s}} "      \
+  " %{mmcu=*:-specs=device-specs/specs-%*%s %<mmcu=*} "
 
 /* We want cc1plus used as a preprocessor to pick up the cpp spec from the
    per-device spec files  */
 #define CPLUSPLUS_CPP_SPEC "%(cpp)"
 
-#define CC1_SPEC ""
-
-#define CC1PLUS_SPEC "%{!frtti:-fno-rtti} \
-    %{!fenforce-eh-specs:-fno-enforce-eh-specs} \
-    %{!fexceptions:-fno-exceptions}"
-
-#define ASM_SPEC "%{march=*:-mmcu=%*}%{mrelax: --mlink-relax}"
-  
-#define LINK_SPEC "\
-%{mrelax:--relax\
-         %{mpmem-wrap-around:%{mmcu=at90usb8*:--pmem-wrap-around=8k}\
-                             %{mmcu=atmega16*:--pmem-wrap-around=16k}\
-                             %{mmcu=atmega32*|\
-                               mmcu=at90can32*:--pmem-wrap-around=32k}\
-                             %{mmcu=atmega64*|\
-                               mmcu=at90can64*|\
-                               mmcu=at90usb64*:--pmem-wrap-around=64k}}}\
-%{march=*:-m%*}\
-%{shared:%eshared is not supported}"
-
-#define LIB_SPEC \
-  "%{!mmcu=at90s1*:%{!mmcu=attiny11:%{!mmcu=attiny12:%{!mmcu=attiny15:%{!mmcu=attiny28: -lc }}}}}"
-
 #define LIBSTDCXX "gcc"
 /* No libstdc++ for now.  Empty string doesn't work.  */
 
-#define LIBGCC_SPEC \
-  "%{!mmcu=at90s1*:%{!mmcu=attiny11:%{!mmcu=attiny12:%{!mmcu=attiny15:%{!mmcu=attiny28: -lgcc }}}}}"
-
 /* The actual definition will come from the device-specific spec file.  */
 #define STARTFILE_SPEC ""
 

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [patch,avr]: Fix various problems with specs and specs file generation.
  2015-03-02 19:40 [patch,avr]: Fix various problems with specs and specs file generation Georg-Johann Lay
@ 2015-03-03  7:46 ` Denis Chertykov
  2015-03-03 13:20 ` Senthil Kumar Selvaraj
  1 sibling, 0 replies; 23+ messages in thread
From: Denis Chertykov @ 2015-03-03  7:46 UTC (permalink / raw)
  To: Georg-Johann Lay; +Cc: GCC Patches, Joerg Wunsch, Joern Rennecke

2015-03-02 22:40 GMT+03:00 Georg-Johann Lay <avr@gjlay.de>:
> The new specs file generation introduces several problems.  This patch
>
> - Fix build warnings
>
> - Clean up unused code and the old, now dead specs definitions.
>
> - Removes unused files and adjust build scripts / rules.
>
> - Issues with avr-libc awareness:
>
> -- Makes specs-generation aware of avr-libc (include tm.h in build script
> and depend on WITH_AVRLIBC).
>
> -- avr-libc implements functions in libm.a which usually live in libgcc,
> hence add -lm to libgcc_spec, cf. PR54461.
>
> -- The new libdev.a is a feature of avr-libc and not available with, e.g.,
> newlib.  Hence remove it from lib_spec if the compiler is not configured for
> avr-libc (--with-avrlibc=no).
>
> - Many minor issues with option propagation.
>
> - -march had been added to multilib generation some time ago, but
> driver_self_spec was not aware of that option.
>
>
> Ok for trunk?

Approved.

>
>
> BTW, anyone knows what -march= is good for?  It allows all kinds of silly
> option combinations like "-march=avrtiny -mmcu=atmega8" without any
> complaints.
>
> What's wrong with -mmcu=avr* ? All architecture names start with "avr", and
> /no/ device name starts /with/ "avr", hence -mmcu= should be fine and work
> as smooth as in the last 10 years.
>
> Why that -march= option?  If there is not a good reason for -march=, I'd
> propose to clean it up and use -mmcu=avr* instead.


I do not remember.
I guess that it's like -march / -mcpu in ARM target.


Denis.

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [patch,avr]: Fix various problems with specs and specs file generation.
  2015-03-02 19:40 [patch,avr]: Fix various problems with specs and specs file generation Georg-Johann Lay
  2015-03-03  7:46 ` Denis Chertykov
@ 2015-03-03 13:20 ` Senthil Kumar Selvaraj
  2015-03-09 16:03   ` [patch,avr]: Part2: " Georg-Johann Lay
  2015-03-09 16:21   ` [patch,avr]: Fix various problems with specs and specs file generation Georg-Johann Lay
  1 sibling, 2 replies; 23+ messages in thread
From: Senthil Kumar Selvaraj @ 2015-03-03 13:20 UTC (permalink / raw)
  To: Georg-Johann Lay
  Cc: Denis Chertykov, GCC Patches, Joerg Wunsch, Joern Rennecke

On Mon, Mar 02, 2015 at 08:40:17PM +0100, Georg-Johann Lay wrote:
> The new specs file generation introduces several problems.  This patch
> 
> - Fix build warnings
> 
> - Clean up unused code and the old, now dead specs definitions.
> 
> - Removes unused files and adjust build scripts / rules.
> 
> - Issues with avr-libc awareness:
> 
> -- Makes specs-generation aware of avr-libc (include tm.h in build script
> and depend on WITH_AVRLIBC).
> 
> -- avr-libc implements functions in libm.a which usually live in libgcc,
> hence add -lm to libgcc_spec, cf. PR54461.
> 
> -- The new libdev.a is a feature of avr-libc and not available with, e.g.,
> newlib.  Hence remove it from lib_spec if the compiler is not configured for
> avr-libc (--with-avrlibc=no).
> 
> - Many minor issues with option propagation.
> 
> - -march had been added to multilib generation some time ago, but
> driver_self_spec was not aware of that option.
> 
> 
> Ok for trunk?
> 
> 
> BTW, anyone knows what -march= is good for?  It allows all kinds of silly
> option combinations like "-march=avrtiny -mmcu=atmega8" without any
> complaints.

IIRC, -march was added because replacing -mmcu=<device> to
-mmcu=<arch> in the driver's self specs broke multilib selection - the
driver always acted as if no -mmcu was specified. Adding
a new option (-march), translating mmcu=<device> to march=<arch> and then 
basing t-multilib on that worked ok.

> 
> What's wrong with -mmcu=avr* ? All architecture names start with "avr", and
> /no/ device name starts /with/ "avr", hence -mmcu= should be fine and work
> as smooth as in the last 10 years.
> 
> Why that -march= option?  If there is not a good reason for -march=, I'd
> propose to clean it up and use -mmcu=avr* instead.
> 
> 
> Johann
> 
> 
> gcc/
> 	Fix various problems with specs file generation.
> 
> 	* config.gcc (extra_gcc_objs) [avr]: Remove.
> 
> 	* config/avr/driver-avr.c: Remove file.
> 	* config/avr/t-avr (driver-avr.o): Remove rule.
> 	(gen-avr-mmcu-specs): Use CXX_FOR_BUILD, CXXFLAGS_FOR_BUILD and
> 	INCLUDES to build.  Depend on TM_H.
> 	* config/avr/gen-avr-mmcu-specs.c: Tidy up code.  Fix various
> 	build warnings.  Fix non-matching types and non-existing %-codes.
> 	(tm.h): Include.
> 	(*lib) [!WITH_AVRLIBC]: Don't link libdev.a.
> 	(*libgcc) [WITH_AVRLIBC]: Add "-lm".
> 	* config/avr/avrlibc.h (LIBGCC_SPEC): Remove definition.
> 	* config/avr/avr.h (DRIVER_SELF_SPECS): Fix handling of -march=.
> 	(CPP_SPEC, CC1PLUS_SPEC, ASM_SPEC, LINK_SPEC, LIB_SPEC)
> 	(LIBGCC_SPEC): Remove definitions.
> 

> Index: config.gcc
> ===================================================================
> --- config.gcc	(revision 220854)
> +++ config.gcc	(working copy)
> @@ -1103,7 +1103,6 @@ avr-*-*)
>  	fi
>  	tmake_file="${tmake_file} avr/t-avr avr/t-multilib"
>  	use_gcc_stdint=wrap
> -	extra_gcc_objs="driver-avr.o avr-devices.o"
>  	extra_objs="avr-devices.o avr-log.o"
>  	;;
>  bfin*-elf*)
> Index: config/avr/t-avr
> ===================================================================
> --- config/avr/t-avr	(revision 221028)
> +++ config/avr/t-avr	(working copy)
> @@ -16,10 +16,6 @@
>  # along with GCC; see the file COPYING3.  If not see
>  # <http://www.gnu.org/licenses/>.
>  
> -driver-avr.o: $(srcdir)/config/avr/driver-avr.c \
> -  $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H)
> -	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $<
> -
>  avr-devices.o: $(srcdir)/config/avr/avr-devices.c \
>    $(srcdir)/config/avr/avr-mcus.def \
>    $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H)
> @@ -69,8 +65,8 @@ gen-avr-mmcu-texi$(build_exeext): $(srcd
>  
>  gen-avr-mmcu-specs$(build_exeext): $(srcdir)/config/avr/gen-avr-mmcu-specs.c \
>    $(AVR_MCUS) $(srcdir)/config/avr/avr-devices.c \
> -  $(srcdir)/config/avr/avr-arch.h
> -	$(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $< -o $@
> +  $(srcdir)/config/avr/avr-arch.h $(TM_H)
> +	$(CXX_FOR_BUILD) $(CXXFLAGS_FOR_BUILD) $< -o $@ $(INCLUDES)
>  
>  $(srcdir)/doc/avr-mmcu.texi: gen-avr-mmcu-texi$(build_exeext)
>  	$(RUN_GEN) ./$< > $@
> Index: config/avr/gen-avr-mmcu-specs.c
> ===================================================================
> --- config/avr/gen-avr-mmcu-specs.c	(revision 221028)
> +++ config/avr/gen-avr-mmcu-specs.c	(working copy)
> @@ -26,9 +26,30 @@
>  #include "avr-arch.h"
>  #include "avr-devices.c"
>  
> +#define GCC_DEFAULTS_H
> +
> +#include "tm.h"
> +
> +#if defined (WITH_AVRLIBC)
> +static const bool with_avrlibc = true;
> +#else
> +static const bool with_avrlibc = false;
> +#endif /* WITH_AVRLIBC */
> +
> +
> +/* Return true iff STR starts with PREFIX.  */
> +
> +static bool
> +str_prefix_p (const char *str, const char *prefix)
> +{
> +  return 0 == strncmp (str, prefix, strlen (prefix));
> +}
> +
> +
>  static void
>  print_mcu (const avr_mcu_t *mcu)
>  {
> +  const char *sp8_spec;
>    const avr_mcu_t *arch_mcu;
>  
>    for (arch_mcu = mcu; arch_mcu->macro; )
> @@ -37,100 +58,121 @@ for (arch_mcu = mcu; arch_mcu->macro; )
>      exit (EXIT_FAILURE);
>  
>    char name[100];
> -  if (snprintf (name, sizeof name, "specs-%s", mcu->name) >= sizeof name)
> +  if (snprintf (name, sizeof name, "specs-%s", mcu->name) >= (int) sizeof name)
>     exit (EXIT_FAILURE);
>  
>    FILE *f = fopen (name ,"w");
>  
> -  const char *sp8, *errata_skip, *rmw;
> -  /* Leave "avr2" and "avr25" alone.  These two architectures are
> -     the only ones that mix devices with 8-bit SP and 16-bit SP.  */
> +  bool errata_skip = 0 != (mcu->dev_attribute & AVR_ERRATA_SKIP);
> +  bool rmw = 0 != (mcu->dev_attribute & AVR_ISA_RMW);
> +  bool sp8 = 0 != (mcu->dev_attribute & AVR_SHORT_SP);
> +
>    if (mcu->macro == NULL
>        && (mcu->arch == ARCH_AVR2 || mcu->arch == ARCH_AVR25))
> -    sp8 = "";
> -
> -  sp8 = ((mcu->dev_attribute & AVR_SHORT_SP)
> -	 ? " -msp8" : " %<msp8");
> +    {
> +      // Leave "avr2" and "avr25" alone.  These two architectures are
> +      // the only ones that mix devices with 8-bit SP and 16-bit SP.
> +      sp8_spec = "";
> +    }
> +  else
> +    {
> +      sp8_spec = sp8
> +        ? " -msp8"
> +        : " %<msp8";
> +    }
>  
> -  errata_skip = (mcu->dev_attribute & AVR_ERRATA_SKIP) ? " -mskip-bug" : "";
> -  rmw = (mcu->dev_attribute & AVR_ISA_RMW) ? "%{!mno-rmw: -mrmw}" : "";
> +  const char *errata_skip_spec = errata_skip
> +    ? " %{!mno-skip-bug:-mskip-bug}"
> +    : " %{!mskip-bug:-mno-skip-bug}";
> +
> +  const char *rmw_spec = rmw
> +    ? " %{!mno-rmw: -mrmw}"
> +    : " %{mrmw}";
>  
>    const char *arch_name = avr_arch_types[mcu->arch].arch_name;
>  
> -  fprintf (f, "*self_spec:\n%%{!march=*:-march=%s}%s\n\n", arch_name, sp8);
> +  fprintf (f, "*self_spec:\n"
> +           " %%{!march=*:-march=%s}"
> +           " %s\n\n", arch_name, sp8_spec);
>  
>    if (mcu->macro)
>      fprintf (f, "*cpp:\n-D__AVR_DEV_LIB_NAME__=%s -D%s "
>  	     "-D__AVR_DEVICE_NAME__=%s\n\n",
>  	     mcu->library_name, mcu->macro, mcu->name);
>  
> -  fprintf (f, "*cc1:\n%s%s", errata_skip, rmw);
> +  fprintf (f, "*cc1:\n%s%s", errata_skip_spec, rmw_spec);
>    if (mcu->n_flash != arch_mcu->n_flash)
>      fprintf (f, " %%{!mn-flash:-mn-flash=%d}", mcu->n_flash);
>    fprintf (f, "\n\n");
> -  fprintf (f, "*cc1plus:\n%s%s ", errata_skip, rmw);
> +
> +  fprintf (f, "*cc1plus:\n%s%s ", errata_skip_spec, rmw_spec);
>    if (mcu->n_flash != arch_mcu->n_flash)
> -    fprintf (f, "%%{!mn-flash:-mn-flash=%d}", mcu->n_flash);
> -  fprintf (f, "%%{!frtti: -fno-rtti}"
> -	   "%%{!fenforce-eh-specs: -fno-enforce-eh-specs}"
> -	   "%%{!fexceptions: -fno-exceptions}\n\n");
> -
> -  fprintf (f, "*asm:\n%%{march=*:-mmcu=%%*}%{mrelax: --mlink-relax}%s\n\n",
> -	   *errata_skip ? "" : " -mno-skip-bug");
> -
> -  fprintf (f, "*link:\n%%{mrelax:--relax");
> -  if (strncmp (mcu->name, "at90usb8", strlen ("at90usb8")) == 0)
> -    fprintf (f, "%%{mpmem-wrap-around: --pmem-wrap-around=8k}");
> -  if (strncmp (mcu->name, "atmega16", strlen ("atmega16")) == 0)
> -    fprintf (f, "%%{mpmem-wrap-around: --pmem-wrap-around=16k}");
> -  if (strncmp (mcu->name, "atmega32", strlen ("atmega32")) == 0
> -      || strncmp (mcu->name, "at90can32", strlen ("at90can32")) == 0)
> -    fprintf (f, "%%{mpmem-wrap-around: --pmem-wrap-around=32k}");
> -  if (strncmp (mcu->name, "atmega64", strlen ("atmega64")) == 0
> -      || strncmp (mcu->name, "at90can64", strlen ("at90can64")) == 0
> -      || strncmp (mcu->name, "at90usb64", strlen ("at90usb64")) == 0)
> -    fprintf (f, "%%{mpmem-wrap-around: --pmem-wrap-around=64k}");
> -  fprintf (f, "} %%{march=*:-m%%*}");
> +    fprintf (f, " %%{!mn-flash:-mn-flash=%d}", mcu->n_flash);
> +  fprintf (f, (" %%{!frtti: -fno-rtti}"
> +               " %%{!fenforce-eh-specs: -fno-enforce-eh-specs}"
> +               " %%{!fexceptions: -fno-exceptions}\n\n"));
> +
> +  fprintf (f, "*asm:\n"
> +           " %%{march=*:-mmcu=%%*}"
> +           " %%{mrelax: --mlink-relax}"
> +           " %s%s\n\n", rmw_spec, (errata_skip
> +                                  ? " %{mno-skip-bug}"
> +                                  : " %{!mskip-bug:-mno-skip-bug}"));
> +  fprintf (f, "*link:\n"
> +           " %%{mrelax:--relax");
> +  {
> +    int wrap_k =
> +      str_prefix_p (mcu->name, "at90usb8") ? 8
> +      : str_prefix_p (mcu->name, "atmega16") ? 16
> +      : (str_prefix_p (mcu->name, "atmega32")
> +         || str_prefix_p (mcu->name, "at90can32")) ? 32
> +      : (str_prefix_p (mcu->name, "atmega64")
> +        || str_prefix_p (mcu->name, "at90can64")
> +        || str_prefix_p (mcu->name, "at90usb64")) ? 64
> +      : 0;
> +
> +    if (wrap_k)
> +      fprintf (f, " %%{mpmem-wrap-around: --pmem-wrap-around=%dk}", wrap_k);
> +  }
> +  fprintf (f, "}"
> +           " %%{march=*:-m%%*}");
> +
>    if (mcu->data_section_start
>        != avr_arch_types[mcu->arch].default_data_section_start)
>      fprintf (f, " -Tdata 0x%lX", 0x800000UL + mcu->data_section_start);
> +
>    if (mcu->text_section_start != 0x0)
> -    fprintf (f, " -Ttext 0x%lX", mcu->text_section_start);
> +    fprintf (f, " -Ttext 0x%lX", 0UL + mcu->text_section_start);
>  
>    fprintf (f, " %%{shared:%%eshared is not supported}\n\n");
>  
> +  bool has_libs = mcu->arch != ARCH_AVR1;
> +
>    fprintf (f, "*lib:\n");
> -  if (strncmp (mcu->name, "mmcu=at90s1", strlen ("mmcu=at90s1")) != 0
> -      && strncmp (mcu->name, "mmcu=attiny11", strlen ("mmcu=attiny11")) != 0
> -      && strncmp (mcu->name, "mmcu=attiny12", strlen ("mmcu=attiny12")) != 0
> -      && strncmp (mcu->name, "mmcu=attiny15", strlen ("mmcu=attiny15")) != 0
> -      && strncmp (mcu->name, "mmcu=attiny28", strlen ("mmcu=attiny28")) != 0)
> +  if (has_libs)
>      {
>        fprintf (f, "-lc");
> -      if (mcu->macro)
> +      if (with_avrlibc
> +          && mcu->macro)
>  	fprintf (f, " dev/%s/libdev.a%%s", mcu->name);
>      }
>    fprintf (f, "\n\n");
>  
>    fprintf (f, "*libgcc:\n");
> -  if (strncmp (mcu->name, "mmcu=at90s1", strlen ("mmcu=at90s1")) != 0
> -      && strncmp (mcu->name, "mmcu=attiny11", strlen ("mmcu=attiny11")) != 0
> -      && strncmp (mcu->name, "mmcu=attiny12", strlen ("mmcu=attiny12")) != 0
> -      && strncmp (mcu->name, "mmcu=attiny15", strlen ("mmcu=attiny15")) != 0
> -      && strncmp (mcu->name, "mmcu=attiny28", strlen ("mmcu=attiny28")) != 0)
> -    fprintf (f, "-lgcc");
> +  if (has_libs)
> +    fprintf (f, with_avrlibc
> +             ? "-lgcc -lm"
> +             : "-lgcc");
>    fprintf (f, "\n\n");
>  
> -  fprintf (f, "*startfile:\ndev/%s/crt1.o%%s\n\n", mcu->name);
> +  fprintf (f, "*startfile:\n"
> +           "dev/%s/crt1.o%%s\n\n", mcu->name);
>  }
>  
> +
>  int main (void)
>  {
> -  enum avr_arch arch = ARCH_UNKNOWN;
> -  size_t i, n_mcus = 0;
> -  const avr_mcu_t *mcu;
> -
> -  for (mcu = avr_mcu_types; mcu->name; mcu++)
> +  for (const avr_mcu_t *mcu = avr_mcu_types; mcu->name; mcu++)
>      print_mcu (mcu);
>  
>    return EXIT_SUCCESS;
> Index: config/avr/driver-avr.c
> ===================================================================
> --- config/avr/driver-avr.c	(revision 221028)
> +++ config/avr/driver-avr.c	(working copy)
> @@ -1,30 +0,0 @@
> -/* Subroutines for the gcc driver.
> -   Copyright (C) 2009-2015 Free Software Foundation, Inc.
> -   Contributed by Anatoly Sokolov <aesok@post.ru>
> -
> -This file is part of GCC.
> -
> -GCC is free software; you can redistribute it and/or modify
> -it under the terms of the GNU General Public License as published by
> -the Free Software Foundation; either version 3, or (at your option)
> -any later version.
> -
> -GCC is distributed in the hope that it will be useful,
> -but WITHOUT ANY WARRANTY; without even the implied warranty of
> -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> -GNU General Public License for more details.
> -
> -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/>.  */
> -
> -#include "config.h"
> -#include "system.h"
> -#include "coretypes.h"
> -#include "tm.h"
> -
> -/* Current architecture.  */
> -const avr_arch_t *avr_current_arch = NULL;
> -
> -/* Current device.  */
> -const avr_mcu_t *avr_current_device = NULL;
> Index: config/avr/avrlibc.h
> ===================================================================
> --- config/avr/avrlibc.h	(revision 221028)
> +++ config/avr/avrlibc.h	(working copy)
> @@ -19,11 +19,13 @@ You should have received a copy of the G
>  along with GCC; see the file COPYING3.  If not see
>  <http://www.gnu.org/licenses/>.  */
>  
> -/* AVR-Libc implements functions from libgcc.a in libm.a, see PR54461.  */
> +/* AVR-Libc implements functions from libgcc.a in libm.a, see PR54461.
> +   More AVR-Libc specific specs originate from gen-avr-mmcu-specs.c:
>  
> -#undef  LIBGCC_SPEC
> -#define LIBGCC_SPEC                                                     \
> -  "%{!mmcu=at90s1*:%{!mmcu=attiny11:%{!mmcu=attiny12:%{!mmcu=attiny15:%{!mmcu=attiny28: -lgcc -lm }}}}}"
> +   - LIBGCC_SPEC (*libgcc)
> +   - LIB_SPEC (*lib)
> +   
> +*/
>  
>  #undef  LINK_GCC_C_SEQUENCE_SPEC
>  #define LINK_GCC_C_SEQUENCE_SPEC \
> Index: config/avr/avr.h
> ===================================================================
> --- config/avr/avr.h	(revision 221028)
> +++ config/avr/avr.h	(working copy)
> @@ -492,42 +492,18 @@ typedef struct avr_args
>  #define ADJUST_INSN_LENGTH(INSN, LENGTH)                \
>      (LENGTH = avr_adjust_insn_length (INSN, LENGTH))
>  
> -#define DRIVER_SELF_SPECS " %{mmcu=*:-specs=device-specs/specs-%*%s %<mmcu=*} "
> -#define CPP_SPEC ""
> +#define DRIVER_SELF_SPECS                                       \
> +  " %{!mmcu=*:%{!march=*:-specs=device-specs/specs-avr2%s} "    \
> +  "           %{march=*:-specs=device-specs/specs-%*%s}} "      \
> +  " %{mmcu=*:-specs=device-specs/specs-%*%s %<mmcu=*} "
>  
>  /* We want cc1plus used as a preprocessor to pick up the cpp spec from the
>     per-device spec files  */
>  #define CPLUSPLUS_CPP_SPEC "%(cpp)"
>  
> -#define CC1_SPEC ""
> -
> -#define CC1PLUS_SPEC "%{!frtti:-fno-rtti} \
> -    %{!fenforce-eh-specs:-fno-enforce-eh-specs} \
> -    %{!fexceptions:-fno-exceptions}"
> -
> -#define ASM_SPEC "%{march=*:-mmcu=%*}%{mrelax: --mlink-relax}"
> -  
> -#define LINK_SPEC "\
> -%{mrelax:--relax\
> -         %{mpmem-wrap-around:%{mmcu=at90usb8*:--pmem-wrap-around=8k}\
> -                             %{mmcu=atmega16*:--pmem-wrap-around=16k}\
> -                             %{mmcu=atmega32*|\
> -                               mmcu=at90can32*:--pmem-wrap-around=32k}\
> -                             %{mmcu=atmega64*|\
> -                               mmcu=at90can64*|\
> -                               mmcu=at90usb64*:--pmem-wrap-around=64k}}}\
> -%{march=*:-m%*}\
> -%{shared:%eshared is not supported}"
> -
> -#define LIB_SPEC \
> -  "%{!mmcu=at90s1*:%{!mmcu=attiny11:%{!mmcu=attiny12:%{!mmcu=attiny15:%{!mmcu=attiny28: -lc }}}}}"
> -
>  #define LIBSTDCXX "gcc"
>  /* No libstdc++ for now.  Empty string doesn't work.  */
>  
> -#define LIBGCC_SPEC \
> -  "%{!mmcu=at90s1*:%{!mmcu=attiny11:%{!mmcu=attiny12:%{!mmcu=attiny15:%{!mmcu=attiny28: -lgcc }}}}}"
> -
>  /* The actual definition will come from the device-specific spec file.  */
>  #define STARTFILE_SPEC ""
>  

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [patch,avr]: Part2: Fix various problems with specs and specs file generation.
  2015-03-03 13:20 ` Senthil Kumar Selvaraj
@ 2015-03-09 16:03   ` Georg-Johann Lay
  2015-03-09 20:00     ` Denis Chertykov
  2015-04-06  9:54     ` [patch,avr]: Part2: " Sivanupandi, Pitchumani
  2015-03-09 16:21   ` [patch,avr]: Fix various problems with specs and specs file generation Georg-Johann Lay
  1 sibling, 2 replies; 23+ messages in thread
From: Georg-Johann Lay @ 2015-03-09 16:03 UTC (permalink / raw)
  To: Senthil Kumar Selvaraj
  Cc: Denis Chertykov, GCC Patches, Joerg Wunsch, Joern Rennecke

[-- Attachment #1: Type: text/plain, Size: 5175 bytes --]

Am 03/03/2015 um 02:21 PM schrieb Senthil Kumar Selvaraj:
> On Mon, Mar 02, 2015 at 08:40:17PM +0100, Georg-Johann Lay wrote:
>> The new specs file generation introduces several problems.  This patch
>>
>> - Fix build warnings
>>
>> - Clean up unused code and the old, now dead specs definitions.
>>
>> - Removes unused files and adjust build scripts / rules.
>>
>> - Issues with avr-libc awareness:
>>
>> -- Makes specs-generation aware of avr-libc (include tm.h in build script
>> and depend on WITH_AVRLIBC).
>>
>> -- avr-libc implements functions in libm.a which usually live in libgcc,
>> hence add -lm to libgcc_spec, cf. PR54461.
>>
>> -- The new libdev.a is a feature of avr-libc and not available with, e.g.,
>> newlib.  Hence remove it from lib_spec if the compiler is not configured for
>> avr-libc (--with-avrlibc=no).
>>
>> - Many minor issues with option propagation.
>>
>> - -march had been added to multilib generation some time ago, but
>> driver_self_spec was not aware of that option.
>>
>>
>> Ok for trunk?
>>
>>
>> BTW, anyone knows what -march= is good for?  It allows all kinds of silly
>> option combinations like "-march=avrtiny -mmcu=atmega8" without any
>> complaints.
>
> IIRC, -march was added because replacing -mmcu=<device> to
> -mmcu=<arch> in the driver's self specs broke multilib selection - the
> driver always acted as if no -mmcu was specified. Adding

For me both multilib selection and multilib generation are working as expected 
with -mmcu= and without that -march=.

Attached is a 2nd part of improvements for the specs file generation:

- Remove -arch= and use -mmcu= again.

- Wrap specs file selection into a new specs function so that a comprehensible 
error message can be issued if no specs file is found.  It also informs about a 
link to spec file documentation of gcc inline docs.

- Remove genopt.sh and avr-tables.opt.  These files are no more used because 
-mmcu= is a vanilla string option now.  Using Enum option for -mmcu= does not 
allow to specify unknown devices, and target_handle_option cannot letgigimize 
unknown strings of Enum options.

- Resurrect driver-avr.c but with new content: The new specs function.

- New file specs.h with specs known to gcc and which can be overridden by 
avrlibc.h, rtems.h, etc.

- New device-specs files mostly repeat spec definitions, e.g.

     fprintf (f, "*startfile:\n\t%s\n\n", STARTFILE_SPEC);
     fprintf (f, "*endfile:\n\t%s\n\n", ENDFILE_SPEC);

- Device feature are expressed as subspecs now, e.g. avrlibc_startfile spec.

- Clean up code from "current device" stuff, adjust diagnostics, avr-arch.h, etc.

- Use INSTALL_DATA to install spec files, not INSTALL_PROGRAM.



Ok to install this, too?


Johann

	PR target/65296
	* config.gcc (extra_options) [avr]: Remove.
	(extra_gcc_objs) [avr]: Use driver-avr.o, avr-devices.o.
	(tm_file) [avr]: Add avr/specs.h after avr/avr.h.
	(tm_defines) [avr, rtems]: Add WITH_RTEMS.

	* config/avr/genmultilib.awk: Use -mmcu= instead of -march=.
	* config/avr/t-multilib: Regenerate.
	* config/avr/specs.h: New file.
	* config/avr/driver-avr.c: New file.
	* config/avr/genopt.sh: Remove file.
	* config/avr/avr-tables.opt: Remove file.
	* config/avr/predicates.md (avr_current_arch): Rename to avr_arch.
	* config/avr/avr-c.c: Same.
	* avr-arch.h: Same.
	(avr_current_device): Remove proto.
	* config/avr/avr.c (avr_current_arch): Rename to avr_arch.
	(avr_current_device): Remove definition and usage.
	(avr_set_core_architecture): New static function.
	(avr_option_override): Use it.
	* config/avr/avr.h (avr_current_arch): Rename to avr_arch.
	(AVR_HAVE_8BIT_SP): Don't depend on avr_current_device.
	(EXTRA_SPEC_FUNCTIONS): Define.
	(avr_devicespecs_file): New specs function proto.
	(DRIVER_SELF_SPECS): Use device-specs-file spec function.
	* config/avr/avr-devices.c (diagnostic.h, avr-arch.h): Include them.
	(mcu_name): New static array.
	(comparator, avr_archs_str, avr_mcus_str): New static functions.
	(avr_inform_devices, avr_inform_core_architectures): New functions.
	* config/avr/gen-avr-mmcu-specs.c (avr-arch.h, specs.h): Include.
	(avrlibc.h) [WITH_AVRLIBC]: Include.
	(../rtems.h, rtems.h) [WITH_RTEMS]: Include.
	(print_mcu): Rewrite from scratch.
	* config/avr/avrlibc.h (LIB_SPEC, LIBGCC_SPEC, STARTFILE_SPEC):
	Forward to avr-specific specs defined in device-specs file.
	* config/avr/avr.opt (config/avr/avr-arch.h): Remove include.
	(-mmcu=): Add Var and MissingArgError properties.
	(-march=): Remove.
	* config/avr/t-avr (driver-avr.o): New rule.
	(avr-devices.o): Depend on avr-arch.h.
	(avr-mcus): No more depend on avr-tables.opt.
	(avr-tables.opt): Remove rule.
	(install-device-specs): Use INSTALL_DATA, not INSTALL_PROGRAM.


> a new option (-march), translating mmcu=<device> to march=<arch> and then
> basing t-multilib on that worked ok.
>
>>
>> What's wrong with -mmcu=avr* ? All architecture names start with "avr", and
>> /no/ device name starts /with/ "avr", hence -mmcu= should be fine and work
>> as smooth as in the last 10 years.
>>
>> Why that -march= option?  If there is not a good reason for -march=, I'd
>> propose to clean it up and use -mmcu=avr* instead.
>>
>>
>> Johann


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: pr65296-part2.diff --]
[-- Type: text/x-patch; name="pr65296-part2.diff", Size: 48464 bytes --]

Index: config.gcc
===================================================================
--- config.gcc	(revision 221144)
+++ config.gcc	(working copy)
@@ -330,7 +330,6 @@ avr-*-*)
 	cpu_type=avr
 	c_target_objs="avr-c.o"
 	cxx_target_objs="avr-c.o"
-	extra_options="${extra_options} avr/avr-tables.opt"
 	;;
 bfin*-*)
 	cpu_type=bfin
@@ -1090,18 +1089,21 @@ arm*-*-eabi* | arm*-*-symbianelf* | arm*
 	tm_file="${tm_file} arm/aout.h vxworks-dummy.h arm/arm.h"
 	;;
 avr-*-rtems*)
-	tm_file="elfos.h avr/elf.h avr/avr-arch.h avr/avr.h dbxelf.h avr/rtems.h rtems.h newlib-stdint.h"
+	tm_file="elfos.h avr/elf.h avr/avr-arch.h avr/avr.h avr/specs.h dbxelf.h avr/rtems.h rtems.h newlib-stdint.h"
+	tm_defines="${tm_defines} WITH_RTEMS"
 	tmake_file="${tmake_file} avr/t-avr avr/t-multilib avr/t-rtems"
+	extra_gcc_objs="driver-avr.o avr-devices.o"
 	extra_objs="avr-devices.o avr-log.o"
 	;;
 avr-*-*)
-	tm_file="elfos.h avr/elf.h avr/avr-arch.h avr/avr.h dbxelf.h avr/avr-stdint.h"
+	tm_file="elfos.h avr/elf.h avr/avr-arch.h avr/avr.h avr/specs.h dbxelf.h avr/avr-stdint.h"
 	if test x${with_avrlibc} != xno; then
 	    tm_file="${tm_file} ${cpu_type}/avrlibc.h"
 	    tm_defines="${tm_defines} WITH_AVRLIBC"
 	fi
 	tmake_file="${tmake_file} avr/t-avr avr/t-multilib"
 	use_gcc_stdint=wrap
+	extra_gcc_objs="driver-avr.o avr-devices.o"
 	extra_objs="avr-devices.o avr-log.o"
 	;;
 bfin*-elf*)
Index: config/avr/gen-avr-mmcu-texi.c
===================================================================
--- config/avr/gen-avr-mmcu-texi.c	(revision 221140)
+++ config/avr/gen-avr-mmcu-texi.c	(working copy)
@@ -22,7 +22,6 @@
 
 #define IN_GEN_AVR_MMCU_TEXI
 
-#include "avr-arch.h"
 #include "avr-devices.c"
 
 static const char*
@@ -97,7 +96,7 @@ print_mcus (size_t n_mcus)
 
 int main (void)
 {
-  enum avr_arch arch = ARCH_UNKNOWN;
+  enum avr_arch_id arch_id = ARCH_UNKNOWN;
   size_t i, n_mcus = 0;
   const avr_mcu_t *mcu;
 
@@ -120,7 +119,7 @@ int main (void)
     {
       if (mcu->macro == NULL)
         {
-          arch = mcu->arch;
+          arch_id = mcu->arch_id;
 
           /* Start a new architecture:  Flush the MCUs collected so far.  */
 
@@ -128,10 +127,10 @@ if (mcu->macro == NULL)
           n_mcus = 0;
 
           for (i = 0; i < sizeof (avr_texinfo) / sizeof (*avr_texinfo); i++)
-            if (arch == avr_texinfo[i].arch)
+            if (arch_id == avr_texinfo[i].arch_id)
               printf ("@item %s\n%s\n", mcu->name, avr_texinfo[i].texinfo);
         }
-      else if (arch == (enum avr_arch) mcu->arch)
+      else if (arch_id == (enum avr_arch_id) mcu->arch_id)
         {
           mcu_name[n_mcus++] = mcu->name;
         }
Index: config/avr/avr-devices.c
===================================================================
--- config/avr/avr-devices.c	(revision 221140)
+++ config/avr/avr-devices.c	(working copy)
@@ -21,9 +21,12 @@
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
+#include "diagnostic.h"
 #include "tm.h"
 #endif /* IN_GEN_AVR_MMCU_TEXI */
 
+#include "avr-arch.h"
+
 /* List of all known AVR MCU architectures.
    Order as of enum avr_arch from avr.h.  */
 
@@ -31,7 +34,7 @@ const avr_arch_t
 avr_arch_types[] =
 {
   /* unknown device specified */
-  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x0060, 32, NULL,  "avr2"  },
+  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x0060, 32, NULL, AVR_MMCU_DEFAULT },
   /*
     A  M  J  LM E  E  E  X  R  T  d S   S O   A
     S  U  M  PO L  L  I  M  A  I  a t   F ff  r
@@ -116,3 +119,98 @@ avr_mcu_types[] =
   { NULL, ARCH_UNKNOWN, AVR_ISA_NONE, NULL, 0, 0, 0, NULL }
 };
 
+
+\f
+
+#ifndef IN_GEN_AVR_MMCU_TEXI
+
+/* Copy-pastes from `gen-avr-mmcu-texi.c' follow...  */
+
+static const char*
+mcu_name[sizeof avr_mcu_types / sizeof avr_mcu_types[0]];
+
+static int
+comparator (const void *va, const void *vb)
+{
+  const char *a = *(const char* const*) va;
+  const char *b = *(const char* const*) vb;
+
+  while (*a && *b)
+    {
+      /* Make letters smaller than digits so that `atmega16a' follows
+         `atmega16' without `atmega161' etc. between them.  */
+      
+      if (ISALPHA (*a) && ISDIGIT (*b))
+        return -1;
+
+      if (ISDIGIT (*a) && ISALPHA (*b))
+        return 1;
+
+      if (*a != *b)
+        return *a - *b;
+      
+      a++;
+      b++;
+    }
+
+  return *a - *b;
+}
+
+
+static char*
+avr_archs_str (void)
+{
+  char *archs = concat ("", NULL);
+
+  // Build of core architectures' names.
+
+  for (const avr_mcu_t *mcu = avr_mcu_types; mcu->name; mcu++)
+    if (!mcu->macro)
+      archs = concat (archs, " ", avr_arch_types[mcu->arch_id].name, NULL);
+
+  return archs;
+}
+
+  
+static char*
+avr_mcus_str (void)
+{
+  size_t n_mcus = 0;
+  char *mcus = concat ("", NULL);
+
+  // Build array of proper devices' names.
+
+  for (const avr_mcu_t *mcu = avr_mcu_types; mcu->name; mcu++)
+    if (mcu->macro)
+      mcu_name[n_mcus++] = mcu->name;
+
+  // Sort MCUs so that they are displayed in the same canonical order as
+  // in doc/avr-mcus.texi.
+
+  qsort (mcu_name, n_mcus, sizeof (char*), comparator);
+
+  for (size_t i = 0; i < n_mcus; i++)
+    mcus = concat (mcus, " ", mcu_name[i], NULL);
+
+  return mcus;
+}
+
+
+void
+avr_inform_devices (void)
+{
+  char *mcus = avr_mcus_str ();
+  inform (input_location, "devices natively supported:%s", mcus);
+  free (mcus);
+}
+
+
+void
+avr_inform_core_architectures (void)
+{
+  char *archs = avr_archs_str ();
+  inform (input_location, "supported core architectures:%s", archs);
+  free (archs);
+}
+
+#endif // IN_GEN_AVR_MMCU_TEXI
Index: config/avr/avr-arch.h
===================================================================
--- config/avr/avr-arch.h	(revision 221140)
+++ config/avr/avr-arch.h	(working copy)
@@ -22,9 +22,11 @@ along with GCC; see the file COPYING3.
 #ifndef AVR_ARCH_H
 #define AVR_ARCH_H
 
+#define AVR_MMCU_DEFAULT "avr2"
+
 /* This enum supplies indices into the avr_arch_types[] table below. */
 
-enum avr_arch
+enum avr_arch_id
 {
   ARCH_UNKNOWN,
   ARCH_AVR1,
@@ -92,7 +94,7 @@ /* Architecture id to built-in define __
   const char *const macro;
 
   /* Architecture name.  */
-  const char *const arch_name;
+  const char *const name;
 } avr_arch_t;
 
 
@@ -104,7 +106,7 @@ typedef struct
   const char *const name;
 
   /* Index in avr_arch_types[].  */
-  enum avr_arch arch;
+  enum avr_arch_id arch_id;
 
   /* device specific feature */
   int dev_attribute;
@@ -166,7 +168,7 @@ enum avr_device_specific_features
 typedef struct
 {
   /* Architecture ID.  */
-  enum avr_arch arch;
+  enum avr_arch_id arch_id;
 
   /* textinfo source to describe the archtiecture.  */
   const char *texinfo;
@@ -175,9 +177,11 @@ typedef struct
 /* Preprocessor macros to define depending on MCU type.  */
 
 extern const avr_arch_t avr_arch_types[];
-extern const avr_arch_t *avr_current_arch;
+extern const avr_arch_t *avr_arch;
 
 extern const avr_mcu_t avr_mcu_types[];
-extern const avr_mcu_t *avr_current_device;
+
+extern void avr_inform_devices (void);
+extern void avr_inform_core_architectures (void);
 
 #endif /* AVR_ARCH_H */
Index: config/avr/avr-mcus.def
===================================================================
--- config/avr/avr-mcus.def	(revision 221140)
+++ config/avr/avr-mcus.def	(working copy)
@@ -24,11 +24,10 @@
    This will regenerate / update the following source files:
 
    -  $(srcdir)/config/avr/t-multilib
-   -  $(srcdir)/config/avr/avr-tables.opt
    -  $(srcdir)/doc/avr-mmcu.texi
 
    After that, rebuild everything and check-in the new sources to the repo.
-   The device list below has to be kept in sync with AVR-LibC.
+   The device list below should be kept in sync with AVR-LibC.
 
 
    Before including this file, define a macro:
@@ -53,8 +52,7 @@ supply respective built-in macro.
 
        N_FLASH       Number of 64 KiB flash segments, rounded up.
 
-       LIBRARY_NAME  Used by the driver to linke startup code from avr-libc
-                     as of  crt<LIBRARY_NAME>.o
+       LIBRARY_NAME  Used to define __AVR_DEV_LIB_NAME__.
 
    "avr2" must be first for the "0" default to work as intended.  */
 
Index: config/avr/genmultilib.awk
===================================================================
--- config/avr/genmultilib.awk	(revision 221140)
+++ config/avr/genmultilib.awk	(working copy)
@@ -97,7 +97,7 @@ BEGIN {
 	cores[n_cores] = core
 	n_cores++
 	tiny_stack[core] = 0
-	option[core] = "march=" core
+	option[core] = "mmcu=" core
 
 	next
     }
Index: config/avr/genopt.sh
===================================================================
--- config/avr/genopt.sh	(revision 221140)
+++ config/avr/genopt.sh	(working copy)
@@ -1,58 +0,0 @@
-#!/bin/sh
-# Generate avr-tables.opt from the list in avr-mcus.def.
-# Copyright (C) 2011-2015 Free Software Foundation, Inc.
-#
-# This file is part of GCC.
-#
-# GCC is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3, or (at your option)
-# any later version.
-#
-# GCC is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# 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/>.
-
-cat <<EOF
-; -*- buffer-read-only: t -*-
-; Generated automatically by genopt.sh from avr-mcus.def.
-
-; Copyright (C) 2011-2015 Free Software Foundation, Inc.
-;
-; This file is part of GCC.
-;
-; GCC is free software; you can redistribute it and/or modify it under
-; the terms of the GNU General Public License as published by the Free
-; Software Foundation; either version 3, or (at your option) any later
-; version.
-;
-; GCC is distributed in the hope that it will be useful, but WITHOUT ANY
-; WARRANTY; without even the implied warranty of MERCHANTABILITY or
-; FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-; for more details.
-;
-; 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/>.
-
-Enum
-Name(avr_arch) Type(enum avr_arch)
-Known MCU architectures:
-
-EOF
-
-awk -F'[(, 	]+' 'BEGIN {
-}
-/^AVR_MCU.*NULL/ {
-    name = $2
-    value = $3
-    gsub("\"", "", name)
-    print "EnumValue"
-    print "Enum(avr_arch) String(" name ") Value(" value ")"
-    print ""
-}' $1
Index: config/avr/avrlibc.h
===================================================================
--- config/avr/avrlibc.h	(revision 221141)
+++ config/avr/avrlibc.h	(working copy)
@@ -27,6 +27,18 @@ along with GCC; see the file COPYING3.
    
 */
 
+#undef  LIB_SPEC
+#define LIB_SPEC                                \
+  " -lc %(avrlibc_devicelib) "
+
+#undef  LIBGCC_SPEC
+#define LIBGCC_SPEC                             \
+  " -lgcc -lm "
+
+#undef  STARTFILE_SPEC
+#define STARTFILE_SPEC                          \
+  " %(avrlibc_startfile) "
+
 #undef  LINK_GCC_C_SEQUENCE_SPEC
 #define LINK_GCC_C_SEQUENCE_SPEC \
   "--start-group %G %L --end-group"
Index: config/avr/t-multilib
===================================================================
--- config/avr/t-multilib	(revision 221140)
+++ config/avr/t-multilib	(working copy)
@@ -21,21 +21,21 @@
 # along with GCC; see the file COPYING3.  If not see
 # <http://www.gnu.org/licenses/>.
 
-MULTILIB_OPTIONS = march=avr2/march=avr25/march=avr3/march=avr31/march=avr35/march=avr4/march=avr5/march=avr51/march=avr6/march=avrxmega2/march=avrxmega4/march=avrxmega5/march=avrxmega6/march=avrxmega7/march=avrtiny msp8
+MULTILIB_OPTIONS = mmcu=avr2/mmcu=avr25/mmcu=avr3/mmcu=avr31/mmcu=avr35/mmcu=avr4/mmcu=avr5/mmcu=avr51/mmcu=avr6/mmcu=avrxmega2/mmcu=avrxmega4/mmcu=avrxmega5/mmcu=avrxmega6/mmcu=avrxmega7/mmcu=avrtiny msp8
 
 MULTILIB_DIRNAMES =  avr2 avr25 avr3 avr31 avr35 avr4 avr5 avr51 avr6 avrxmega2 avrxmega4 avrxmega5 avrxmega6 avrxmega7 avrtiny tiny-stack avr25/tiny-stack
 
 MULTILIB_EXCEPTIONS = \
-	march=avr3/msp8 \
-	march=avr31/msp8 \
-	march=avr35/msp8 \
-	march=avr4/msp8 \
-	march=avr5/msp8 \
-	march=avr51/msp8 \
-	march=avr6/msp8 \
-	march=avrxmega2/msp8 \
-	march=avrxmega4/msp8 \
-	march=avrxmega5/msp8 \
-	march=avrxmega6/msp8 \
-	march=avrxmega7/msp8 \
-	march=avrtiny/msp8
+	mmcu=avr3/msp8 \
+	mmcu=avr31/msp8 \
+	mmcu=avr35/msp8 \
+	mmcu=avr4/msp8 \
+	mmcu=avr5/msp8 \
+	mmcu=avr51/msp8 \
+	mmcu=avr6/msp8 \
+	mmcu=avrxmega2/msp8 \
+	mmcu=avrxmega4/msp8 \
+	mmcu=avrxmega5/msp8 \
+	mmcu=avrxmega6/msp8 \
+	mmcu=avrxmega7/msp8 \
+	mmcu=avrtiny/msp8
Index: config/avr/predicates.md
===================================================================
--- config/avr/predicates.md	(revision 221140)
+++ config/avr/predicates.md	(working copy)
@@ -45,7 +45,7 @@ (define_predicate "stack_register_operan
 ;; Return true if OP is a valid address for lower half of I/O space.
 (define_special_predicate "low_io_address_operand"
   (ior (and (match_code "const_int")
-	    (match_test "IN_RANGE (INTVAL (op) - avr_current_arch->sfr_offset,
+	    (match_test "IN_RANGE (INTVAL (op) - avr_arch->sfr_offset,
 				   0, 0x20 - GET_MODE_SIZE (mode))"))
        (and (match_code "symbol_ref")
 	    (match_test "SYMBOL_REF_FLAGS (op) & SYMBOL_FLAG_IO_LOW"))))
@@ -53,13 +53,13 @@ (define_special_predicate "low_io_addres
 ;; Return true if OP is a valid address for high half of I/O space.
 (define_predicate "high_io_address_operand"
   (and (match_code "const_int")
-       (match_test "IN_RANGE (INTVAL (op) - avr_current_arch->sfr_offset,
+       (match_test "IN_RANGE (INTVAL (op) - avr_arch->sfr_offset,
                               0x20, 0x3F)")))
 
 ;; Return true if OP is a valid address of I/O space.
 (define_special_predicate "io_address_operand"
   (ior (and (match_code "const_int")
-	    (match_test "IN_RANGE (INTVAL (op) - avr_current_arch->sfr_offset,
+	    (match_test "IN_RANGE (INTVAL (op) - avr_arch->sfr_offset,
 				   0, 0x40 - GET_MODE_SIZE (mode))"))
        (and (match_code "symbol_ref")
 	    (match_test "SYMBOL_REF_FLAGS (op) & SYMBOL_FLAG_IO"))))
Index: config/avr/avr-c.c
===================================================================
--- config/avr/avr-c.c	(revision 221140)
+++ config/avr/avr-c.c	(working copy)
@@ -305,8 +305,11 @@ avr_cpu_cpp_builtins (struct cpp_reader
 
   builtin_define_std ("AVR");
 
-  if (avr_current_arch->macro)
-    cpp_define_formatted (pfile, "__AVR_ARCH__=%s", avr_current_arch->macro);
+  /* __AVR_DEVICE_NAME__ and  avr_mcu_types[].macro like __AVR_ATmega8__
+	 are defined by -D command option, see device-specs file.  */
+
+  if (avr_arch->macro)
+    cpp_define_formatted (pfile, "__AVR_ARCH__=%s", avr_arch->macro);
   if (AVR_HAVE_RAMPD)    cpp_define (pfile, "__AVR_HAVE_RAMPD__");
   if (AVR_HAVE_RAMPX)    cpp_define (pfile, "__AVR_HAVE_RAMPX__");
   if (AVR_HAVE_RAMPY)    cpp_define (pfile, "__AVR_HAVE_RAMPY__");
@@ -316,14 +319,14 @@ cpp_define_formatted (pfile, "__AVR_ARCH
   if (AVR_HAVE_MOVW)     cpp_define (pfile, "__AVR_HAVE_MOVW__");
   if (AVR_HAVE_LPMX)     cpp_define (pfile, "__AVR_HAVE_LPMX__");
 
-  if (avr_current_arch->asm_only)
+  if (avr_arch->asm_only)
     cpp_define (pfile, "__AVR_ASM_ONLY__");
   if (AVR_HAVE_MUL)
     {
       cpp_define (pfile, "__AVR_ENHANCED__");
       cpp_define (pfile, "__AVR_HAVE_MUL__");
     }
-  if (avr_current_arch->have_jmp_call)
+  if (avr_arch->have_jmp_call)
     {
       cpp_define (pfile, "__AVR_MEGA__");
       cpp_define (pfile, "__AVR_HAVE_JMP_CALL__");
@@ -347,7 +350,7 @@ start address.  This macro shall be used
       cpp_define (pfile, "__AVR_TINY_PM_BASE_ADDRESS__=0x4000");
     }
 
-  if (avr_current_arch->have_eijmp_eicall)
+  if (AVR_HAVE_EIJMP_EICALL)
     {
       cpp_define (pfile, "__AVR_HAVE_EIJMP_EICALL__");
       cpp_define (pfile, "__AVR_3_BYTE_PC__");
@@ -362,11 +365,10 @@ start address.  This macro shall be used
   else
     cpp_define (pfile, "__AVR_HAVE_16BIT_SP__");
 
-  if (avr_sp8)
-    cpp_define (pfile, "__AVR_SP8__");
-
   if (AVR_HAVE_SPH)
     cpp_define (pfile, "__AVR_HAVE_SPH__");
+  else
+    cpp_define (pfile, "__AVR_SP8__");
 
   if (TARGET_NO_INTERRUPTS)
     cpp_define (pfile, "__NO_INTERRUPTS__");
@@ -375,7 +377,7 @@ start address.  This macro shall be used
     {
       cpp_define (pfile, "__AVR_ERRATA_SKIP__");
 
-      if (avr_current_arch->have_jmp_call)
+      if (AVR_HAVE_JMP_CALL)
         cpp_define (pfile, "__AVR_ERRATA_SKIP_JMP_CALL__");
     }
 
@@ -383,7 +385,7 @@ start address.  This macro shall be used
     cpp_define (pfile, "__AVR_ISA_RMW__");
 
   cpp_define_formatted (pfile, "__AVR_SFR_OFFSET__=0x%x",
-                        avr_current_arch->sfr_offset);
+                        avr_arch->sfr_offset);
 
 #ifdef WITH_AVRLIBC
   cpp_define (pfile, "__WITH_AVRLIBC__");
Index: config/avr/avr.opt
===================================================================
--- config/avr/avr.opt	(revision 221140)
+++ config/avr/avr.opt	(working copy)
@@ -18,21 +18,14 @@
 ; along with GCC; see the file COPYING3.  If not see
 ; <http://www.gnu.org/licenses/>.
 
-HeaderInclude
-config/avr/avr-arch.h
-
 mcall-prologues
 Target Report Mask(CALL_PROLOGUES)
 Use subroutines for function prologues and epilogues
 
 mmcu=
-Target RejectNegative Joined
+Target RejectNegative Joined Var(avr_mmcu) MissingArgError(missing device or architecture after %qs)
 -mmcu=MCU	Select the target MCU
 
-march=
-Target RejectNegative Joined Var(avr_arch_index) Init(ARCH_AVR2) Enum(avr_arch)
--march=ARCH Select target architecture
-
 mn-flash=
 Target RejectNegative Joined Var(avr_n_flash) UInteger Init(-1)
 Set the number of 64 KiB flash segments
Index: config/avr/t-avr
===================================================================
--- config/avr/t-avr	(revision 221141)
+++ config/avr/t-avr	(working copy)
@@ -16,8 +16,14 @@
 # along with GCC; see the file COPYING3.  If not see
 # <http://www.gnu.org/licenses/>.
 
+driver-avr.o: $(srcdir)/config/avr/driver-avr.c \
+  $(CONFIG_H) $(SYSTEM_H) coretypes.h \
+  $(srcdir)/config/avr/avr-arch.h $(TM_H)
+	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $<
+
 avr-devices.o: $(srcdir)/config/avr/avr-devices.c \
   $(srcdir)/config/avr/avr-mcus.def \
+  $(srcdir)/config/avr/avr-arch.h \
   $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H)
 	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $<
 
@@ -49,15 +55,9 @@ AVR_MCUS = $(srcdir)/config/avr/avr-mcus
 .PHONY: avr-mcus
 
 avr-mcus: $(srcdir)/config/avr/t-multilib \
-	  $(srcdir)/config/avr/avr-tables.opt \
 	  $(srcdir)/doc/avr-mmcu.texi ; @true
 
-# Make sure that -mmcu= is supported for devices from avr-mcus.def and
-# all -mmcu= values are displayed on the help screen
-$(srcdir)/config/avr/avr-tables.opt: $(srcdir)/config/avr/genopt.sh $(AVR_MCUS)
-	$(SHELL) $< $(AVR_MCUS) > $@
-
-# Make sure that -mmcu= support is in sync with -mmcu= documentation.
+# Make sure that native -mmcu= support is in sync with -mmcu= documentation.
 gen-avr-mmcu-texi$(build_exeext): $(srcdir)/config/avr/gen-avr-mmcu-texi.c \
   $(AVR_MCUS) $(srcdir)/config/avr/avr-devices.c \
   $(srcdir)/config/avr/avr-arch.h
@@ -84,7 +84,7 @@ install-device-specs: s-device-specs ins
 	-rm -rf $(DESTDIR)$(libsubdir)/device-specs
 	mkdir $(DESTDIR)$(libsubdir)/device-specs
 	-for file in device-specs/*; do \
-	$(INSTALL_PROGRAM) $${file} $(DESTDIR)$(libsubdir)/$${file}; \
+		$(INSTALL_DATA) $${file} $(DESTDIR)$(libsubdir)/$${file}; \
 	done
 
 # Map -mmcu= to the right multilib variant
Index: config/avr/gen-avr-mmcu-specs.c
===================================================================
--- config/avr/gen-avr-mmcu-specs.c	(revision 221141)
+++ config/avr/gen-avr-mmcu-specs.c	(working copy)
@@ -23,20 +23,31 @@
 
 #define IN_GEN_AVR_MMCU_TEXI
 
-#include "avr-arch.h"
 #include "avr-devices.c"
 
+// Get rid of "defaults.h".  We just need tm.h for `WITH_AVRLIBS' and
+// and `WITH_RTEMS'.  */
 #define GCC_DEFAULTS_H
 
 #include "tm.h"
 
+// Mimic the include order as specified in config.gcc::tm_file.
+
+#include "specs.h"
+
 #if defined (WITH_AVRLIBC)
-static const bool with_avrlibc = true;
-#else
-static const bool with_avrlibc = false;
-#endif /* WITH_AVRLIBC */
+#include "avrlibc.h"
+#endif
+
+#if defined (WITH_RTEMS)
+#include "../rtems.h"
+#include "rtems.h"
+#endif
 
 
+#define SPECFILE_DOC_URL                                \
+  "http://gcc.gnu.org/onlinedocs/gcc/Spec-Files.html"
+
 /* Return true iff STR starts with PREFIX.  */
 
 static bool
@@ -46,17 +57,41 @@ str_prefix_p (const char *str, const cha
 }
 
 
+static const char header[] =
+  "#\n"
+  "# Generated by   : ./gcc/config/avr/gen-avr-mmcu-specs.c\n"
+  "# Generated from : ./gcc/config/gcc.c\n"
+  "#                  ./gcc/config/avr/specs.h\n"
+#if defined (WITH_RTEMS)
+  "#                  ./gcc/config/rtems.h\n"
+  "#                  ./gcc/config/avr/rtems.h\n"
+#endif
+#if defined (WITH_AVRLIBC)
+  "#                  ./gcc/config/avr/avrlibc.h\n"
+#endif
+  "# Used by        : avr-gcc compiler driver\n"
+  "# Used for       : building command options for sub-processes\n"
+  "#\n"
+  "# See <" SPECFILE_DOC_URL ">\n"
+  "# for a documentation of spec files.\n"
+  "\n";
+
+
 static void
 print_mcu (const avr_mcu_t *mcu)
 {
   const char *sp8_spec;
   const avr_mcu_t *arch_mcu;
+  const avr_arch_t *arch;
+  enum avr_arch_id arch_id = mcu->arch_id;
 
   for (arch_mcu = mcu; arch_mcu->macro; )
     arch_mcu--;
-  if (arch_mcu->arch != mcu->arch)
+  if (arch_mcu->arch_id != arch_id)
     exit (EXIT_FAILURE);
 
+  arch = &avr_arch_types[arch_id];
+
   char name[100];
   if (snprintf (name, sizeof name, "specs-%s", mcu->name) >= (int) sizeof name)
    exit (EXIT_FAILURE);
@@ -66,9 +101,12 @@ for (arch_mcu = mcu; arch_mcu->macro; )
   bool errata_skip = 0 != (mcu->dev_attribute & AVR_ERRATA_SKIP);
   bool rmw = 0 != (mcu->dev_attribute & AVR_ISA_RMW);
   bool sp8 = 0 != (mcu->dev_attribute & AVR_SHORT_SP);
+  bool is_arch = NULL == mcu->macro;
+  bool is_device = ! is_arch;
 
-  if (mcu->macro == NULL
-      && (mcu->arch == ARCH_AVR2 || mcu->arch == ARCH_AVR25))
+  if (is_arch
+      && (ARCH_AVR2 == arch_id
+          || ARCH_AVR25 == arch_id))
     {
       // Leave "avr2" and "avr25" alone.  These two architectures are
       // the only ones that mix devices with 8-bit SP and 16-bit SP.
@@ -76,97 +114,124 @@ if (mcu->macro == NULL
     }
   else
     {
-      sp8_spec = sp8
-        ? " -msp8"
-        : " %<msp8";
+      sp8_spec = sp8 ? "-msp8" :"%<msp8";
     }
 
-  const char *errata_skip_spec = errata_skip
-    ? " %{!mno-skip-bug:-mskip-bug}"
-    : " %{!mskip-bug:-mno-skip-bug}";
-
-  const char *rmw_spec = rmw
-    ? " %{!mno-rmw: -mrmw}"
-    : " %{mrmw}";
-
-  const char *arch_name = avr_arch_types[mcu->arch].arch_name;
-
-  fprintf (f, "*self_spec:\n"
-           " %%{!march=*:-march=%s}"
-           " %s\n\n", arch_name, sp8_spec);
-
-  if (mcu->macro)
-    fprintf (f, "*cpp:\n-D__AVR_DEV_LIB_NAME__=%s -D%s "
-	     "-D__AVR_DEVICE_NAME__=%s\n\n",
-	     mcu->library_name, mcu->macro, mcu->name);
+  fprintf (f, "#\n"
+           "# Auto-generated specs for AVR ");
+  if (is_arch)
+    fprintf (f, "core architecture %s\n", arch->name);
+  else
+    fprintf (f, "device %s (core %s, %d-bit SP)\n",
+             mcu->name, arch->name, sp8 ? 8 : 16);
+  fprintf (f, "%s\n", header);
+
+  // avrlibc-specific specs for linking / thelinker.
+
+  fprintf (f, "*avrlibc_startfile:\n");
+  if (is_device)
+    fprintf (f, "\tdev/%s/crt1.o%%s", mcu->name);
+  fprintf (f, "\n\n");
 
-  fprintf (f, "*cc1:\n%s%s", errata_skip_spec, rmw_spec);
-  if (mcu->n_flash != arch_mcu->n_flash)
-    fprintf (f, " %%{!mn-flash:-mn-flash=%d}", mcu->n_flash);
-  fprintf (f, "\n\n");
-
-  fprintf (f, "*cc1plus:\n%s%s ", errata_skip_spec, rmw_spec);
-  if (mcu->n_flash != arch_mcu->n_flash)
-    fprintf (f, " %%{!mn-flash:-mn-flash=%d}", mcu->n_flash);
-  fprintf (f, (" %%{!frtti: -fno-rtti}"
-               " %%{!fenforce-eh-specs: -fno-enforce-eh-specs}"
-               " %%{!fexceptions: -fno-exceptions}\n\n"));
-
-  fprintf (f, "*asm:\n"
-           " %%{march=*:-mmcu=%%*}"
-           " %%{mrelax: --mlink-relax}"
-           " %s%s\n\n", rmw_spec, (errata_skip
-                                  ? " %{mno-skip-bug}"
-                                  : " %{!mskip-bug:-mno-skip-bug}"));
-  fprintf (f, "*link:\n"
-           " %%{mrelax:--relax");
-  {
-    int wrap_k =
-      str_prefix_p (mcu->name, "at90usb8") ? 8
-      : str_prefix_p (mcu->name, "atmega16") ? 16
-      : (str_prefix_p (mcu->name, "atmega32")
-         || str_prefix_p (mcu->name, "at90can32")) ? 32
-      : (str_prefix_p (mcu->name, "atmega64")
-        || str_prefix_p (mcu->name, "at90can64")
-        || str_prefix_p (mcu->name, "at90usb64")) ? 64
-      : 0;
-
-    if (wrap_k)
-      fprintf (f, " %%{mpmem-wrap-around: --pmem-wrap-around=%dk}", wrap_k);
-  }
-  fprintf (f, "}"
-           " %%{march=*:-m%%*}");
+  fprintf (f, "*avrlibc_devicelib:\n");
+  if (is_device)
+    fprintf (f, "\tdev/%s/libdev.a%%s", mcu->name);
+  fprintf (f, "\n\n");
 
-  if (mcu->data_section_start
-      != avr_arch_types[mcu->arch].default_data_section_start)
-    fprintf (f, " -Tdata 0x%lX", 0x800000UL + mcu->data_section_start);
+  // avr-specific specs for the compilation / the compiler proper.
 
-  if (mcu->text_section_start != 0x0)
-    fprintf (f, " -Ttext 0x%lX", 0UL + mcu->text_section_start);
+  fprintf (f, "*cc1_n_flash:\n"
+           "\t%%{!mn-flash=*:-mn-flash=%d}\n\n", mcu->n_flash);
 
-  fprintf (f, " %%{shared:%%eshared is not supported}\n\n");
+  fprintf (f, "*cc1_rmw:\n%s\n\n", rmw
+           ? "\t%{!mno-rmw: -mrmw}"
+           : "\t%{mrmw}");
 
-  bool has_libs = mcu->arch != ARCH_AVR1;
+  fprintf (f, "*cc1_errata_skip:\n%s\n\n", errata_skip
+           ? "\t%{!mno-skip-bug: -mskip-bug}"
+           : "\t%{!mskip-bug: -mno-skip-bug}");
 
-  fprintf (f, "*lib:\n");
-  if (has_libs)
-    {
-      fprintf (f, "-lc");
-      if (with_avrlibc
-          && mcu->macro)
-	fprintf (f, " dev/%s/libdev.a%%s", mcu->name);
-    }
+  // avr-specific specs for assembling / the assembler.
+
+  fprintf (f, "*asm_arch:\n\t-mmcu=%s\n\n", arch->name);
+
+  fprintf (f, "*asm_relax:\n\t%s\n\n", ASM_RELAX_SPEC);
+
+  fprintf (f, "*asm_rmw:\n%s\n\n", rmw
+           ? "\t%{!mno-rmw: -mrmw}"
+           : "\t%{mrmw}");
+
+  fprintf (f, "*asm_errata_skip:\n%s\n\n", errata_skip
+           ? "\t%{mno-skip-bug}"
+           : "\t%{!mskip-bug: -mno-skip-bug}");
+
+  // avr-specific specs for linking / the linker.
+
+  int wrap_k =
+    str_prefix_p (mcu->name, "at90usb8") ? 8
+    : str_prefix_p (mcu->name, "atmega16") ? 16
+    : (str_prefix_p (mcu->name, "atmega32")
+       || str_prefix_p (mcu->name, "at90can32")) ? 32
+    : (str_prefix_p (mcu->name, "atmega64")
+       || str_prefix_p (mcu->name, "at90can64")
+       || str_prefix_p (mcu->name, "at90usb64")) ? 64
+    : 0;
+
+  fprintf (f, "*link_pmem_wrap:\n");
+  if (wrap_k)
+    fprintf (f, "\t%%{mpmem-wrap-around: --pmem-wrap-around=%dk}", wrap_k);
+  fprintf (f, "\n\n");
+
+  fprintf (f, "*link_relax:\n\t%s\n\n", LINK_RELAX_SPEC);
+
+  fprintf (f, "*link_arch:\n\t%s\n\n", LINK_ARCH_SPEC);
+
+  fprintf (f, "*link_data_start:\n");
+  if (mcu->data_section_start
+      != arch->default_data_section_start)
+    fprintf (f, "\t-Tdata 0x%lX", 0x800000UL + mcu->data_section_start);
+  fprintf (f, "\n\n");
+
+  fprintf (f, "*link_text_start:\n");
+  if (mcu->text_section_start != 0x0)
+    fprintf (f, "\t-Ttext 0x%lX", 0UL + mcu->text_section_start);
   fprintf (f, "\n\n");
 
-  fprintf (f, "*libgcc:\n");
-  if (has_libs)
-    fprintf (f, with_avrlibc
-             ? "-lgcc -lm"
-             : "-lgcc");
+  // Default specs.  Rewritten to the device-specific specs file so
+  // they can be adjusted as needed.
+     
+  bool has_libs = arch_id != ARCH_AVR1;
+
+  fprintf (f, "*self_spec:\n");
+  if (is_device)
+    fprintf (f, "\t%%{!mmcu=avr*: %%<mmcu=* -mmcu=%s} ", arch->name);
+  fprintf (f, "%s\n\n", sp8_spec);
+
+  fprintf (f, "*cpp:\n");
+  if (is_device)
+    fprintf (f,"\t-D__AVR_DEV_LIB_NAME__=%s"
+             " -D%s"
+	     " -D__AVR_DEVICE_NAME__=%s",
+	     mcu->library_name, mcu->macro, mcu->name);
   fprintf (f, "\n\n");
 
-  fprintf (f, "*startfile:\n"
-           "dev/%s/crt1.o%%s\n\n", mcu->name);
+  fprintf (f, "*cc1:\n\t%s\n\n", CC1_SPEC);
+
+  fprintf (f, "*cc1plus:\n\t%s\n\n", CC1PLUS_SPEC);
+
+  fprintf (f, "*asm:\n\t%s\n\n", ASM_SPEC);
+
+  fprintf (f, "*link:\n\t%s\n\n", LINK_SPEC);
+
+  fprintf (f, "*lib:\n\t%s\n\n", has_libs ? LIB_SPEC : "");
+
+  fprintf (f, "*libgcc:\n\t%s\n\n", has_libs ? LIBGCC_SPEC : "");
+
+  fprintf (f, "*startfile:\n\t%s\n\n", STARTFILE_SPEC);
+
+  fprintf (f, "*endfile:\n%s\n\n", ENDFILE_SPEC);
+
+  fprintf (f, "# End of file\n");
 }
 
 
Index: config/avr/avr-tables.opt
===================================================================
--- config/avr/avr-tables.opt	(revision 221140)
+++ config/avr/avr-tables.opt	(working copy)
@@ -1,73 +0,0 @@
-; -*- buffer-read-only: t -*-
-; Generated automatically by genopt.sh from avr-mcus.def.
-
-; Copyright (C) 2011-2015 Free Software Foundation, Inc.
-;
-; This file is part of GCC.
-;
-; GCC is free software; you can redistribute it and/or modify it under
-; the terms of the GNU General Public License as published by the Free
-; Software Foundation; either version 3, or (at your option) any later
-; version.
-;
-; GCC is distributed in the hope that it will be useful, but WITHOUT ANY
-; WARRANTY; without even the implied warranty of MERCHANTABILITY or
-; FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-; for more details.
-;
-; 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/>.
-
-Enum
-Name(avr_arch) Type(enum avr_arch)
-Known MCU architectures:
-
-EnumValue
-Enum(avr_arch) String(avr2) Value(ARCH_AVR2)
-
-EnumValue
-Enum(avr_arch) String(avr25) Value(ARCH_AVR25)
-
-EnumValue
-Enum(avr_arch) String(avr3) Value(ARCH_AVR3)
-
-EnumValue
-Enum(avr_arch) String(avr31) Value(ARCH_AVR31)
-
-EnumValue
-Enum(avr_arch) String(avr35) Value(ARCH_AVR35)
-
-EnumValue
-Enum(avr_arch) String(avr4) Value(ARCH_AVR4)
-
-EnumValue
-Enum(avr_arch) String(avr5) Value(ARCH_AVR5)
-
-EnumValue
-Enum(avr_arch) String(avr51) Value(ARCH_AVR51)
-
-EnumValue
-Enum(avr_arch) String(avr6) Value(ARCH_AVR6)
-
-EnumValue
-Enum(avr_arch) String(avrxmega2) Value(ARCH_AVRXMEGA2)
-
-EnumValue
-Enum(avr_arch) String(avrxmega4) Value(ARCH_AVRXMEGA4)
-
-EnumValue
-Enum(avr_arch) String(avrxmega5) Value(ARCH_AVRXMEGA5)
-
-EnumValue
-Enum(avr_arch) String(avrxmega6) Value(ARCH_AVRXMEGA6)
-
-EnumValue
-Enum(avr_arch) String(avrxmega7) Value(ARCH_AVRXMEGA7)
-
-EnumValue
-Enum(avr_arch) String(avrtiny) Value(ARCH_AVRTINY)
-
-EnumValue
-Enum(avr_arch) String(avr1) Value(ARCH_AVR1)
-
Index: config/avr/driver-avr.c
===================================================================
--- config/avr/driver-avr.c	(revision 0)
+++ config/avr/driver-avr.c	(revision 0)
@@ -0,0 +1,124 @@
+/* Subroutines for the gcc driver.
+   Copyright (C) 2009-2015 Free Software Foundation, Inc.
+   Contributed by Georg-Johann Lay <avr@gjlay.de>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+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/>.  */
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "diagnostic.h"
+#include "tm.h"
+
+static const char dir_separator_str[] = { DIR_SEPARATOR, 0 };
+
+static const char specfiles_doc_url[] =
+  "http://gcc.gnu.org/onlinedocs/gcc/Spec-Files.html";
+
+
+static const char*
+avr_diagnose_devicespecs_error (const char *mcu, const char *filename)
+{
+  error ("cannot access device-specs for %qs expected at %qs",
+         mcu, filename);
+
+  // Inform about natively supported devices and cores.
+
+  if (strncmp (mcu, "avr", strlen ("avr")))
+    avr_inform_devices ();
+
+  avr_inform_core_architectures ();
+
+  inform (input_location, "you can provide your own specs files, "
+          "see <%s> for details", specfiles_doc_url);
+
+  return "";
+}
+
+
+/* Implement spec function `device-specs-file´.
+
+   Compose -specs=<specs-file-name>.  If everything went well then argv[0]
+   is the inflated specs directory and argv[1] is a device or core name as
+   supplied to -mmcu=*.  */
+
+const char*
+avr_devicespecs_file (int argc, const char **argv)
+{
+  char *specfile_name;
+  const char *mmcu = NULL;
+
+#ifdef DEBUG_SPECS
+  if (verbose_flag)
+    fnotice (stderr, "Running spec function '%s' with %d args\n\n",
+             __FUNCTION__, argc);
+#endif
+
+  switch (argc)
+    {
+    case 0:
+      fatal_error (input_location,
+                   "bad usage of spec function %qs", "device-specs-file");
+      return "";
+
+    case 1:
+      mmcu = AVR_MMCU_DEFAULT;
+      break;
+
+    case 2:
+      mmcu = argv[1];
+      break;
+
+    default:
+      error ("specified option %qs more than once", "-mmcu=");
+      return "";
+    }
+
+  specfile_name = concat (argv[0], dir_separator_str, "specs-", mmcu, NULL);
+
+#ifdef DEBUG_SPECS
+  if (verbose_flag)
+    fnotice (stderr, "'%s': mmcu='%s'\n'%s': specfile='%s'\n\n",
+             __FUNCTION__, mmcu, __FUNCTION__, specfile_name);
+#endif
+
+  // Filter out silly -mmcu= arguments like "foo bar".
+
+  for (const char *s = mmcu; *s; s++)
+    if (!ISALNUM (*s)
+        && '-' != *s
+        && '_' != *s)
+      {
+        error ("strange device name %qs after %qs: bad character %qc",
+               mmcu, "-mmcu=", *s);
+        return "";
+      }
+
+  if (/* When building / configuring the compiler we might get a relative path
+         as supplied by "-B.".  Assume that the specs file exists and MCU is
+         a core, not a proper device then, i.e. we have "-mmcu=avr*".  */
+      (0 == strncmp (mmcu, "avr", strlen ("avr"))
+       && specfile_name[0] == '.')
+      /* vanilla */
+      || (IS_ABSOLUTE_PATH (specfile_name)
+          && !access (specfile_name, R_OK)))
+    {
+      return concat ("-specs=", specfile_name, NULL);
+    }
+
+  return avr_diagnose_devicespecs_error (mmcu, specfile_name);
+}
Index: config/avr/specs.h
===================================================================
--- config/avr/specs.h	(revision 0)
+++ config/avr/specs.h	(revision 0)
@@ -0,0 +1,77 @@
+/* Specs definitions for Atmel AVR back end.
+
+   Copyright (C) 2012-2015 Free Software Foundation, Inc.
+   Contributed by Georg-Johann Lay (avr@gjlay.de)
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+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/>.  */
+
+
+/* Default specs layout.  The actual definitions might be superseeded
+   by device- or OS- specific files, like avrlibc.h, ../rtems.h, etc.
+   The specs are repeated in the device specs files.  Subspecs are
+   specs known to GCC or specs defined in the device specs files.  */
+
+
+#undef  CPLUSPLUS_CPP_SPEC
+#define CPLUSPLUS_CPP_SPEC                      \
+  "%(cpp)"
+
+#undef  CC1_SPEC
+#define CC1_SPEC                                \
+  "%(cc1_n_flash) "                             \
+  "%(cc1_errata_skip) "                         \
+  "%(cc1_rmw) "
+
+#undef  CC1PLUS_SPEC
+#define CC1PLUS_SPEC                                    \
+  "%(cc1) "                                             \
+  "%{!frtti:-fno-rtti} "                                \
+  "%{!fenforce-eh-specs:-fno-enforce-eh-specs} "        \
+  "%{!fexceptions:-fno-exceptions} "
+
+#define ASM_RELAX_SPEC                          \
+  "%{mrelax:--mlink-relax} "
+
+#undef  ASM_SPEC
+#define ASM_SPEC                                \
+  "%(asm_arch) "                                \
+  "%(asm_relax) "                               \
+  "%(asm_rmw) "                                 \
+  "%(asm_errata_skip) "
+
+#define LINK_ARCH_SPEC                          \
+  "%{mmcu=*:-m%*} "
+
+#define LINK_RELAX_SPEC                         \
+  "%{mrelax:--relax %(link_pmem_wrap)} "
+
+#undef  LINK_SPEC
+#define LINK_SPEC                               \
+  "%(link_arch) "                               \
+  "%(link_data_start) "                         \
+  "%(link_text_start) "                         \
+  "%(link_relax) "                              \
+  "%{shared:%eshared is not supported} "
+
+#undef  LIB_SPEC
+#define LIB_SPEC " -lc "
+
+#undef  LIBGCC_SPEC
+#define LIBGCC_SPEC " -lgcc "
+
+#define STARTFILE_SPEC ""
+#define ENDFILE_SPEC ""
Index: config/avr/avr.c
===================================================================
--- config/avr/avr.c	(revision 221143)
+++ config/avr/avr.c	(working copy)
@@ -234,10 +234,7 @@ static GTY(()) rtx xstring_empty;
 static GTY(()) rtx xstring_e;
 
 /* Current architecture.  */
-const avr_arch_t *avr_current_arch;
-
-/* Current device.  */
-const avr_mcu_t *avr_current_device;
+const avr_arch_t *avr_arch;
 
 /* Section to put switch tables in.  */
 static GTY(()) section *progmem_swtable_section;
@@ -380,6 +377,49 @@ avr_register_passes (void)
 }
 
 
+/* Set `avr_arch' as specified by `-mmcu='.
+   Return true on success.  */
+
+static bool
+avr_set_core_architecture (void)
+{
+  /* Search for mcu core architecture.  */
+
+  if (!avr_mmcu)
+    avr_mmcu = AVR_MMCU_DEFAULT;
+
+  avr_arch = &avr_arch_types[0];
+
+  for (const avr_mcu_t *mcu = avr_mcu_types; ; mcu++)
+    {
+      if (NULL == mcu->name)
+        {
+          /* Reached the end of `avr_mcu_types'.  This should actually never
+             happen as options are provided by device-specs.  It could be a
+             typo in a device-specs or calling the compiler proper directly
+             with -mmcu=<device>. */
+
+          error ("unknown core architecture %qs specified with %qs",
+                 avr_mmcu, "-mmcu=");
+          avr_inform_core_architectures ();
+          break;
+        }
+      else if (0 == strcmp (mcu->name, avr_mmcu)
+               // Is this a proper architecture ? 
+               && NULL == mcu->macro)
+        {
+          avr_arch = &avr_arch_types[mcu->arch_id];
+          if (avr_n_flash < 0)
+            avr_n_flash = mcu->n_flash;
+
+          return true;
+        }
+    }
+
+  return false;
+}
+
+
 /* Implement `TARGET_OPTION_OVERRIDE'.  */
 
 static void
@@ -424,39 +464,24 @@ avr_option_override (void)
   if (flag_pie == 2)
     warning (OPT_fPIE, "-fPIE is not supported");
 
-  /* Search for mcu arch.
-     ??? We should probably just put the architecture-default device
-     settings in the architecture struct and remove any notion of a current
-     device from gcc.  */
-
-  for (avr_current_device = avr_mcu_types; ; avr_current_device++)
-    {
-      if (!avr_current_device->name)
-        fatal_error (input_location, "mcu not found");
-      if (!avr_current_device->macro
-          && avr_current_device->arch == avr_arch_index)
-        break;
-    }
-
-  avr_current_arch = &avr_arch_types[avr_arch_index];
-  if (avr_n_flash < 0)
-    avr_n_flash = avr_current_device->n_flash;
+  if (!avr_set_core_architecture())
+    return;
 
   /* RAM addresses of some SFRs common to all devices in respective arch. */
 
   /* SREG: Status Register containing flags like I (global IRQ) */
-  avr_addr.sreg = 0x3F + avr_current_arch->sfr_offset;
+  avr_addr.sreg = 0x3F + avr_arch->sfr_offset;
 
   /* RAMPZ: Address' high part when loading via ELPM */
-  avr_addr.rampz = 0x3B + avr_current_arch->sfr_offset;
+  avr_addr.rampz = 0x3B + avr_arch->sfr_offset;
 
-  avr_addr.rampy = 0x3A + avr_current_arch->sfr_offset;
-  avr_addr.rampx = 0x39 + avr_current_arch->sfr_offset;
-  avr_addr.rampd = 0x38 + avr_current_arch->sfr_offset;
-  avr_addr.ccp = (AVR_TINY ? 0x3C : 0x34) + avr_current_arch->sfr_offset;
+  avr_addr.rampy = 0x3A + avr_arch->sfr_offset;
+  avr_addr.rampx = 0x39 + avr_arch->sfr_offset;
+  avr_addr.rampd = 0x38 + avr_arch->sfr_offset;
+  avr_addr.ccp = (AVR_TINY ? 0x3C : 0x34) + avr_arch->sfr_offset;
 
   /* SP: Stack Pointer (SP_H:SP_L) */
-  avr_addr.sp_l = 0x3D + avr_current_arch->sfr_offset;
+  avr_addr.sp_l = 0x3D + avr_arch->sfr_offset;
   avr_addr.sp_h = avr_addr.sp_l + 1;
 
   init_machine_status = avr_init_machine_status;
@@ -2328,7 +2353,7 @@ avr_print_operand (FILE *file, rtx x, in
           else
             {
               fprintf (file, HOST_WIDE_INT_PRINT_HEX,
-                       ival - avr_current_arch->sfr_offset);
+                       ival - avr_arch->sfr_offset);
             }
         }
       else
@@ -2396,7 +2421,7 @@ avr_print_operand (FILE *file, rtx x, in
     {
       if (GET_CODE (x) == SYMBOL_REF && (SYMBOL_REF_FLAGS (x) & SYMBOL_FLAG_IO))
 	avr_print_operand_address
-	  (file, plus_constant (HImode, x, -avr_current_arch->sfr_offset));
+	  (file, plus_constant (HImode, x, -avr_arch->sfr_offset));
       else
 	fatal_insn ("bad address, not an I/O address:", x);
     }
@@ -9246,12 +9271,11 @@ avr_pgm_check_var_decl (tree node)
       if (avr_addrspace[as].segment >= avr_n_flash)
         {
           if (TYPE_P (node))
-            error ("%qT uses address space %qs beyond flash of %qs",
-                   node, avr_addrspace[as].name, avr_current_device->name);
+            error ("%qT uses address space %qs beyond flash of %d KiB",
+                   node, avr_addrspace[as].name, avr_n_flash);
           else
-            error ("%s %q+D uses address space %qs beyond flash of %qs",
-                   reason, node, avr_addrspace[as].name,
-                   avr_current_device->name);
+            error ("%s %q+D uses address space %qs beyond flash of %d KiB",
+                   reason, node, avr_addrspace[as].name, avr_n_flash);
         }
       else
         {
@@ -9297,15 +9321,14 @@ avr_insert_attributes (tree node, tree *
 
       if (avr_addrspace[as].segment >= avr_n_flash)
         {
-          error ("variable %q+D located in address space %qs"
-                 " beyond flash of %qs",
-                 node, avr_addrspace[as].name, avr_current_device->name);
+          error ("variable %q+D located in address space %qs beyond flash "
+                 "of %d KiB", node, avr_addrspace[as].name, avr_n_flash);
         }
       else if (!AVR_HAVE_LPM && avr_addrspace[as].pointer_size > 2)
 	{
           error ("variable %q+D located in address space %qs"
-                 " which is not supported by %qs",
-                 node, avr_addrspace[as].name, avr_current_arch->arch_name);
+                 " which is not supported for architecture %qs",
+                 node, avr_addrspace[as].name, avr_arch->name);
 	}
 
       if (!TYPE_READONLY (node0)
@@ -9723,10 +9746,10 @@ avr_asm_select_section (tree decl, int r
 static void
 avr_file_start (void)
 {
-  int sfr_offset = avr_current_arch->sfr_offset;
+  int sfr_offset = avr_arch->sfr_offset;
 
-  if (avr_current_arch->asm_only)
-    error ("MCU %qs supported for assembler only", avr_current_device->name);
+  if (avr_arch->asm_only)
+    error ("architecture %qs supported for assembler only", avr_mmcu);
 
   default_file_start ();
 
Index: config/avr/avr.h
===================================================================
--- config/avr/avr.h	(revision 221141)
+++ config/avr/avr.h	(working copy)
@@ -60,19 +60,19 @@ enum
 
 #define TARGET_CPU_CPP_BUILTINS()	avr_cpu_cpp_builtins (pfile)
 
-#define AVR_HAVE_JMP_CALL (avr_current_arch->have_jmp_call)
-#define AVR_HAVE_MUL (avr_current_arch->have_mul)
-#define AVR_HAVE_MOVW (avr_current_arch->have_movw_lpmx)
+#define AVR_HAVE_JMP_CALL (avr_arch->have_jmp_call)
+#define AVR_HAVE_MUL (avr_arch->have_mul)
+#define AVR_HAVE_MOVW (avr_arch->have_movw_lpmx)
 #define AVR_HAVE_LPM (!AVR_TINY)
-#define AVR_HAVE_LPMX (avr_current_arch->have_movw_lpmx)
-#define AVR_HAVE_ELPM (avr_current_arch->have_elpm)
-#define AVR_HAVE_ELPMX (avr_current_arch->have_elpmx)
-#define AVR_HAVE_RAMPD (avr_current_arch->have_rampd)
-#define AVR_HAVE_RAMPX (avr_current_arch->have_rampd)
-#define AVR_HAVE_RAMPY (avr_current_arch->have_rampd)
-#define AVR_HAVE_RAMPZ (avr_current_arch->have_elpm             \
-                        || avr_current_arch->have_rampd)
-#define AVR_HAVE_EIJMP_EICALL (avr_current_arch->have_eijmp_eicall)
+#define AVR_HAVE_LPMX (avr_arch->have_movw_lpmx)
+#define AVR_HAVE_ELPM (avr_arch->have_elpm)
+#define AVR_HAVE_ELPMX (avr_arch->have_elpmx)
+#define AVR_HAVE_RAMPD (avr_arch->have_rampd)
+#define AVR_HAVE_RAMPX (avr_arch->have_rampd)
+#define AVR_HAVE_RAMPY (avr_arch->have_rampd)
+#define AVR_HAVE_RAMPZ (avr_arch->have_elpm             \
+                        || avr_arch->have_rampd)
+#define AVR_HAVE_EIJMP_EICALL (avr_arch->have_eijmp_eicall)
 
 /* Handling of 8-bit SP versus 16-bit SP is as follows:
 
@@ -90,17 +90,16 @@ These two properties are reflected by bu
    __AVR_HAVE_8BIT_SP__ and __AVR_HAVE_16BIT_SP__.  During multilib generation
    there is always __AVR_SP8__ == __AVR_HAVE_8BIT_SP__.  */
 
-#define AVR_HAVE_8BIT_SP                                 \
-  ((avr_current_device->dev_attribute & AVR_SHORT_SP)    \
-   || TARGET_TINY_STACK || avr_sp8)
+#define AVR_HAVE_8BIT_SP                        \
+  (TARGET_TINY_STACK || avr_sp8)
 
 #define AVR_HAVE_SPH (!avr_sp8)
 
 #define AVR_2_BYTE_PC (!AVR_HAVE_EIJMP_EICALL)
 #define AVR_3_BYTE_PC (AVR_HAVE_EIJMP_EICALL)
 
-#define AVR_XMEGA (avr_current_arch->xmega_p)
-#define AVR_TINY  (avr_current_arch->tiny_p)
+#define AVR_XMEGA (avr_arch->xmega_p)
+#define AVR_TINY  (avr_arch->tiny_p)
 
 #define BITS_BIG_ENDIAN 0
 #define BYTES_BIG_ENDIAN 0
@@ -492,25 +491,24 @@ typedef struct avr_args
 #define ADJUST_INSN_LENGTH(INSN, LENGTH)                \
     (LENGTH = avr_adjust_insn_length (INSN, LENGTH))
 
-#define DRIVER_SELF_SPECS                                       \
-  " %{!mmcu=*:%{!march=*:-specs=device-specs/specs-avr2%s} "    \
-  "           %{march=*:-specs=device-specs/specs-%*%s}} "      \
-  " %{mmcu=*:-specs=device-specs/specs-%*%s %<mmcu=*} "
-
-/* We want cc1plus used as a preprocessor to pick up the cpp spec from the
-   per-device spec files  */
-#define CPLUSPLUS_CPP_SPEC "%(cpp)"
+extern const char *avr_devicespecs_file (int, const char**);
 
-#define LIBSTDCXX "gcc"
-/* No libstdc++ for now.  Empty string doesn't work.  */
+#define EXTRA_SPEC_FUNCTIONS                                   \
+  { "device-specs-file", avr_devicespecs_file },
 
-/* The actual definition will come from the device-specific spec file.  */
-#define STARTFILE_SPEC ""
+/* Driver self specs has lmited functionality w.r.t. '%s' for dynamic specs.
+   Apply '%s' to a static string to inflate the file (directory) name which
+   is used to diagnose problems with reading the specs file.  */
+
+#undef  DRIVER_SELF_SPECS
+#define DRIVER_SELF_SPECS                       \
+  " %:device-specs-file(device-specs%s %{mmcu=*:%*})"
 
-#define ENDFILE_SPEC ""
+/* No libstdc++ for now.  Empty string doesn't work.  */
+#define LIBSTDCXX "gcc"
 
-/* This is the default without any -mmcu=* option (AT90S*).  */
-#define MULTILIB_DEFAULTS { "mmcu=avr2" }
+/* This is the default without any -mmcu=* option.  */
+#define MULTILIB_DEFAULTS { "mmcu=" AVR_MMCU_DEFAULT }
 
 #define TEST_HARD_REG_CLASS(CLASS, REGNO) \
   TEST_HARD_REG_BIT (reg_class_contents[ (int) (CLASS)], REGNO)

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [patch,avr]: Fix various problems with specs and specs file generation.
  2015-03-03 13:20 ` Senthil Kumar Selvaraj
  2015-03-09 16:03   ` [patch,avr]: Part2: " Georg-Johann Lay
@ 2015-03-09 16:21   ` Georg-Johann Lay
  1 sibling, 0 replies; 23+ messages in thread
From: Georg-Johann Lay @ 2015-03-09 16:21 UTC (permalink / raw)
  To: Senthil Kumar Selvaraj
  Cc: Denis Chertykov, GCC Patches, Joerg Wunsch, Joern Rennecke

Am 03/03/2015 um 02:21 PM schrieb Senthil Kumar Selvaraj:
> On Mon, Mar 02, 2015 at 08:40:17PM +0100, Georg-Johann Lay wrote:
>> BTW, anyone knows what -march= is good for?  It allows all kinds of silly
>> option combinations like "-march=avrtiny -mmcu=atmega8" without any
>> complaints.
>
> IIRC, -march was added because replacing -mmcu=<device> to
> -mmcu=<arch> in the driver's self specs broke multilib selection - the
> driver always acted as if no -mmcu was specified. Adding
> a new option (-march), translating mmcu=<device> to march=<arch> and then
> basing t-multilib on that worked ok.

Okay.  For me it works with -mmcu=, cf. the follow-up patch 
https://gcc.gnu.org/ml/gcc-patches/2015-03/msg00477.html

Two more questions

1)
What is the new macro __AVR_DEV_LIB_NAME__ for?
It uses avr_mcu_t.library_name.  This field contained a part of the crt.o file 
name like "m8" for atmega8's crtm8.o.

The new naming convention is that device libs are located in 
dev/atmega8/libdev.a and startup in dev/atmega8/crt1.o.

The current definition of __AVR_DEV_LIB_NAME__ should be "atmega8" and not 
"m8", hence always that same as __AVR_DEVICE_NAME__.

This macro is not documented in the documentation and useless.  If it is not 
needed and the .library_name field is dead, I'd propose to clean up both.

2)
What about -mpmem-wrap-around resp. ld's --pmem-wrap-around= ?
The wrap around moduli are currently hard coded in specs and just cover a few, 
very old devices.  Presumably that is option-rot?

Does relaxation still need that option to operate correctly?  If not, I'd clean 
that up, too

Johann

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [patch,avr]: Part2: Fix various problems with specs and specs file generation.
  2015-03-09 16:03   ` [patch,avr]: Part2: " Georg-Johann Lay
@ 2015-03-09 20:00     ` Denis Chertykov
  2015-03-10 15:02       ` [patch,avr]: Part3 and 4: " Georg-Johann Lay
  2015-04-06  9:54     ` [patch,avr]: Part2: " Sivanupandi, Pitchumani
  1 sibling, 1 reply; 23+ messages in thread
From: Denis Chertykov @ 2015-03-09 20:00 UTC (permalink / raw)
  To: Georg-Johann Lay
  Cc: Senthil Kumar Selvaraj, GCC Patches, Joerg Wunsch, Joern Rennecke

2015-03-09 19:02 GMT+03:00 Georg-Johann Lay <avr@gjlay.de>:
> Am 03/03/2015 um 02:21 PM schrieb Senthil Kumar Selvaraj:
>>
>> On Mon, Mar 02, 2015 at 08:40:17PM +0100, Georg-Johann Lay wrote:
>>>
>>> The new specs file generation introduces several problems.  This patch
>>>
>>> - Fix build warnings
>>>
>>> - Clean up unused code and the old, now dead specs definitions.
>>>
>>> - Removes unused files and adjust build scripts / rules.
>>>
>>> - Issues with avr-libc awareness:
>>>
>>> -- Makes specs-generation aware of avr-libc (include tm.h in build script
>>> and depend on WITH_AVRLIBC).
>>>
>>> -- avr-libc implements functions in libm.a which usually live in libgcc,
>>> hence add -lm to libgcc_spec, cf. PR54461.
>>>
>>> -- The new libdev.a is a feature of avr-libc and not available with,
>>> e.g.,
>>> newlib.  Hence remove it from lib_spec if the compiler is not configured
>>> for
>>> avr-libc (--with-avrlibc=no).
>>>
>>> - Many minor issues with option propagation.
>>>
>>> - -march had been added to multilib generation some time ago, but
>>> driver_self_spec was not aware of that option.
>>>
>>>
>>> Ok for trunk?
>>>
>>>
>>> BTW, anyone knows what -march= is good for?  It allows all kinds of silly
>>> option combinations like "-march=avrtiny -mmcu=atmega8" without any
>>> complaints.
>>
>>
>> IIRC, -march was added because replacing -mmcu=<device> to
>> -mmcu=<arch> in the driver's self specs broke multilib selection - the
>> driver always acted as if no -mmcu was specified. Adding
>
>
> For me both multilib selection and multilib generation are working as
> expected with -mmcu= and without that -march=.
>
> Attached is a 2nd part of improvements for the specs file generation:
>
> - Remove -arch= and use -mmcu= again.
>
> - Wrap specs file selection into a new specs function so that a
> comprehensible error message can be issued if no specs file is found.  It
> also informs about a link to spec file documentation of gcc inline docs.
>
> - Remove genopt.sh and avr-tables.opt.  These files are no more used because
> -mmcu= is a vanilla string option now.  Using Enum option for -mmcu= does
> not allow to specify unknown devices, and target_handle_option cannot
> letgigimize unknown strings of Enum options.
>
> - Resurrect driver-avr.c but with new content: The new specs function.
>
> - New file specs.h with specs known to gcc and which can be overridden by
> avrlibc.h, rtems.h, etc.
>
> - New device-specs files mostly repeat spec definitions, e.g.
>
>     fprintf (f, "*startfile:\n\t%s\n\n", STARTFILE_SPEC);
>     fprintf (f, "*endfile:\n\t%s\n\n", ENDFILE_SPEC);
>
> - Device feature are expressed as subspecs now, e.g. avrlibc_startfile spec.
>
> - Clean up code from "current device" stuff, adjust diagnostics, avr-arch.h,
> etc.
>
> - Use INSTALL_DATA to install spec files, not INSTALL_PROGRAM.
>
>
>
> Ok to install this, too?
>
>
> Johann
>
>         PR target/65296
>         * config.gcc (extra_options) [avr]: Remove.
>         (extra_gcc_objs) [avr]: Use driver-avr.o, avr-devices.o.
>         (tm_file) [avr]: Add avr/specs.h after avr/avr.h.
>         (tm_defines) [avr, rtems]: Add WITH_RTEMS.
>
>         * config/avr/genmultilib.awk: Use -mmcu= instead of -march=.
>         * config/avr/t-multilib: Regenerate.
>         * config/avr/specs.h: New file.
>         * config/avr/driver-avr.c: New file.
>         * config/avr/genopt.sh: Remove file.
>         * config/avr/avr-tables.opt: Remove file.
>         * config/avr/predicates.md (avr_current_arch): Rename to avr_arch.
>         * config/avr/avr-c.c: Same.
>         * avr-arch.h: Same.
>         (avr_current_device): Remove proto.
>         * config/avr/avr.c (avr_current_arch): Rename to avr_arch.
>         (avr_current_device): Remove definition and usage.
>         (avr_set_core_architecture): New static function.
>         (avr_option_override): Use it.
>         * config/avr/avr.h (avr_current_arch): Rename to avr_arch.
>         (AVR_HAVE_8BIT_SP): Don't depend on avr_current_device.
>         (EXTRA_SPEC_FUNCTIONS): Define.
>         (avr_devicespecs_file): New specs function proto.
>         (DRIVER_SELF_SPECS): Use device-specs-file spec function.
>         * config/avr/avr-devices.c (diagnostic.h, avr-arch.h): Include them.
>         (mcu_name): New static array.
>         (comparator, avr_archs_str, avr_mcus_str): New static functions.
>         (avr_inform_devices, avr_inform_core_architectures): New functions.
>         * config/avr/gen-avr-mmcu-specs.c (avr-arch.h, specs.h): Include.
>         (avrlibc.h) [WITH_AVRLIBC]: Include.
>         (../rtems.h, rtems.h) [WITH_RTEMS]: Include.
>         (print_mcu): Rewrite from scratch.
>         * config/avr/avrlibc.h (LIB_SPEC, LIBGCC_SPEC, STARTFILE_SPEC):
>         Forward to avr-specific specs defined in device-specs file.
>         * config/avr/avr.opt (config/avr/avr-arch.h): Remove include.
>         (-mmcu=): Add Var and MissingArgError properties.
>         (-march=): Remove.
>         * config/avr/t-avr (driver-avr.o): New rule.
>         (avr-devices.o): Depend on avr-arch.h.
>         (avr-mcus): No more depend on avr-tables.opt.
>         (avr-tables.opt): Remove rule.
>         (install-device-specs): Use INSTALL_DATA, not INSTALL_PROGRAM.
>

Please, apply.

Denis.

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [patch,avr]: Part3 and 4: Fix various problems with specs and specs file generation.
  2015-03-09 20:00     ` Denis Chertykov
@ 2015-03-10 15:02       ` Georg-Johann Lay
  2015-03-11 18:18         ` Denis Chertykov
  0 siblings, 1 reply; 23+ messages in thread
From: Georg-Johann Lay @ 2015-03-10 15:02 UTC (permalink / raw)
  To: Denis Chertykov; +Cc: Senthil Kumar Selvaraj, GCC Patches, Joerg Wunsch

[-- Attachment #1: Type: text/plain, Size: 2028 bytes --]

This is just a small addendum to the option and specs handling:

- Document new avr-gcc command options

- Change -march= to -mmcu= in some test cases

- Add comfigure test to detect whether gas supports -mrmw and --mlink-relax.

- Use result of these tests in specs generatio, i.e. omit respective options if 
they are not supported.


Ok to apply?


Two issues remain:

- The tests that add -mmcu= to the command options will fail because there must 
not be more than one -mmcu=.  Supporting several, incompatible MCUs makes no 
sense (same for incompatible -march + -mmcu which was the case).  In 4.9 this 
works per accident with unspecified definitions for built-in macros or when the 
options differ in default settings, for example.

- Spaces in the installation path are not supported.  It's possible to recover 
from spaces in -specs= by escaping them in spec function device-specs-file. 
However this is almost impossible for the device library without changing gcc.c 
which can use convert_white_space() as needed.  Adding more than one escape 
level is not possible because the '\' would be interpreted as part of the path.


Johann


gcc/
	PR target/65296
	* configure.ac [avr]: Check as for options -mrmw, --mlink-relax.
	* configure: Regenerate.
	* config.in: Regenerate.
	* config/avr/gen-avr-mmcu-specs.c (config.h): Include it.
	(*asm_relax): Only define spec if HAVE_AS_AVR_MLINK_RELAX_OPTION.
	(*asm_rmw): Only define spec if HAVE_AS_AVR_MRMW_OPTION.


gcc/
	PR target/65296
	* doc/invoke.texi (AVR Options) [-mrmw]: Document it.
	[-mn-flash]: Document it.
	[__AVR_DEVICE_NAME__]: Document it.
	[__ARV_ARCH__]: Document avrtiny.

gcc/testsuite/
	PR target/65296
	* gcc.target/avr/tiny-memx: Use -mmcu instead of -march.
	* gcc.target/avr/tiny-caller-save.c: Same.


gcc/
	PR target/65296
	* configure.ac [avr]: Check as for option -mrmw.
	* configure: Regenerate.
	* config.in: Regenerate.
	* config/avr/driver-avr.c (avr_device_to_as): Don't add -mrmw to
	assembler options if not HAVE_AS_AVR_MRMW_OPTION.


[-- Attachment #2: pr65296-part3.diff --]
[-- Type: text/x-patch, Size: 4812 bytes --]

Index: configure.ac
===================================================================
--- configure.ac	(revision 221318)
+++ configure.ac	(working copy)
@@ -3623,6 +3623,18 @@ [	.set nomacro
   [Define if your assembler supports the lituse_jsrdirect relocation.])])
     ;;
 
+  avr-*-*)
+    gcc_GAS_CHECK_FEATURE([--mlink-relax option], gcc_cv_as_avr_mlink_relax,,
+      [--mlink-relax], [.text],,
+      [AC_DEFINE(HAVE_AS_AVR_MLINK_RELAX_OPTION, 1,
+		[Define if your assembler supports --mlink-relax option.])])
+
+    gcc_GAS_CHECK_FEATURE([-mrmw option], gcc_cv_as_avr_mrmw,,
+      [-mrmw], [.text],,
+      [AC_DEFINE(HAVE_AS_AVR_MRMW_OPTION, 1,
+		[Define if your assembler supports -mrmw option.])])
+    ;;
+
   cris-*-*)
     gcc_GAS_CHECK_FEATURE([-no-mul-bug-abort option],
       gcc_cv_as_cris_no_mul_bug,[2,15,91],
Index: configure
===================================================================
--- configure	(revision 221318)
+++ configure	(working copy)
@@ -24185,6 +24185,70 @@ $as_echo "#define HAVE_AS_JSRDIRECT_RELO
 fi
     ;;
 
+  avr-*-*)
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for --mlink-relax option" >&5
+$as_echo_n "checking assembler for --mlink-relax option... " >&6; }
+if test "${gcc_cv_as_avr_mlink_relax+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  gcc_cv_as_avr_mlink_relax=no
+  if test x$gcc_cv_as != x; then
+    $as_echo '.text' > conftest.s
+    if { ac_try='$gcc_cv_as $gcc_cv_as_flags --mlink-relax -o conftest.o conftest.s >&5'
+  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }
+    then
+	gcc_cv_as_avr_mlink_relax=yes
+    else
+      echo "configure: failed program was" >&5
+      cat conftest.s >&5
+    fi
+    rm -f conftest.o conftest.s
+  fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_as_avr_mlink_relax" >&5
+$as_echo "$gcc_cv_as_avr_mlink_relax" >&6; }
+if test $gcc_cv_as_avr_mlink_relax = yes; then
+
+$as_echo "#define HAVE_AS_AVR_MLINK_RELAX_OPTION 1" >>confdefs.h
+
+fi
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for -mrmw option" >&5
+$as_echo_n "checking assembler for -mrmw option... " >&6; }
+if test "${gcc_cv_as_avr_mrmw+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  gcc_cv_as_avr_mrmw=no
+  if test x$gcc_cv_as != x; then
+    $as_echo '.text' > conftest.s
+    if { ac_try='$gcc_cv_as $gcc_cv_as_flags -mrmw -o conftest.o conftest.s >&5'
+  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }
+    then
+	gcc_cv_as_avr_mrmw=yes
+    else
+      echo "configure: failed program was" >&5
+      cat conftest.s >&5
+    fi
+    rm -f conftest.o conftest.s
+  fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_as_avr_mrmw" >&5
+$as_echo "$gcc_cv_as_avr_mrmw" >&6; }
+if test $gcc_cv_as_avr_mrmw = yes; then
+
+$as_echo "#define HAVE_AS_AVR_MRMW_OPTION 1" >>confdefs.h
+
+fi
+    ;;
+
   cris-*-*)
     { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for -no-mul-bug-abort option" >&5
 $as_echo_n "checking assembler for -no-mul-bug-abort option... " >&6; }
Index: config.in
===================================================================
--- config.in	(revision 221321)
+++ config.in	(working copy)
@@ -247,6 +247,18 @@ that are supported for each access macro
 #endif
 
 
+/* Define if your assembler supports --mlink-relax option. */
+#ifndef USED_FOR_TARGET
+#undef HAVE_AS_AVR_MLINK_RELAX_OPTION
+#endif
+
+
+/* Define if your assembler supports -mrmw option. */
+#ifndef USED_FOR_TARGET
+#undef HAVE_AS_AVR_MRMW_OPTION
+#endif
+
+
 /* Define if your assembler supports cmpb. */
 #ifndef USED_FOR_TARGET
 #undef HAVE_AS_CMPB
Index: config/avr/gen-avr-mmcu-specs.c
===================================================================
--- config/avr/gen-avr-mmcu-specs.c	(revision 221316)
+++ config/avr/gen-avr-mmcu-specs.c	(working copy)
@@ -21,6 +21,8 @@
 #include <stdio.h>
 #include <string.h>
 
+#include "config.h"
+
 #define IN_GEN_AVR_MMCU_TEXI
 
 #include "avr-devices.c"
@@ -155,11 +157,15 @@ bool is_arch = NULL == mcu->macro;
 
   fprintf (f, "*asm_arch:\n\t-mmcu=%s\n\n", arch->name);
 
+#ifdef HAVE_AS_AVR_MLINK_RELAX_OPTION                   \
   fprintf (f, "*asm_relax:\n\t%s\n\n", ASM_RELAX_SPEC);
+#endif // have as --mlink-relax
 
+#ifdef HAVE_AS_AVR_MRMW_OPTION
   fprintf (f, "*asm_rmw:\n%s\n\n", rmw
            ? "\t%{!mno-rmw: -mrmw}"
            : "\t%{mrmw}");
+#endif // have as -mrmw
 
   fprintf (f, "*asm_errata_skip:\n%s\n\n", errata_skip
            ? "\t%{mno-skip-bug}"

[-- Attachment #3: pr65296-part4.diff --]
[-- Type: text/x-patch, Size: 4993 bytes --]

Index: doc/invoke.texi
===================================================================
--- doc/invoke.texi	(revision 221324)
+++ doc/invoke.texi	(working copy)
@@ -571,8 +571,8 @@ -remap -trigraphs  -undef  -U@var{macro}
 
 @emph{AVR Options}
 @gccoptlist{-mmcu=@var{mcu} -maccumulate-args -mbranch-cost=@var{cost} @gol
--mcall-prologues -mint8 -mno-interrupts -mrelax @gol
--mstrict-X -mtiny-stack -Waddr-space-convert}
+-mcall-prologues -mint8 -mn_flash=@var{size} -mno-interrupts @gol
+-mrelax -mrmw -mstrict-X -mtiny-stack -Waddr-space-convert}
 
 @emph{Blackfin Options}
 @gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} @gol
@@ -13509,6 +13509,11 @@ and @code{long long} is 4 bytes.  Please
 conform to the C standards, but it results in smaller code
 size.
 
+@item -mn-flash=@var{num}
+@opindex mn-flash
+Assume that the flash memory has a size of 
+@var{num} times 64@tie{}KiB.
+
 @item -mno-interrupts
 @opindex mno-interrupts
 Generated code is not compatible with hardware interrupts.
@@ -13518,8 +13523,9 @@ Code size is smaller.
 @opindex mrelax
 Try to replace @code{CALL} resp.@: @code{JMP} instruction by the shorter
 @code{RCALL} resp.@: @code{RJMP} instruction if applicable.
-Setting @option{-mrelax} just adds the @option{--relax} option to the
-linker command line when the linker is called.
+Setting @option{-mrelax} just adds the @option{--mlink-relax} option to
+the assembler's command line and the @option{--relax} option to the
+linker's command line.
 
 Jump relaxing is performed by the linker because jump offsets are not
 known before code is located. Therefore, the assembler code generated by the
@@ -13529,6 +13535,11 @@ differ from instructions in the assemble
 Relaxing must be turned on if linker stubs are needed, see the
 section on @code{EIND} and linker stubs below.
 
+@item -mrmw
+@opindex mrmw
+Assume that the device supports the Read-Modify-Write
+instructions @code{XCH}, @code{LAC}, @code{LAS} and @code{LAT}.
+
 @item -msp8
 @opindex msp8
 Treat the stack pointer register as an 8-bit register,
@@ -13769,17 +13780,27 @@ architecture and depends on the @option{
 Possible values are:
 
 @code{2}, @code{25}, @code{3}, @code{31}, @code{35},
-@code{4}, @code{5}, @code{51}, @code{6}, @code{102}, @code{104},
+@code{4}, @code{5}, @code{51}, @code{6}
+
+for @var{mcu}=@code{avr2}, @code{avr25}, @code{avr3}, @code{avr31},
+@code{avr35}, @code{avr4}, @code{avr5}, @code{avr51}, @code{avr6},
+
+respectively and
+
+@code{100}, @code{102}, @code{104},
 @code{105}, @code{106}, @code{107}
 
-for @var{mcu}=@code{avr2}, @code{avr25}, @code{avr3},
-@code{avr31}, @code{avr35}, @code{avr4}, @code{avr5}, @code{avr51},
-@code{avr6}, @code{avrxmega2}, @code{avrxmega4}, @code{avrxmega5},
-@code{avrxmega6}, @code{avrxmega7}, respectively.
+for @var{mcu}=@code{avrtiny}, @code{avrxmega2}, @code{avrxmega4},
+@code{avrxmega5}, @code{avrxmega6}, @code{avrxmega7}, respectively.
 If @var{mcu} specifies a device, this built-in macro is set
 accordingly. For example, with @option{-mmcu=atmega8} the macro is
 defined to @code{4}.
 
+@item __AVR_DEVICE_NAME__
+If @var{mcu} in @option{-mmcu=@var{mcu}} specifies a device, this macro
+is defined to @var{mcu}.  If @var{mcu} is a core architecture like
+@code{avr51} this macro is not defined.
+
 @item __AVR_@var{Device}__
 Setting @option{-mmcu=@var{device}} defines this built-in macro which reflects
 the device's name. For example, @option{-mmcu=atmega8} defines the
@@ -13795,7 +13816,7 @@ @var{Device} in the built-in macro and @
 If @var{device} is not a device but only a core architecture like
 @samp{avr51}, this macro is not defined.
 
-@item   __AVR_DEVICE_NAME__
+@item __AVR_DEVICE_NAME__
 Setting @option{-mmcu=@var{device}} defines this built-in macro to
 the device's name. For example, with @option{-mmcu=atmega8} the macro
 is defined to @code{atmega8}.
Index: testsuite/gcc.target/avr/tiny-caller-save.c
===================================================================
--- testsuite/gcc.target/avr/tiny-caller-save.c	(revision 221324)
+++ testsuite/gcc.target/avr/tiny-caller-save.c	(working copy)
@@ -1,8 +1,8 @@
 /* { dg-do compile } */
-/* { dg-options "-march=avrtiny -gdwarf -Os" } */
+/* { dg-options "-mmcu=avrtiny -gdwarf -Os" } */
 
 /* This is a stripped down piece of libgcc2.c that triggerd an ICE for avr with
-   "-march=avrtiny -g -Os"; replace_reg_with_saved_mem would generate:
+   "-mmcu=avrtiny -g -Os"; replace_reg_with_saved_mem would generate:
    (concatn:SI [
                     (reg:SI 18 r18)
                     (reg:SI 19 r19)
Index: testsuite/gcc.target/avr/tiny-memx.c
===================================================================
--- testsuite/gcc.target/avr/tiny-memx.c	(revision 221324)
+++ testsuite/gcc.target/avr/tiny-memx.c	(working copy)
@@ -1,4 +1,4 @@
 /* { dg-do compile } */
-/* { dg-options "-march=avrtiny" } */
+/* { dg-options "-mmcu=avrtiny" } */
 
 const __memx char ascmonth[] = "Jan"; /* { dg-error "not supported" } */

[-- Attachment #4: pr65296-49.diff --]
[-- Type: text/x-patch, Size: 3743 bytes --]

Index: config/avr/driver-avr.c
===================================================================
--- config/avr/driver-avr.c	(revision 221321)
+++ config/avr/driver-avr.c	(working copy)
@@ -60,7 +60,10 @@ avr_device_to_as (int argc, const char *
 
   return concat ("-mmcu=", avr_current_arch->arch_name,
     avr_current_device->dev_attribute & AVR_ERRATA_SKIP ? "" : " -mno-skip-bug",
-    avr_current_device->dev_attribute & AVR_ISA_RMW ? " -mrmw" : "", NULL);
+#ifdef HAVE_AS_AVR_MRMW_OPTION
+    avr_current_device->dev_attribute & AVR_ISA_RMW ? " -mrmw" : "",
+#endif // have as -mrmw
+    NULL);
 }
 
 /* Returns command line parameters to pass to ld.  */
Index: configure
===================================================================
--- configure	(revision 221321)
+++ configure	(working copy)
@@ -24158,6 +24158,39 @@ $as_echo "#define HAVE_AS_NO_MUL_BUG_ABO
 fi
     ;;
 
+  avr-*-*)
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for -mrmw option" >&5
+$as_echo_n "checking assembler for -mrmw option... " >&6; }
+if test "${gcc_cv_as_avr_mrmw+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  gcc_cv_as_avr_mrmw=no
+  if test x$gcc_cv_as != x; then
+    $as_echo '.text' > conftest.s
+    if { ac_try='$gcc_cv_as $gcc_cv_as_flags -mrmw -o conftest.o conftest.s >&5'
+  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }
+    then
+	gcc_cv_as_avr_mrmw=yes
+    else
+      echo "configure: failed program was" >&5
+      cat conftest.s >&5
+    fi
+    rm -f conftest.o conftest.s
+  fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_as_avr_mrmw" >&5
+$as_echo "$gcc_cv_as_avr_mrmw" >&6; }
+if test $gcc_cv_as_avr_mrmw = yes; then
+
+$as_echo "#define HAVE_AS_AVR_MRMW_OPTION 1" >>confdefs.h
+
+fi
+    ;;
+
   sparc*-*-*)
     { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for .register" >&5
 $as_echo_n "checking assembler for .register... " >&6; }
Index: config.in
===================================================================
--- config.in	(revision 221321)
+++ config.in	(working copy)
@@ -211,6 +211,12 @@ that are supported for each access macro
 #endif
 
 
+/* Define if your assembler supports -mrmw option. */
+#ifndef USED_FOR_TARGET
+#undef HAVE_AS_AVR_MRMW_OPTION
+#endif
+
+
 /* Define if your assembler supports cmpb. */
 #ifndef USED_FOR_TARGET
 #undef HAVE_AS_CMPB
@@ -235,6 +241,12 @@ that are supported for each access macro
 #endif
 
 
+/* Define if your assembler supports .module. */
+#ifndef USED_FOR_TARGET
+#undef HAVE_AS_DOT_MODULE
+#endif
+
+
 /* Define if your assembler supports DSPR1 mult. */
 #ifndef USED_FOR_TARGET
 #undef HAVE_AS_DSPR1_MULT
@@ -447,12 +459,6 @@ that are supported for each access macro
 #endif
 
 
-/* Define if the assembler understands .module. */
-#ifndef USED_FOR_TARGET
-#undef HAVE_AS_DOT_MODULE
-#endif
-
-
 /* Define if your assembler supports the -no-mul-bug-abort option. */
 #ifndef USED_FOR_TARGET
 #undef HAVE_AS_NO_MUL_BUG_ABORT_OPTION
Index: configure.ac
===================================================================
--- configure.ac	(revision 221321)
+++ configure.ac	(working copy)
@@ -3603,6 +3603,13 @@ [	.set nomacro
 		[Define if your assembler supports the -no-mul-bug-abort option.])])
     ;;
 
+  avr-*-*)
+    gcc_GAS_CHECK_FEATURE([-mrmw option], gcc_cv_as_avr_mrmw,,
+      [-mrmw], [.text],,
+      [AC_DEFINE(HAVE_AS_AVR_MRMW_OPTION, 1,
+		[Define if your assembler supports -mrmw option.])])
+    ;;
+
   sparc*-*-*)
     gcc_GAS_CHECK_FEATURE([.register], gcc_cv_as_sparc_register_op,,,
       [.register %g2, #scratch],,

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [patch,avr]: Part3 and 4: Fix various problems with specs and specs file generation.
  2015-03-10 15:02       ` [patch,avr]: Part3 and 4: " Georg-Johann Lay
@ 2015-03-11 18:18         ` Denis Chertykov
  2015-03-16 18:18           ` [patch,avr]: Part5: " Georg-Johann Lay
  0 siblings, 1 reply; 23+ messages in thread
From: Denis Chertykov @ 2015-03-11 18:18 UTC (permalink / raw)
  To: Georg-Johann Lay; +Cc: Senthil Kumar Selvaraj, GCC Patches, Joerg Wunsch

2015-03-10 18:02 GMT+03:00 Georg-Johann Lay <avr@gjlay.de>:
> This is just a small addendum to the option and specs handling:
>
> - Document new avr-gcc command options
>
> - Change -march= to -mmcu= in some test cases
>
> - Add comfigure test to detect whether gas supports -mrmw and --mlink-relax.
>
> - Use result of these tests in specs generatio, i.e. omit respective options
> if they are not supported.
>
>
> Ok to apply?
>
>
> Two issues remain:
>
> - The tests that add -mmcu= to the command options will fail because there
> must not be more than one -mmcu=.  Supporting several, incompatible MCUs
> makes no sense (same for incompatible -march + -mmcu which was the case).
> In 4.9 this works per accident with unspecified definitions for built-in
> macros or when the options differ in default settings, for example.
>
> - Spaces in the installation path are not supported.  It's possible to
> recover from spaces in -specs= by escaping them in spec function
> device-specs-file. However this is almost impossible for the device library
> without changing gcc.c which can use convert_white_space() as needed.
> Adding more than one escape level is not possible because the '\' would be
> interpreted as part of the path.
>
>
> Johann
>
>
> gcc/
>         PR target/65296
>         * configure.ac [avr]: Check as for options -mrmw, --mlink-relax.
>         * configure: Regenerate.
>         * config.in: Regenerate.
>         * config/avr/gen-avr-mmcu-specs.c (config.h): Include it.
>         (*asm_relax): Only define spec if HAVE_AS_AVR_MLINK_RELAX_OPTION.
>         (*asm_rmw): Only define spec if HAVE_AS_AVR_MRMW_OPTION.
>
>
> gcc/
>         PR target/65296
>         * doc/invoke.texi (AVR Options) [-mrmw]: Document it.
>         [-mn-flash]: Document it.
>         [__AVR_DEVICE_NAME__]: Document it.
>         [__ARV_ARCH__]: Document avrtiny.
>
> gcc/testsuite/
>         PR target/65296
>         * gcc.target/avr/tiny-memx: Use -mmcu instead of -march.
>         * gcc.target/avr/tiny-caller-save.c: Same.
>
>
> gcc/
>         PR target/65296
>         * configure.ac [avr]: Check as for option -mrmw.
>         * configure: Regenerate.
>         * config.in: Regenerate.
>         * config/avr/driver-avr.c (avr_device_to_as): Don't add -mrmw to
>         assembler options if not HAVE_AS_AVR_MRMW_OPTION.
>

Approved.

Denis.

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [patch,avr]: Part5: Fix various problems with specs and specs file generation.
  2015-03-11 18:18         ` Denis Chertykov
@ 2015-03-16 18:18           ` Georg-Johann Lay
  2015-03-17  6:37             ` Denis Chertykov
  0 siblings, 1 reply; 23+ messages in thread
From: Georg-Johann Lay @ 2015-03-16 18:18 UTC (permalink / raw)
  To: Denis Chertykov; +Cc: Senthil Kumar Selvaraj, GCC Patches, Joerg Wunsch

[-- Attachment #1: Type: text/plain, Size: 1898 bytes --]

This patch introduces a new avr specific command option '-nodevicelib' so that 
linking of libdev.a can be bypassed.

The argument of -specs= is suffixed by %s instead of supplying the absolute 
path.  That way -specs= works with installation path that contains spaces.

avr_mct_t.library_name and its initializers in avr-mcus.def are cleaned up.

This field was used to define __AVR_DEV_LIB_NAME__.  If no device macro is 
defined because a device is not supported by avr-gcc, that hook macro can be 
defined to tell avr/io.h where to find the device's header file.

This means it is pointless to define __AVR_DEV_LIB_NAME__ in avr-gcc:

If a device is supported, the device macro (e.g. __AVR_ATmega8__) is defined 
and __AVR_DEV_LIB_NAME__ will never be used.

The patch adds more help text to the device specs file to inform a potential 
reader about the role of the hook macro __AVR_DEV_LIB_NAME__.

The patch also removes specs known to GCC and which don't directly depend on 
the device from the device specs file.  This makes the specs file smaller and 
easier less confusing.

Ok for trunk?

Johann


	PR target/65296
	* config/avr/avrlibc.h (LIB_SPEC, LIBGCC_SPEC) [AVR1]: Don't link
	libgcc.a, libc.a, libm.a.
	* config/avr/specs.h: Same.
	* config/avr/gen-avr-mmcu-specs.c (print_mcu): Don't print specs
	which don't (directly) depend on the device.  Print more help.
	(*avrlibc_devicelib) [-nodevicelib]: Don't link libdev.a.
	(*cpp): Don't define __AVR_DEV_LIB_NAME__.
	* config/avr/driver-avr.c: Remove -nodevicelib from option list in
	case of an error.
	(avr_devicespecs_file): Use suffix "%s" instead of absolute path.
	for specs file name instead of absolute path.
	* config/avr/avr-arch.h (avr_mcu_t) [.library_name]: Remove.
	* config/avr/avr-mcus.def: Same: Adjust initializers.
	* config/avr/avr.opt (-nodevicelib): New option.
	* doc/invoke.texi (AVR Options): Document it.


[-- Attachment #2: pr65296-part5.diff --]
[-- Type: text/x-patch, Size: 72734 bytes --]

Index: config/avr/avrlibc.h
===================================================================
--- config/avr/avrlibc.h	(revision 221448)
+++ config/avr/avrlibc.h	(working copy)
@@ -19,21 +19,17 @@ You should have received a copy of the G
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
-/* AVR-Libc implements functions from libgcc.a in libm.a, see PR54461.
-   More AVR-Libc specific specs originate from gen-avr-mmcu-specs.c:
-
-   - LIBGCC_SPEC (*libgcc)
-   - LIB_SPEC (*lib)
-   
-*/
-
 #undef  LIB_SPEC
 #define LIB_SPEC                                \
-  " -lc %(avrlibc_devicelib) "
+  "%{!mmcu=avr1:-lc} %(avrlibc_devicelib)"
+
+// AVR-Libc implements functions from libgcc.a in libm.a, see PR54461.
+// For a list of functions which are provided by libm.a and are
+// omitted from libgcc.a see libgcc's t-avrlibc.
 
 #undef  LIBGCC_SPEC
 #define LIBGCC_SPEC                             \
-  " -lgcc -lm "
+  "%{!mmcu=avr1:-lgcc -lm}"
 
 #undef  STARTFILE_SPEC
 #define STARTFILE_SPEC                          \
Index: config/avr/avr-arch.h
===================================================================
--- config/avr/avr-arch.h	(revision 221448)
+++ config/avr/avr-arch.h	(working copy)
@@ -122,9 +122,6 @@ const char *const macro;
 
   /* Number of 64k segments in the flash.  */
   int n_flash;
-
-  /* Old name of device library.  */
-  const char *const library_name;
 } avr_mcu_t;
 
 /* AVR device specific features.
Index: config/avr/avr-devices.c
===================================================================
--- config/avr/avr-devices.c	(revision 221448)
+++ config/avr/avr-devices.c	(working copy)
@@ -111,12 +111,12 @@ avr_texinfo[] =
 const avr_mcu_t
 avr_mcu_types[] =
 {
-#define AVR_MCU(NAME, ARCH, DEV_ATTRIBUTE, MACRO, DATA_SEC, TEXT_SEC, N_FLASH, LIBNAME)\
-  { NAME, ARCH, DEV_ATTRIBUTE, MACRO, DATA_SEC, TEXT_SEC, N_FLASH, LIBNAME },
+#define AVR_MCU(NAME, ARCH, DEV_ATTRIBUTE, MACRO, DATA_SEC, TEXT_SEC, N_FLASH)\
+  { NAME, ARCH, DEV_ATTRIBUTE, MACRO, DATA_SEC, TEXT_SEC, N_FLASH },
 #include "avr-mcus.def"
 #undef AVR_MCU
     /* End of list.  */
-  { NULL, ARCH_UNKNOWN, AVR_ISA_NONE, NULL, 0, 0, 0, NULL }
+  { NULL, ARCH_UNKNOWN, AVR_ISA_NONE, NULL, 0, 0, 0 }
 };
 
 
Index: config/avr/avr.opt
===================================================================
--- config/avr/avr.opt	(revision 221448)
+++ config/avr/avr.opt	(working copy)
@@ -94,3 +94,7 @@ Warn if the address space of an address
 mfract-convert-truncate
 Target Report Mask(FRACT_CONV_TRUNC)
 Allow to use truncation instead of rounding towards 0 for fractional int types
+
+nodevicelib
+Driver Target Report RejectNegative
+Do not link against the device-specific library libdev.a
Index: config/avr/avr-mcus.def
===================================================================
--- config/avr/avr-mcus.def	(revision 221448)
+++ config/avr/avr-mcus.def	(working copy)
@@ -29,16 +29,25 @@
    After that, rebuild everything and check-in the new sources to the repo.
    The device list below should be kept in sync with AVR-LibC.
 
+   Device info is used during compiler build when the device specific
+   spec files device-specs/specs-<NAME> are being built.  The compiler proper
+   does not use the device info, it only uses info for the core architecture,
+   i.e. for entries with MACRO = NULL.
 
    Before including this file, define a macro:
 
-   AVR_MCU (NAME, ARCH, DEV_ATTRIBUTE, MACRO, DATA_SEC, N_FLASH, LIBRARY_NAME)
+   AVR_MCU (NAME, ARCH, DEV_ATTRIBUTE, MACRO, DATA_SEC, N_FLASH)
 
    where the arguments are the fields of avr_mcu_t:
    
-       NAME          Accept -mmcu=<NAME>
+       NAME          Name of the device as specified by -mmcu=<NAME>.  Also
+                     used by DRIVER_SELF_SPECS and gen-avr-mmcu-specs.c for
+                     - the name of the device specific specs file
+                       in -specs=device-specs/spec-<NAME>
+                     - the name of the startup file dev/<NAME>/crt1.o
+                     - the name of the device library dev/<NAME>/libdev.a
 
-       ARCH          Specifies the multilib variant together with SHORT_SP
+       ARCH          Specifies the multilib variant together with AVR_SHORT_SP
 
        DEV_ATTRIBUTE Specifies the device specific features
                      - additional ISA, short SP, errata skip etc.,
@@ -46,296 +55,295 @@ Before including this file, define a mac
        MACRO         If NULL, this is a core and not a device.  If non-NULL,
                      supply respective built-in macro.
 
-       DATA_SEC      First address of SRAM, used in  -Tdata=  by the driver.
+       DATA_START    First address of SRAM, used in  -Tdata=<DATA_START>.
 
-       TEXT_SEC      First address of Flash, used in -Ttext= by the driver.
+       TEXT_START    First address of Flash, used in -Ttext=<TEXT_START>.
 
-       N_FLASH       Number of 64 KiB flash segments, rounded up.
-
-       LIBRARY_NAME  Used to define __AVR_DEV_LIB_NAME__.
+       N_FLASH       Number of 64 KiB flash segments, rounded up.  The default
+                     value for -mn-flash=<N_FLASH>.
 
    "avr2" must be first for the "0" default to work as intended.  */
 
 /* Classic, <= 8K.  */
-AVR_MCU ("avr2",                 ARCH_AVR2, AVR_ERRATA_SKIP, NULL,                     0x0060, 0x0, 6, "s8515")
-AVR_MCU ("at90s2313",            ARCH_AVR2, AVR_SHORT_SP, "__AVR_AT90S2313__",         0x0060, 0x0, 1, "s2313")
-AVR_MCU ("at90s2323",            ARCH_AVR2, AVR_SHORT_SP, "__AVR_AT90S2323__",         0x0060, 0x0, 1, "s2323")
-AVR_MCU ("at90s2333",            ARCH_AVR2, AVR_SHORT_SP, "__AVR_AT90S2333__",         0x0060, 0x0, 1, "s2333")
-AVR_MCU ("at90s2343",            ARCH_AVR2, AVR_SHORT_SP, "__AVR_AT90S2343__",         0x0060, 0x0, 1, "s2343")
-AVR_MCU ("attiny22",             ARCH_AVR2, AVR_SHORT_SP, "__AVR_ATtiny22__",          0x0060, 0x0, 1, "tn22")
-AVR_MCU ("attiny26",             ARCH_AVR2, AVR_SHORT_SP, "__AVR_ATtiny26__",          0x0060, 0x0, 1, "tn26")
-AVR_MCU ("at90s4414",            ARCH_AVR2, AVR_ISA_NONE, "__AVR_AT90S4414__",         0x0060, 0x0, 1, "s4414")
-AVR_MCU ("at90s4433",            ARCH_AVR2, AVR_SHORT_SP, "__AVR_AT90S4433__",         0x0060, 0x0, 1, "s4433")
-AVR_MCU ("at90s4434",            ARCH_AVR2, AVR_ISA_NONE, "__AVR_AT90S4434__",         0x0060, 0x0, 1, "s4434")
-AVR_MCU ("at90s8515",            ARCH_AVR2, AVR_ERRATA_SKIP, "__AVR_AT90S8515__",      0x0060, 0x0, 1, "s8515")
-AVR_MCU ("at90c8534",            ARCH_AVR2, AVR_ISA_NONE, "__AVR_AT90C8534__",         0x0060, 0x0, 1, "c8534")
-AVR_MCU ("at90s8535",            ARCH_AVR2, AVR_ISA_NONE, "__AVR_AT90S8535__",         0x0060, 0x0, 1, "s8535")
+AVR_MCU ("avr2",             ARCH_AVR2, AVR_ERRATA_SKIP, NULL,                     0x0060, 0x0, 6)
+AVR_MCU ("at90s2313",        ARCH_AVR2, AVR_SHORT_SP, "__AVR_AT90S2313__",         0x0060, 0x0, 1)
+AVR_MCU ("at90s2323",        ARCH_AVR2, AVR_SHORT_SP, "__AVR_AT90S2323__",         0x0060, 0x0, 1)
+AVR_MCU ("at90s2333",        ARCH_AVR2, AVR_SHORT_SP, "__AVR_AT90S2333__",         0x0060, 0x0, 1)
+AVR_MCU ("at90s2343",        ARCH_AVR2, AVR_SHORT_SP, "__AVR_AT90S2343__",         0x0060, 0x0, 1)
+AVR_MCU ("attiny22",         ARCH_AVR2, AVR_SHORT_SP, "__AVR_ATtiny22__",          0x0060, 0x0, 1)
+AVR_MCU ("attiny26",         ARCH_AVR2, AVR_SHORT_SP, "__AVR_ATtiny26__",          0x0060, 0x0, 1)
+AVR_MCU ("at90s4414",        ARCH_AVR2, AVR_ISA_NONE, "__AVR_AT90S4414__",         0x0060, 0x0, 1)
+AVR_MCU ("at90s4433",        ARCH_AVR2, AVR_SHORT_SP, "__AVR_AT90S4433__",         0x0060, 0x0, 1)
+AVR_MCU ("at90s4434",        ARCH_AVR2, AVR_ISA_NONE, "__AVR_AT90S4434__",         0x0060, 0x0, 1)
+AVR_MCU ("at90s8515",        ARCH_AVR2, AVR_ERRATA_SKIP, "__AVR_AT90S8515__",      0x0060, 0x0, 1)
+AVR_MCU ("at90c8534",        ARCH_AVR2, AVR_ISA_NONE, "__AVR_AT90C8534__",         0x0060, 0x0, 1)
+AVR_MCU ("at90s8535",        ARCH_AVR2, AVR_ISA_NONE, "__AVR_AT90S8535__",         0x0060, 0x0, 1)
 /* Classic + MOVW, <= 8K.  */
-AVR_MCU ("avr25",                ARCH_AVR25, AVR_ISA_NONE, NULL,                       0x0060, 0x0, 1, "tn85")
-AVR_MCU ("ata5272",              ARCH_AVR25, AVR_ISA_NONE, "__AVR_ATA5272__",          0x0100, 0x0, 1, "a5272")
-AVR_MCU ("ata6616c",             ARCH_AVR25, AVR_ISA_NONE, "__AVR_ATA6616C__",         0x0100, 0x0, 1, "a6616c")
-AVR_MCU ("attiny13",             ARCH_AVR25, AVR_SHORT_SP, "__AVR_ATtiny13__",         0x0060, 0x0, 1, "tn13")
-AVR_MCU ("attiny13a",            ARCH_AVR25, AVR_SHORT_SP, "__AVR_ATtiny13A__",        0x0060, 0x0, 1, "tn13a")
-AVR_MCU ("attiny2313",           ARCH_AVR25, AVR_SHORT_SP, "__AVR_ATtiny2313__",       0x0060, 0x0, 1, "tn2313")
-AVR_MCU ("attiny2313a",          ARCH_AVR25, AVR_SHORT_SP, "__AVR_ATtiny2313A__",      0x0060, 0x0, 1, "tn2313a")
-AVR_MCU ("attiny24",             ARCH_AVR25, AVR_SHORT_SP, "__AVR_ATtiny24__",         0x0060, 0x0, 1, "tn24")
-AVR_MCU ("attiny24a",            ARCH_AVR25, AVR_SHORT_SP, "__AVR_ATtiny24A__",        0x0060, 0x0, 1, "tn24a")
-AVR_MCU ("attiny4313",           ARCH_AVR25, AVR_ISA_NONE, "__AVR_ATtiny4313__",       0x0060, 0x0, 1, "tn4313")
-AVR_MCU ("attiny44",             ARCH_AVR25, AVR_ISA_NONE, "__AVR_ATtiny44__",         0x0060, 0x0, 1, "tn44")
-AVR_MCU ("attiny44a",            ARCH_AVR25, AVR_ISA_NONE, "__AVR_ATtiny44A__",        0x0060, 0x0, 1, "tn44a")
-AVR_MCU ("attiny441",            ARCH_AVR25, AVR_ISA_NONE, "__AVR_ATtiny441__",        0x0100, 0x0, 1, "tn441")
-AVR_MCU ("attiny84",             ARCH_AVR25, AVR_ISA_NONE, "__AVR_ATtiny84__",         0x0060, 0x0, 1, "tn84")
-AVR_MCU ("attiny84a",            ARCH_AVR25, AVR_ISA_NONE, "__AVR_ATtiny84A__",        0x0060, 0x0, 1, "tn84")
-AVR_MCU ("attiny25",             ARCH_AVR25, AVR_SHORT_SP, "__AVR_ATtiny25__",         0x0060, 0x0, 1, "tn25")
-AVR_MCU ("attiny45",             ARCH_AVR25, AVR_ISA_NONE, "__AVR_ATtiny45__",         0x0060, 0x0, 1, "tn45")
-AVR_MCU ("attiny85",             ARCH_AVR25, AVR_ISA_NONE, "__AVR_ATtiny85__",         0x0060, 0x0, 1, "tn85")
-AVR_MCU ("attiny261",            ARCH_AVR25, AVR_SHORT_SP, "__AVR_ATtiny261__",        0x0060, 0x0, 1, "tn261")
-AVR_MCU ("attiny261a",           ARCH_AVR25, AVR_SHORT_SP, "__AVR_ATtiny261A__",       0x0060, 0x0, 1, "tn261a")
-AVR_MCU ("attiny461",            ARCH_AVR25, AVR_ISA_NONE, "__AVR_ATtiny461__",        0x0060, 0x0, 1, "tn461")
-AVR_MCU ("attiny461a",           ARCH_AVR25, AVR_ISA_NONE, "__AVR_ATtiny461A__",       0x0060, 0x0, 1, "tn461a")
-AVR_MCU ("attiny861",            ARCH_AVR25, AVR_ISA_NONE, "__AVR_ATtiny861__",        0x0060, 0x0, 1, "tn861")
-AVR_MCU ("attiny861a",           ARCH_AVR25, AVR_ISA_NONE, "__AVR_ATtiny861A__",       0x0060, 0x0, 1, "tn861a")
-AVR_MCU ("attiny43u",            ARCH_AVR25, AVR_ISA_NONE, "__AVR_ATtiny43U__",        0x0060, 0x0, 1, "tn43u")
-AVR_MCU ("attiny87",             ARCH_AVR25, AVR_ISA_NONE, "__AVR_ATtiny87__",         0x0100, 0x0, 1, "tn87")
-AVR_MCU ("attiny48",             ARCH_AVR25, AVR_ISA_NONE, "__AVR_ATtiny48__",         0x0100, 0x0, 1, "tn48")
-AVR_MCU ("attiny88",             ARCH_AVR25, AVR_ISA_NONE, "__AVR_ATtiny88__",         0x0100, 0x0, 1, "tn88")
-AVR_MCU ("attiny828",            ARCH_AVR25, AVR_ISA_NONE, "__AVR_ATtiny828__",        0x0100, 0x0, 1, "tn828")
-AVR_MCU ("attiny841",            ARCH_AVR25, AVR_ISA_NONE, "__AVR_ATtiny841__",        0x0100, 0x0, 1, "tn841")
-AVR_MCU ("at86rf401",            ARCH_AVR25, AVR_ISA_NONE, "__AVR_AT86RF401__",        0x0060, 0x0, 1, "86401")
+AVR_MCU ("avr25",            ARCH_AVR25, AVR_ISA_NONE, NULL,                       0x0060, 0x0, 1)
+AVR_MCU ("ata5272",          ARCH_AVR25, AVR_ISA_NONE, "__AVR_ATA5272__",          0x0100, 0x0, 1)
+AVR_MCU ("ata6616c",         ARCH_AVR25, AVR_ISA_NONE, "__AVR_ATA6616C__",         0x0100, 0x0, 1)
+AVR_MCU ("attiny13",         ARCH_AVR25, AVR_SHORT_SP, "__AVR_ATtiny13__",         0x0060, 0x0, 1)
+AVR_MCU ("attiny13a",        ARCH_AVR25, AVR_SHORT_SP, "__AVR_ATtiny13A__",        0x0060, 0x0, 1)
+AVR_MCU ("attiny2313",       ARCH_AVR25, AVR_SHORT_SP, "__AVR_ATtiny2313__",       0x0060, 0x0, 1)
+AVR_MCU ("attiny2313a",      ARCH_AVR25, AVR_SHORT_SP, "__AVR_ATtiny2313A__",      0x0060, 0x0, 1)
+AVR_MCU ("attiny24",         ARCH_AVR25, AVR_SHORT_SP, "__AVR_ATtiny24__",         0x0060, 0x0, 1)
+AVR_MCU ("attiny24a",        ARCH_AVR25, AVR_SHORT_SP, "__AVR_ATtiny24A__",        0x0060, 0x0, 1)
+AVR_MCU ("attiny4313",       ARCH_AVR25, AVR_ISA_NONE, "__AVR_ATtiny4313__",       0x0060, 0x0, 1)
+AVR_MCU ("attiny44",         ARCH_AVR25, AVR_ISA_NONE, "__AVR_ATtiny44__",         0x0060, 0x0, 1)
+AVR_MCU ("attiny44a",        ARCH_AVR25, AVR_ISA_NONE, "__AVR_ATtiny44A__",        0x0060, 0x0, 1)
+AVR_MCU ("attiny441",        ARCH_AVR25, AVR_ISA_NONE, "__AVR_ATtiny441__",        0x0100, 0x0, 1)
+AVR_MCU ("attiny84",         ARCH_AVR25, AVR_ISA_NONE, "__AVR_ATtiny84__",         0x0060, 0x0, 1)
+AVR_MCU ("attiny84a",        ARCH_AVR25, AVR_ISA_NONE, "__AVR_ATtiny84A__",        0x0060, 0x0, 1)
+AVR_MCU ("attiny25",         ARCH_AVR25, AVR_SHORT_SP, "__AVR_ATtiny25__",         0x0060, 0x0, 1)
+AVR_MCU ("attiny45",         ARCH_AVR25, AVR_ISA_NONE, "__AVR_ATtiny45__",         0x0060, 0x0, 1)
+AVR_MCU ("attiny85",         ARCH_AVR25, AVR_ISA_NONE, "__AVR_ATtiny85__",         0x0060, 0x0, 1)
+AVR_MCU ("attiny261",        ARCH_AVR25, AVR_SHORT_SP, "__AVR_ATtiny261__",        0x0060, 0x0, 1)
+AVR_MCU ("attiny261a",       ARCH_AVR25, AVR_SHORT_SP, "__AVR_ATtiny261A__",       0x0060, 0x0, 1)
+AVR_MCU ("attiny461",        ARCH_AVR25, AVR_ISA_NONE, "__AVR_ATtiny461__",        0x0060, 0x0, 1)
+AVR_MCU ("attiny461a",       ARCH_AVR25, AVR_ISA_NONE, "__AVR_ATtiny461A__",       0x0060, 0x0, 1)
+AVR_MCU ("attiny861",        ARCH_AVR25, AVR_ISA_NONE, "__AVR_ATtiny861__",        0x0060, 0x0, 1)
+AVR_MCU ("attiny861a",       ARCH_AVR25, AVR_ISA_NONE, "__AVR_ATtiny861A__",       0x0060, 0x0, 1)
+AVR_MCU ("attiny43u",        ARCH_AVR25, AVR_ISA_NONE, "__AVR_ATtiny43U__",        0x0060, 0x0, 1)
+AVR_MCU ("attiny87",         ARCH_AVR25, AVR_ISA_NONE, "__AVR_ATtiny87__",         0x0100, 0x0, 1)
+AVR_MCU ("attiny48",         ARCH_AVR25, AVR_ISA_NONE, "__AVR_ATtiny48__",         0x0100, 0x0, 1)
+AVR_MCU ("attiny88",         ARCH_AVR25, AVR_ISA_NONE, "__AVR_ATtiny88__",         0x0100, 0x0, 1)
+AVR_MCU ("attiny828",        ARCH_AVR25, AVR_ISA_NONE, "__AVR_ATtiny828__",        0x0100, 0x0, 1)
+AVR_MCU ("attiny841",        ARCH_AVR25, AVR_ISA_NONE, "__AVR_ATtiny841__",        0x0100, 0x0, 1)
+AVR_MCU ("at86rf401",        ARCH_AVR25, AVR_ISA_NONE, "__AVR_AT86RF401__",        0x0060, 0x0, 1)
 /* Classic, > 8K, <= 64K.  */
-AVR_MCU ("avr3",                 ARCH_AVR3, AVR_ISA_NONE, NULL,                        0x0060, 0x0, 1, "43355")
-AVR_MCU ("at43usb355",           ARCH_AVR3, AVR_ISA_NONE, "__AVR_AT43USB355__",        0x0060, 0x0, 1, "43355")
-AVR_MCU ("at76c711",             ARCH_AVR3, AVR_ISA_NONE, "__AVR_AT76C711__",          0x0060, 0x0, 1, "76711")
+AVR_MCU ("avr3",             ARCH_AVR3, AVR_ISA_NONE, NULL,                        0x0060, 0x0, 1)
+AVR_MCU ("at43usb355",       ARCH_AVR3, AVR_ISA_NONE, "__AVR_AT43USB355__",        0x0060, 0x0, 1)
+AVR_MCU ("at76c711",         ARCH_AVR3, AVR_ISA_NONE, "__AVR_AT76C711__",          0x0060, 0x0, 1)
 /* Classic, == 128K.  */
-AVR_MCU ("avr31",                ARCH_AVR31, AVR_ERRATA_SKIP, NULL,                    0x0060, 0x0, 2, "m103")
-AVR_MCU ("atmega103",            ARCH_AVR31, AVR_ERRATA_SKIP, "__AVR_ATmega103__",     0x0060, 0x0, 2, "m103")
-AVR_MCU ("at43usb320",           ARCH_AVR31, AVR_ISA_NONE, "__AVR_AT43USB320__",       0x0060, 0x0, 2, "43320")
+AVR_MCU ("avr31",            ARCH_AVR31, AVR_ERRATA_SKIP, NULL,                    0x0060, 0x0, 2)
+AVR_MCU ("atmega103",        ARCH_AVR31, AVR_ERRATA_SKIP, "__AVR_ATmega103__",     0x0060, 0x0, 2)
+AVR_MCU ("at43usb320",       ARCH_AVR31, AVR_ISA_NONE, "__AVR_AT43USB320__",       0x0060, 0x0, 2)
 /* Classic + MOVW + JMP/CALL.  */
-AVR_MCU ("avr35",                ARCH_AVR35, AVR_ISA_NONE, NULL,                       0x0100, 0x0, 1, "usb162")
-AVR_MCU ("ata5505",              ARCH_AVR35, AVR_ISA_NONE, "__AVR_ATA5505__",          0x0100, 0x0, 1, "a5505")
-AVR_MCU ("ata6617c",             ARCH_AVR35, AVR_ISA_NONE, "__AVR_ATA6617C__",         0x0100, 0x0, 1, "a6617c")
-AVR_MCU ("ata664251",            ARCH_AVR35, AVR_ISA_NONE, "__AVR_ATA664251__",        0x0100, 0x0, 1, "a664251")
-AVR_MCU ("at90usb82",            ARCH_AVR35, AVR_ISA_NONE, "__AVR_AT90USB82__",        0x0100, 0x0, 1, "usb82")
-AVR_MCU ("at90usb162",           ARCH_AVR35, AVR_ISA_NONE, "__AVR_AT90USB162__",       0x0100, 0x0, 1, "usb162")
-AVR_MCU ("atmega8u2",            ARCH_AVR35, AVR_ISA_NONE, "__AVR_ATmega8U2__",        0x0100, 0x0, 1, "m8u2")
-AVR_MCU ("atmega16u2",           ARCH_AVR35, AVR_ISA_NONE, "__AVR_ATmega16U2__",       0x0100, 0x0, 1, "m16u2")
-AVR_MCU ("atmega32u2",           ARCH_AVR35, AVR_ISA_NONE, "__AVR_ATmega32U2__",       0x0100, 0x0, 1, "m32u2")
-AVR_MCU ("attiny167",            ARCH_AVR35, AVR_ISA_NONE, "__AVR_ATtiny167__",        0x0100, 0x0, 1, "tn167")
-AVR_MCU ("attiny1634",           ARCH_AVR35, AVR_ISA_NONE, "__AVR_ATtiny1634__",       0x0100, 0x0, 1, "tn1634")
+AVR_MCU ("avr35",            ARCH_AVR35, AVR_ISA_NONE, NULL,                       0x0100, 0x0, 1)
+AVR_MCU ("ata5505",          ARCH_AVR35, AVR_ISA_NONE, "__AVR_ATA5505__",          0x0100, 0x0, 1)
+AVR_MCU ("ata6617c",         ARCH_AVR35, AVR_ISA_NONE, "__AVR_ATA6617C__",         0x0100, 0x0, 1)
+AVR_MCU ("ata664251",        ARCH_AVR35, AVR_ISA_NONE, "__AVR_ATA664251__",        0x0100, 0x0, 1)
+AVR_MCU ("at90usb82",        ARCH_AVR35, AVR_ISA_NONE, "__AVR_AT90USB82__",        0x0100, 0x0, 1)
+AVR_MCU ("at90usb162",       ARCH_AVR35, AVR_ISA_NONE, "__AVR_AT90USB162__",       0x0100, 0x0, 1)
+AVR_MCU ("atmega8u2",        ARCH_AVR35, AVR_ISA_NONE, "__AVR_ATmega8U2__",        0x0100, 0x0, 1)
+AVR_MCU ("atmega16u2",       ARCH_AVR35, AVR_ISA_NONE, "__AVR_ATmega16U2__",       0x0100, 0x0, 1)
+AVR_MCU ("atmega32u2",       ARCH_AVR35, AVR_ISA_NONE, "__AVR_ATmega32U2__",       0x0100, 0x0, 1)
+AVR_MCU ("attiny167",        ARCH_AVR35, AVR_ISA_NONE, "__AVR_ATtiny167__",        0x0100, 0x0, 1)
+AVR_MCU ("attiny1634",       ARCH_AVR35, AVR_ISA_NONE, "__AVR_ATtiny1634__",       0x0100, 0x0, 1)
 /* Enhanced, <= 8K.  */
-AVR_MCU ("avr4",                 ARCH_AVR4, AVR_ISA_NONE,  NULL,                       0x0060, 0x0, 1, "m8")
-AVR_MCU ("ata6285",              ARCH_AVR4, AVR_ISA_NONE,  "__AVR_ATA6285__",          0x0100, 0x0, 1, "a6285")
-AVR_MCU ("ata6286",              ARCH_AVR4, AVR_ISA_NONE,  "__AVR_ATA6286__",          0x0100, 0x0, 1, "a6286")
-AVR_MCU ("ata6289",              ARCH_AVR4, AVR_ISA_NONE, "__AVR_ATA6289__",           0x0100, 0x0, 1, "a6289")
-AVR_MCU ("ata6612c",             ARCH_AVR4, AVR_ISA_NONE,  "__AVR_ATA6612C__",         0x0100, 0x0, 1, "a6612c")
-AVR_MCU ("atmega8",              ARCH_AVR4, AVR_ISA_NONE,  "__AVR_ATmega8__",          0x0060, 0x0, 1, "m8")
-AVR_MCU ("atmega8a",             ARCH_AVR4, AVR_ISA_NONE,  "__AVR_ATmega8A__",         0x0060, 0x0, 1, "m8a")
-AVR_MCU ("atmega48",             ARCH_AVR4, AVR_ISA_NONE,  "__AVR_ATmega48__",         0x0100, 0x0, 1, "m48")
-AVR_MCU ("atmega48a",            ARCH_AVR4, AVR_ISA_NONE,  "__AVR_ATmega48A__",        0x0100, 0x0, 1, "m48a")
-AVR_MCU ("atmega48p",            ARCH_AVR4, AVR_ISA_NONE,  "__AVR_ATmega48P__",        0x0100, 0x0, 1, "m48p")
-AVR_MCU ("atmega48pa",           ARCH_AVR4, AVR_ISA_NONE,  "__AVR_ATmega48PA__",       0x0100, 0x0, 1, "m48pa")
-AVR_MCU ("atmega88",             ARCH_AVR4, AVR_ISA_NONE,  "__AVR_ATmega88__",         0x0100, 0x0, 1, "m88")
-AVR_MCU ("atmega88a",            ARCH_AVR4, AVR_ISA_NONE,  "__AVR_ATmega88A__",        0x0100, 0x0, 1, "m88a")
-AVR_MCU ("atmega88p",            ARCH_AVR4, AVR_ISA_NONE,  "__AVR_ATmega88P__",        0x0100, 0x0, 1, "m88p")
-AVR_MCU ("atmega88pa",           ARCH_AVR4, AVR_ISA_NONE,  "__AVR_ATmega88PA__",       0x0100, 0x0, 1, "m88pa")
-AVR_MCU ("atmega8515",           ARCH_AVR4, AVR_ISA_NONE,  "__AVR_ATmega8515__",       0x0060, 0x0, 1, "m8515")
-AVR_MCU ("atmega8535",           ARCH_AVR4, AVR_ISA_NONE,  "__AVR_ATmega8535__",       0x0060, 0x0, 1, "m8535")
-AVR_MCU ("atmega8hva",           ARCH_AVR4, AVR_ISA_NONE,  "__AVR_ATmega8HVA__",       0x0100, 0x0, 1, "m8hva")
-AVR_MCU ("at90pwm1",             ARCH_AVR4, AVR_ISA_NONE,  "__AVR_AT90PWM1__",         0x0100, 0x0, 1, "90pwm1")
-AVR_MCU ("at90pwm2",             ARCH_AVR4, AVR_ISA_NONE,  "__AVR_AT90PWM2__",         0x0100, 0x0, 1, "90pwm2")
-AVR_MCU ("at90pwm2b",            ARCH_AVR4, AVR_ISA_NONE,  "__AVR_AT90PWM2B__",        0x0100, 0x0, 1, "90pwm2b")
-AVR_MCU ("at90pwm3",             ARCH_AVR4, AVR_ISA_NONE,  "__AVR_AT90PWM3__",         0x0100, 0x0, 1, "90pwm3")
-AVR_MCU ("at90pwm3b",            ARCH_AVR4, AVR_ISA_NONE,  "__AVR_AT90PWM3B__",        0x0100, 0x0, 1, "90pwm3b")
-AVR_MCU ("at90pwm81",            ARCH_AVR4, AVR_ISA_NONE,  "__AVR_AT90PWM81__",        0x0100, 0x0, 1, "90pwm81")
+AVR_MCU ("avr4",             ARCH_AVR4, AVR_ISA_NONE,  NULL,                       0x0060, 0x0, 1)
+AVR_MCU ("ata6285",          ARCH_AVR4, AVR_ISA_NONE,  "__AVR_ATA6285__",          0x0100, 0x0, 1)
+AVR_MCU ("ata6286",          ARCH_AVR4, AVR_ISA_NONE,  "__AVR_ATA6286__",          0x0100, 0x0, 1)
+AVR_MCU ("ata6289",          ARCH_AVR4, AVR_ISA_NONE, "__AVR_ATA6289__",           0x0100, 0x0, 1)
+AVR_MCU ("ata6612c",         ARCH_AVR4, AVR_ISA_NONE,  "__AVR_ATA6612C__",         0x0100, 0x0, 1)
+AVR_MCU ("atmega8",          ARCH_AVR4, AVR_ISA_NONE,  "__AVR_ATmega8__",          0x0060, 0x0, 1)
+AVR_MCU ("atmega8a",         ARCH_AVR4, AVR_ISA_NONE,  "__AVR_ATmega8A__",         0x0060, 0x0, 1)
+AVR_MCU ("atmega48",         ARCH_AVR4, AVR_ISA_NONE,  "__AVR_ATmega48__",         0x0100, 0x0, 1)
+AVR_MCU ("atmega48a",        ARCH_AVR4, AVR_ISA_NONE,  "__AVR_ATmega48A__",        0x0100, 0x0, 1)
+AVR_MCU ("atmega48p",        ARCH_AVR4, AVR_ISA_NONE,  "__AVR_ATmega48P__",        0x0100, 0x0, 1)
+AVR_MCU ("atmega48pa",       ARCH_AVR4, AVR_ISA_NONE,  "__AVR_ATmega48PA__",       0x0100, 0x0, 1)
+AVR_MCU ("atmega88",         ARCH_AVR4, AVR_ISA_NONE,  "__AVR_ATmega88__",         0x0100, 0x0, 1)
+AVR_MCU ("atmega88a",        ARCH_AVR4, AVR_ISA_NONE,  "__AVR_ATmega88A__",        0x0100, 0x0, 1)
+AVR_MCU ("atmega88p",        ARCH_AVR4, AVR_ISA_NONE,  "__AVR_ATmega88P__",        0x0100, 0x0, 1)
+AVR_MCU ("atmega88pa",       ARCH_AVR4, AVR_ISA_NONE,  "__AVR_ATmega88PA__",       0x0100, 0x0, 1)
+AVR_MCU ("atmega8515",       ARCH_AVR4, AVR_ISA_NONE,  "__AVR_ATmega8515__",       0x0060, 0x0, 1)
+AVR_MCU ("atmega8535",       ARCH_AVR4, AVR_ISA_NONE,  "__AVR_ATmega8535__",       0x0060, 0x0, 1)
+AVR_MCU ("atmega8hva",       ARCH_AVR4, AVR_ISA_NONE,  "__AVR_ATmega8HVA__",       0x0100, 0x0, 1)
+AVR_MCU ("at90pwm1",         ARCH_AVR4, AVR_ISA_NONE,  "__AVR_AT90PWM1__",         0x0100, 0x0, 1)
+AVR_MCU ("at90pwm2",         ARCH_AVR4, AVR_ISA_NONE,  "__AVR_AT90PWM2__",         0x0100, 0x0, 1)
+AVR_MCU ("at90pwm2b",        ARCH_AVR4, AVR_ISA_NONE,  "__AVR_AT90PWM2B__",        0x0100, 0x0, 1)
+AVR_MCU ("at90pwm3",         ARCH_AVR4, AVR_ISA_NONE,  "__AVR_AT90PWM3__",         0x0100, 0x0, 1)
+AVR_MCU ("at90pwm3b",        ARCH_AVR4, AVR_ISA_NONE,  "__AVR_AT90PWM3B__",        0x0100, 0x0, 1)
+AVR_MCU ("at90pwm81",        ARCH_AVR4, AVR_ISA_NONE,  "__AVR_AT90PWM81__",        0x0100, 0x0, 1)
 /* Enhanced, > 8K, <= 64K.  */
-AVR_MCU ("avr5",                 ARCH_AVR5, AVR_ISA_NONE, NULL,                        0x0060, 0x0, 1, "m16")
-AVR_MCU ("ata5702m322",          ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATA5702M322__",       0x0200, 0x0, 1, "a5702m322")
-AVR_MCU ("ata5782",              ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATA5782__",           0x0200, 0x8000, 1, "a5782")
-AVR_MCU ("ata5790",              ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATA5790__",           0x0100, 0x0, 1, "a5790")
-AVR_MCU ("ata5790n",             ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATA5790N__",          0x0100, 0x0, 1, "a5790n")
-AVR_MCU ("ata5795",              ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATA5795__",           0x0100, 0x0, 1, "a5795")
-AVR_MCU ("ata5831",              ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATA5831__",           0x0200, 0x8000, 1, "a5831")
-AVR_MCU ("ata6613c",             ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATA6613C__",          0x0100, 0x0, 1, "a6613c")
-AVR_MCU ("ata6614q",             ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATA6614Q__",          0x0100, 0x0, 1, "a6614q")
-AVR_MCU ("atmega16",             ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega16__",          0x0060, 0x0, 1, "m16")
-AVR_MCU ("atmega16a",            ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega16A__",         0x0060, 0x0, 1, "m16a")
-AVR_MCU ("atmega161",            ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega161__",         0x0060, 0x0, 1, "m161")
-AVR_MCU ("atmega162",            ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega162__",         0x0100, 0x0, 1, "m162")
-AVR_MCU ("atmega163",            ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega163__",         0x0060, 0x0, 1, "m163")
-AVR_MCU ("atmega164a",           ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega164A__",        0x0100, 0x0, 1, "m164a")
-AVR_MCU ("atmega164p",           ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega164P__",        0x0100, 0x0, 1, "m164p")
-AVR_MCU ("atmega164pa",          ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega164PA__",       0x0100, 0x0, 1, "m164pa")
-AVR_MCU ("atmega165",            ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega165__",         0x0100, 0x0, 1, "m165")
-AVR_MCU ("atmega165a",           ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega165A__",        0x0100, 0x0, 1, "m165a")
-AVR_MCU ("atmega165p",           ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega165P__",        0x0100, 0x0, 1, "m165p")
-AVR_MCU ("atmega165pa",          ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega165PA__",       0x0100, 0x0, 1, "m165pa")
-AVR_MCU ("atmega168",            ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega168__",         0x0100, 0x0, 1, "m168")
-AVR_MCU ("atmega168a",           ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega168A__",        0x0100, 0x0, 1, "m168a")
-AVR_MCU ("atmega168p",           ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega168P__",        0x0100, 0x0, 1, "m168p")
-AVR_MCU ("atmega168pa",          ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega168PA__",       0x0100, 0x0, 1, "m168pa")
-AVR_MCU ("atmega169",            ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega169__",         0x0100, 0x0, 1, "m169")
-AVR_MCU ("atmega169a",           ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega169A__",        0x0100, 0x0, 1, "m169a")
-AVR_MCU ("atmega169p",           ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega169P__",        0x0100, 0x0, 1, "m169p")
-AVR_MCU ("atmega169pa",          ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega169PA__",       0x0100, 0x0, 1, "m169pa")
-AVR_MCU ("atmega16hvb",          ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega16HVB__",       0x0100, 0x0, 1, "m16hvb")
-AVR_MCU ("atmega16hvbrevb",      ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega16HVBREVB__",   0x0100, 0x0, 1, "m16hvbrevb")
-AVR_MCU ("atmega16m1",           ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega16M1__",        0x0100, 0x0, 1, "m16m1")
-AVR_MCU ("atmega16u4",           ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega16U4__",        0x0100, 0x0, 1, "m16u4")
-AVR_MCU ("atmega32a",            ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega32A__",         0x0060, 0x0, 1, "m32a")
-AVR_MCU ("atmega32",             ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega32__",          0x0060, 0x0, 1, "m32")
-AVR_MCU ("atmega323",            ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega323__",         0x0060, 0x0, 1, "m323")
-AVR_MCU ("atmega324a",           ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega324A__",        0x0100, 0x0, 1, "m324a")
-AVR_MCU ("atmega324p",           ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega324P__",        0x0100, 0x0, 1, "m324p")
-AVR_MCU ("atmega324pa",          ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega324PA__",       0x0100, 0x0, 1, "m324pa")
-AVR_MCU ("atmega325",            ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega325__",         0x0100, 0x0, 1, "m325")
-AVR_MCU ("atmega325a",           ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega325A__",        0x0100, 0x0, 1, "m325a")
-AVR_MCU ("atmega325p",           ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega325P__",        0x0100, 0x0, 1, "m325p")
-AVR_MCU ("atmega325pa",          ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega325PA__",       0x0100, 0x0, 1, "m325pa")
-AVR_MCU ("atmega3250",           ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega3250__",        0x0100, 0x0, 1, "m3250")
-AVR_MCU ("atmega3250a",          ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega3250A__",       0x0100, 0x0, 1, "m3250a")
-AVR_MCU ("atmega3250p",          ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega3250P__",       0x0100, 0x0, 1, "m3250p")
-AVR_MCU ("atmega3250pa",         ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega3250PA__",      0x0100, 0x0, 1, "m3250pa")
-AVR_MCU ("atmega328",            ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega328__",         0x0100, 0x0, 1, "m328")
-AVR_MCU ("atmega328p",           ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega328P__",        0x0100, 0x0, 1, "m328p")
-AVR_MCU ("atmega329",            ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega329__",         0x0100, 0x0, 1, "m329")
-AVR_MCU ("atmega329a",           ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega329A__",        0x0100, 0x0, 1, "m329a")
-AVR_MCU ("atmega329p",           ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega329P__",        0x0100, 0x0, 1, "m329p")
-AVR_MCU ("atmega329pa",          ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega329PA__",       0x0100, 0x0, 1, "m329pa")
-AVR_MCU ("atmega3290",           ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega3290__",        0x0100, 0x0, 1, "m3290")
-AVR_MCU ("atmega3290a",          ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega3290A__",       0x0100, 0x0, 1, "m3290a")
-AVR_MCU ("atmega3290p",          ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega3290P__",       0x0100, 0x0, 1, "m3290p")
-AVR_MCU ("atmega3290pa",         ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega3290PA__",      0x0100, 0x0, 1, "m3290pa")
-AVR_MCU ("atmega32c1",           ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega32C1__",        0x0100, 0x0, 1, "m32c1")
-AVR_MCU ("atmega32m1",           ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega32M1__",        0x0100, 0x0, 1, "m32m1")
-AVR_MCU ("atmega32u4",           ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega32U4__",        0x0100, 0x0, 1, "m32u4")
-AVR_MCU ("atmega32u6",           ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega32U6__",        0x0100, 0x0, 1, "m32u6")
-AVR_MCU ("atmega406",            ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega406__",         0x0100, 0x0, 1, "m406")
-AVR_MCU ("atmega64",             ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega64__",          0x0100, 0x0, 1, "m64")
-AVR_MCU ("atmega64a",            ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega64A__",         0x0100, 0x0, 1, "m64a")
-AVR_MCU ("atmega640",            ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega640__",         0x0200, 0x0, 1, "m640")
-AVR_MCU ("atmega644",            ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega644__",         0x0100, 0x0, 1, "m644")
-AVR_MCU ("atmega644a",           ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega644A__",        0x0100, 0x0, 1, "m644a")
-AVR_MCU ("atmega644p",           ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega644P__",        0x0100, 0x0, 1, "m644p")
-AVR_MCU ("atmega644pa",          ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega644PA__",       0x0100, 0x0, 1, "m644pa")
-AVR_MCU ("atmega645",            ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega645__",         0x0100, 0x0, 1, "m645")
-AVR_MCU ("atmega645a",           ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega645A__",        0x0100, 0x0, 1, "m645a")
-AVR_MCU ("atmega645p",           ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega645P__",        0x0100, 0x0, 1, "m645p")
-AVR_MCU ("atmega6450",           ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega6450__",        0x0100, 0x0, 1, "m6450")
-AVR_MCU ("atmega6450a",          ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega6450A__",       0x0100, 0x0, 1, "m6450a")
-AVR_MCU ("atmega6450p",          ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega6450P__",       0x0100, 0x0, 1, "m6450p")
-AVR_MCU ("atmega649",            ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega649__",         0x0100, 0x0, 1, "m649")
-AVR_MCU ("atmega649a",           ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega649A__",        0x0100, 0x0, 1, "m649a")
-AVR_MCU ("atmega649p",           ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega649P__",        0x0100, 0x0, 1, "m649p")
-AVR_MCU ("atmega6490",           ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega6490__",        0x0100, 0x0, 1, "m6490")
-AVR_MCU ("atmega16hva",          ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega16HVA__",       0x0100, 0x0, 1, "m16hva")
-AVR_MCU ("atmega16hva2",         ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega16HVA2__",      0x0100, 0x0, 1, "m16hva2")
-AVR_MCU ("atmega32hvb",          ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega32HVB__",       0x0100, 0x0, 1, "m32hvb")
-AVR_MCU ("atmega6490a",          ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega6490A__",       0x0100, 0x0, 1, "m6490a")
-AVR_MCU ("atmega6490p",          ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega6490P__",       0x0100, 0x0, 1, "m6490p")
-AVR_MCU ("atmega64c1",           ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega64C1__",        0x0100, 0x0, 1, "m64c1")
-AVR_MCU ("atmega64m1",           ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega64M1__",        0x0100, 0x0, 1, "m64m1")
-AVR_MCU ("atmega64hve",          ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega64HVE__",       0x0100, 0x0, 1, "m64hve")
-AVR_MCU ("atmega64hve2",         ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega64HVE2__",      0x0100, 0x0, 1, "m64hve2")
-AVR_MCU ("atmega64rfr2",         ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega64RFR2__",      0x0200, 0x0, 1, "m64rfr2")
-AVR_MCU ("atmega644rfr2",        ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega644RFR2__",     0x0200, 0x0, 1, "m644rfr2")
-AVR_MCU ("atmega32hvbrevb",      ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega32HVBREVB__",   0x0100, 0x0, 1, "m32hvbrevb")
-AVR_MCU ("at90can32",            ARCH_AVR5, AVR_ISA_NONE, "__AVR_AT90CAN32__",         0x0100, 0x0, 1, "can32")
-AVR_MCU ("at90can64",            ARCH_AVR5, AVR_ISA_NONE, "__AVR_AT90CAN64__",         0x0100, 0x0, 1, "can64")
-AVR_MCU ("at90pwm161",           ARCH_AVR5, AVR_ISA_NONE, "__AVR_AT90PWM161__",        0x0100, 0x0, 1, "90pwm161")
-AVR_MCU ("at90pwm216",           ARCH_AVR5, AVR_ISA_NONE, "__AVR_AT90PWM216__",        0x0100, 0x0, 1, "90pwm216")
-AVR_MCU ("at90pwm316",           ARCH_AVR5, AVR_ISA_NONE, "__AVR_AT90PWM316__",        0x0100, 0x0, 1, "90pwm316")
-AVR_MCU ("at90scr100",           ARCH_AVR5, AVR_ISA_NONE, "__AVR_AT90SCR100__",        0x0100, 0x0, 1, "90scr100")
-AVR_MCU ("at90usb646",           ARCH_AVR5, AVR_ISA_NONE, "__AVR_AT90USB646__",        0x0100, 0x0, 1, "usb646")
-AVR_MCU ("at90usb647",           ARCH_AVR5, AVR_ISA_NONE, "__AVR_AT90USB647__",        0x0100, 0x0, 1, "usb647")
-AVR_MCU ("at94k",                ARCH_AVR5, AVR_ISA_NONE, "__AVR_AT94K__",             0x0060, 0x0, 1, "at94k")
-AVR_MCU ("m3000",                ARCH_AVR5, AVR_ISA_NONE, "__AVR_M3000__",             0x1000, 0x0, 1, "m3000")
+AVR_MCU ("avr5",             ARCH_AVR5, AVR_ISA_NONE, NULL,                        0x0060, 0x0, 1)
+AVR_MCU ("ata5702m322",      ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATA5702M322__",       0x0200, 0x0, 1)
+AVR_MCU ("ata5782",          ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATA5782__",           0x0200, 0x8000, 1)
+AVR_MCU ("ata5790",          ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATA5790__",           0x0100, 0x0, 1)
+AVR_MCU ("ata5790n",         ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATA5790N__",          0x0100, 0x0, 1)
+AVR_MCU ("ata5795",          ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATA5795__",           0x0100, 0x0, 1)
+AVR_MCU ("ata5831",          ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATA5831__",           0x0200, 0x8000, 1)
+AVR_MCU ("ata6613c",         ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATA6613C__",          0x0100, 0x0, 1)
+AVR_MCU ("ata6614q",         ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATA6614Q__",          0x0100, 0x0, 1)
+AVR_MCU ("atmega16",         ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega16__",          0x0060, 0x0, 1)
+AVR_MCU ("atmega16a",        ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega16A__",         0x0060, 0x0, 1)
+AVR_MCU ("atmega161",        ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega161__",         0x0060, 0x0, 1)
+AVR_MCU ("atmega162",        ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega162__",         0x0100, 0x0, 1)
+AVR_MCU ("atmega163",        ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega163__",         0x0060, 0x0, 1)
+AVR_MCU ("atmega164a",       ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega164A__",        0x0100, 0x0, 1)
+AVR_MCU ("atmega164p",       ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega164P__",        0x0100, 0x0, 1)
+AVR_MCU ("atmega164pa",      ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega164PA__",       0x0100, 0x0, 1)
+AVR_MCU ("atmega165",        ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega165__",         0x0100, 0x0, 1)
+AVR_MCU ("atmega165a",       ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega165A__",        0x0100, 0x0, 1)
+AVR_MCU ("atmega165p",       ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega165P__",        0x0100, 0x0, 1)
+AVR_MCU ("atmega165pa",      ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega165PA__",       0x0100, 0x0, 1)
+AVR_MCU ("atmega168",        ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega168__",         0x0100, 0x0, 1)
+AVR_MCU ("atmega168a",       ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega168A__",        0x0100, 0x0, 1)
+AVR_MCU ("atmega168p",       ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega168P__",        0x0100, 0x0, 1)
+AVR_MCU ("atmega168pa",      ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega168PA__",       0x0100, 0x0, 1)
+AVR_MCU ("atmega169",        ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega169__",         0x0100, 0x0, 1)
+AVR_MCU ("atmega169a",       ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega169A__",        0x0100, 0x0, 1)
+AVR_MCU ("atmega169p",       ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega169P__",        0x0100, 0x0, 1)
+AVR_MCU ("atmega169pa",      ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega169PA__",       0x0100, 0x0, 1)
+AVR_MCU ("atmega16hvb",      ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega16HVB__",       0x0100, 0x0, 1)
+AVR_MCU ("atmega16hvbrevb",  ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega16HVBREVB__",   0x0100, 0x0, 1)
+AVR_MCU ("atmega16m1",       ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega16M1__",        0x0100, 0x0, 1)
+AVR_MCU ("atmega16u4",       ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega16U4__",        0x0100, 0x0, 1)
+AVR_MCU ("atmega32a",        ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega32A__",         0x0060, 0x0, 1)
+AVR_MCU ("atmega32",         ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega32__",          0x0060, 0x0, 1)
+AVR_MCU ("atmega323",        ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega323__",         0x0060, 0x0, 1)
+AVR_MCU ("atmega324a",       ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega324A__",        0x0100, 0x0, 1)
+AVR_MCU ("atmega324p",       ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega324P__",        0x0100, 0x0, 1)
+AVR_MCU ("atmega324pa",      ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega324PA__",       0x0100, 0x0, 1)
+AVR_MCU ("atmega325",        ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega325__",         0x0100, 0x0, 1)
+AVR_MCU ("atmega325a",       ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega325A__",        0x0100, 0x0, 1)
+AVR_MCU ("atmega325p",       ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega325P__",        0x0100, 0x0, 1)
+AVR_MCU ("atmega325pa",      ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega325PA__",       0x0100, 0x0, 1)
+AVR_MCU ("atmega3250",       ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega3250__",        0x0100, 0x0, 1)
+AVR_MCU ("atmega3250a",      ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega3250A__",       0x0100, 0x0, 1)
+AVR_MCU ("atmega3250p",      ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega3250P__",       0x0100, 0x0, 1)
+AVR_MCU ("atmega3250pa",     ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega3250PA__",      0x0100, 0x0, 1)
+AVR_MCU ("atmega328",        ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega328__",         0x0100, 0x0, 1)
+AVR_MCU ("atmega328p",       ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega328P__",        0x0100, 0x0, 1)
+AVR_MCU ("atmega329",        ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega329__",         0x0100, 0x0, 1)
+AVR_MCU ("atmega329a",       ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega329A__",        0x0100, 0x0, 1)
+AVR_MCU ("atmega329p",       ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega329P__",        0x0100, 0x0, 1)
+AVR_MCU ("atmega329pa",      ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega329PA__",       0x0100, 0x0, 1)
+AVR_MCU ("atmega3290",       ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega3290__",        0x0100, 0x0, 1)
+AVR_MCU ("atmega3290a",      ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega3290A__",       0x0100, 0x0, 1)
+AVR_MCU ("atmega3290p",      ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega3290P__",       0x0100, 0x0, 1)
+AVR_MCU ("atmega3290pa",     ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega3290PA__",      0x0100, 0x0, 1)
+AVR_MCU ("atmega32c1",       ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega32C1__",        0x0100, 0x0, 1)
+AVR_MCU ("atmega32m1",       ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega32M1__",        0x0100, 0x0, 1)
+AVR_MCU ("atmega32u4",       ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega32U4__",        0x0100, 0x0, 1)
+AVR_MCU ("atmega32u6",       ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega32U6__",        0x0100, 0x0, 1)
+AVR_MCU ("atmega406",        ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega406__",         0x0100, 0x0, 1)
+AVR_MCU ("atmega64",         ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega64__",          0x0100, 0x0, 1)
+AVR_MCU ("atmega64a",        ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega64A__",         0x0100, 0x0, 1)
+AVR_MCU ("atmega640",        ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega640__",         0x0200, 0x0, 1)
+AVR_MCU ("atmega644",        ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega644__",         0x0100, 0x0, 1)
+AVR_MCU ("atmega644a",       ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega644A__",        0x0100, 0x0, 1)
+AVR_MCU ("atmega644p",       ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega644P__",        0x0100, 0x0, 1)
+AVR_MCU ("atmega644pa",      ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega644PA__",       0x0100, 0x0, 1)
+AVR_MCU ("atmega645",        ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega645__",         0x0100, 0x0, 1)
+AVR_MCU ("atmega645a",       ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega645A__",        0x0100, 0x0, 1)
+AVR_MCU ("atmega645p",       ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega645P__",        0x0100, 0x0, 1)
+AVR_MCU ("atmega6450",       ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega6450__",        0x0100, 0x0, 1)
+AVR_MCU ("atmega6450a",      ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega6450A__",       0x0100, 0x0, 1)
+AVR_MCU ("atmega6450p",      ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega6450P__",       0x0100, 0x0, 1)
+AVR_MCU ("atmega649",        ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega649__",         0x0100, 0x0, 1)
+AVR_MCU ("atmega649a",       ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega649A__",        0x0100, 0x0, 1)
+AVR_MCU ("atmega649p",       ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega649P__",        0x0100, 0x0, 1)
+AVR_MCU ("atmega6490",       ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega6490__",        0x0100, 0x0, 1)
+AVR_MCU ("atmega16hva",      ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega16HVA__",       0x0100, 0x0, 1)
+AVR_MCU ("atmega16hva2",     ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega16HVA2__",      0x0100, 0x0, 1)
+AVR_MCU ("atmega32hvb",      ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega32HVB__",       0x0100, 0x0, 1)
+AVR_MCU ("atmega6490a",      ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega6490A__",       0x0100, 0x0, 1)
+AVR_MCU ("atmega6490p",      ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega6490P__",       0x0100, 0x0, 1)
+AVR_MCU ("atmega64c1",       ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega64C1__",        0x0100, 0x0, 1)
+AVR_MCU ("atmega64m1",       ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega64M1__",        0x0100, 0x0, 1)
+AVR_MCU ("atmega64hve",      ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega64HVE__",       0x0100, 0x0, 1)
+AVR_MCU ("atmega64hve2",     ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega64HVE2__",      0x0100, 0x0, 1)
+AVR_MCU ("atmega64rfr2",     ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega64RFR2__",      0x0200, 0x0, 1)
+AVR_MCU ("atmega644rfr2",    ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega644RFR2__",     0x0200, 0x0, 1)
+AVR_MCU ("atmega32hvbrevb",  ARCH_AVR5, AVR_ISA_NONE, "__AVR_ATmega32HVBREVB__",   0x0100, 0x0, 1)
+AVR_MCU ("at90can32",        ARCH_AVR5, AVR_ISA_NONE, "__AVR_AT90CAN32__",         0x0100, 0x0, 1)
+AVR_MCU ("at90can64",        ARCH_AVR5, AVR_ISA_NONE, "__AVR_AT90CAN64__",         0x0100, 0x0, 1)
+AVR_MCU ("at90pwm161",       ARCH_AVR5, AVR_ISA_NONE, "__AVR_AT90PWM161__",        0x0100, 0x0, 1)
+AVR_MCU ("at90pwm216",       ARCH_AVR5, AVR_ISA_NONE, "__AVR_AT90PWM216__",        0x0100, 0x0, 1)
+AVR_MCU ("at90pwm316",       ARCH_AVR5, AVR_ISA_NONE, "__AVR_AT90PWM316__",        0x0100, 0x0, 1)
+AVR_MCU ("at90scr100",       ARCH_AVR5, AVR_ISA_NONE, "__AVR_AT90SCR100__",        0x0100, 0x0, 1)
+AVR_MCU ("at90usb646",       ARCH_AVR5, AVR_ISA_NONE, "__AVR_AT90USB646__",        0x0100, 0x0, 1)
+AVR_MCU ("at90usb647",       ARCH_AVR5, AVR_ISA_NONE, "__AVR_AT90USB647__",        0x0100, 0x0, 1)
+AVR_MCU ("at94k",            ARCH_AVR5, AVR_ISA_NONE, "__AVR_AT94K__",             0x0060, 0x0, 1)
+AVR_MCU ("m3000",            ARCH_AVR5, AVR_ISA_NONE, "__AVR_M3000__",             0x1000, 0x0, 1)
 /* Enhanced, == 128K.  */
-AVR_MCU ("avr51",                ARCH_AVR51, AVR_ISA_NONE, NULL,                       0x0100, 0x0, 2, "m128")
-AVR_MCU ("atmega128",            ARCH_AVR51, AVR_ISA_NONE, "__AVR_ATmega128__",        0x0100, 0x0, 2, "m128")
-AVR_MCU ("atmega128a",           ARCH_AVR51, AVR_ISA_NONE, "__AVR_ATmega128A__",       0x0100, 0x0, 2, "m128a")
-AVR_MCU ("atmega1280",           ARCH_AVR51, AVR_ISA_NONE, "__AVR_ATmega1280__",       0x0200, 0x0, 2, "m1280")
-AVR_MCU ("atmega1281",           ARCH_AVR51, AVR_ISA_NONE, "__AVR_ATmega1281__",       0x0200, 0x0, 2, "m1281")
-AVR_MCU ("atmega1284",           ARCH_AVR51, AVR_ISA_NONE, "__AVR_ATmega1284__",       0x0100, 0x0, 2, "m1284")
-AVR_MCU ("atmega1284p",          ARCH_AVR51, AVR_ISA_NONE, "__AVR_ATmega1284P__",      0x0100, 0x0, 2, "m1284p")
-AVR_MCU ("atmega128rfa1",        ARCH_AVR51, AVR_ISA_NONE, "__AVR_ATmega128RFA1__",    0x0200, 0x0, 2, "m128rfa1")
-AVR_MCU ("atmega128rfr2",        ARCH_AVR51, AVR_ISA_NONE, "__AVR_ATmega128RFR2__",    0x0200, 0x0, 2, "m128rfr2")
-AVR_MCU ("atmega1284rfr2",       ARCH_AVR51, AVR_ISA_NONE, "__AVR_ATmega1284RFR2__",   0x0200, 0x0, 2, "m1284rfr2")
-AVR_MCU ("at90can128",           ARCH_AVR51, AVR_ISA_NONE, "__AVR_AT90CAN128__",       0x0100, 0x0, 2, "can128")
-AVR_MCU ("at90usb1286",          ARCH_AVR51, AVR_ISA_NONE, "__AVR_AT90USB1286__",      0x0100, 0x0, 2, "usb1286")
-AVR_MCU ("at90usb1287",          ARCH_AVR51, AVR_ISA_NONE, "__AVR_AT90USB1287__",      0x0100, 0x0, 2, "usb1287")
+AVR_MCU ("avr51",            ARCH_AVR51, AVR_ISA_NONE, NULL,                       0x0100, 0x0, 2)
+AVR_MCU ("atmega128",        ARCH_AVR51, AVR_ISA_NONE, "__AVR_ATmega128__",        0x0100, 0x0, 2)
+AVR_MCU ("atmega128a",       ARCH_AVR51, AVR_ISA_NONE, "__AVR_ATmega128A__",       0x0100, 0x0, 2)
+AVR_MCU ("atmega1280",       ARCH_AVR51, AVR_ISA_NONE, "__AVR_ATmega1280__",       0x0200, 0x0, 2)
+AVR_MCU ("atmega1281",       ARCH_AVR51, AVR_ISA_NONE, "__AVR_ATmega1281__",       0x0200, 0x0, 2)
+AVR_MCU ("atmega1284",       ARCH_AVR51, AVR_ISA_NONE, "__AVR_ATmega1284__",       0x0100, 0x0, 2)
+AVR_MCU ("atmega1284p",      ARCH_AVR51, AVR_ISA_NONE, "__AVR_ATmega1284P__",      0x0100, 0x0, 2)
+AVR_MCU ("atmega128rfa1",    ARCH_AVR51, AVR_ISA_NONE, "__AVR_ATmega128RFA1__",    0x0200, 0x0, 2)
+AVR_MCU ("atmega128rfr2",    ARCH_AVR51, AVR_ISA_NONE, "__AVR_ATmega128RFR2__",    0x0200, 0x0, 2)
+AVR_MCU ("atmega1284rfr2",   ARCH_AVR51, AVR_ISA_NONE, "__AVR_ATmega1284RFR2__",   0x0200, 0x0, 2)
+AVR_MCU ("at90can128",       ARCH_AVR51, AVR_ISA_NONE, "__AVR_AT90CAN128__",       0x0100, 0x0, 2)
+AVR_MCU ("at90usb1286",      ARCH_AVR51, AVR_ISA_NONE, "__AVR_AT90USB1286__",      0x0100, 0x0, 2)
+AVR_MCU ("at90usb1287",      ARCH_AVR51, AVR_ISA_NONE, "__AVR_AT90USB1287__",      0x0100, 0x0, 2)
 /* 3-Byte PC.  */
-AVR_MCU ("avr6",                 ARCH_AVR6, AVR_ISA_NONE, NULL,                        0x0200, 0x0, 4, "m2561")
-AVR_MCU ("atmega2560",           ARCH_AVR6, AVR_ISA_NONE, "__AVR_ATmega2560__",        0x0200, 0x0, 4, "m2560")
-AVR_MCU ("atmega2561",           ARCH_AVR6, AVR_ISA_NONE, "__AVR_ATmega2561__",        0x0200, 0x0, 4, "m2561")
-AVR_MCU ("atmega256rfr2",        ARCH_AVR6, AVR_ISA_NONE, "__AVR_ATmega256RFR2__",     0x0200, 0x0, 4, "m256rfr2")
-AVR_MCU ("atmega2564rfr2",       ARCH_AVR6, AVR_ISA_NONE, "__AVR_ATmega2564RFR2__",    0x0200, 0x0, 4, "m2564rfr2")
+AVR_MCU ("avr6",             ARCH_AVR6, AVR_ISA_NONE, NULL,                        0x0200, 0x0, 4)
+AVR_MCU ("atmega2560",       ARCH_AVR6, AVR_ISA_NONE, "__AVR_ATmega2560__",        0x0200, 0x0, 4)
+AVR_MCU ("atmega2561",       ARCH_AVR6, AVR_ISA_NONE, "__AVR_ATmega2561__",        0x0200, 0x0, 4)
+AVR_MCU ("atmega256rfr2",    ARCH_AVR6, AVR_ISA_NONE, "__AVR_ATmega256RFR2__",     0x0200, 0x0, 4)
+AVR_MCU ("atmega2564rfr2",   ARCH_AVR6, AVR_ISA_NONE, "__AVR_ATmega2564RFR2__",    0x0200, 0x0, 4)
 /* Xmega, 16K <= Flash < 64K, RAM <= 64K */
-AVR_MCU ("avrxmega2",        ARCH_AVRXMEGA2, AVR_ISA_NONE, NULL,                       0x2000, 0x0, 1, "x32a4")
-AVR_MCU ("atxmega8e5",       ARCH_AVRXMEGA2, AVR_ISA_NONE, "__AVR_ATxmega8E5__",       0x2000, 0x0, 1, "x8e5")
-AVR_MCU ("atxmega16a4",      ARCH_AVRXMEGA2, AVR_ISA_NONE, "__AVR_ATxmega16A4__",      0x2000, 0x0, 1, "x16a4")
-AVR_MCU ("atxmega16d4",      ARCH_AVRXMEGA2, AVR_ISA_NONE, "__AVR_ATxmega16D4__",      0x2000, 0x0, 1, "x16d4")
-AVR_MCU ("atxmega16e5",      ARCH_AVRXMEGA2, AVR_ISA_NONE, "__AVR_ATxmega16E5__",      0x2000, 0x0, 1, "x16e5")
-AVR_MCU ("atxmega32a4",      ARCH_AVRXMEGA2, AVR_ISA_NONE, "__AVR_ATxmega32A4__",      0x2000, 0x0, 1, "x32a4")
-AVR_MCU ("atxmega32c3",      ARCH_AVRXMEGA2, AVR_ISA_RMW,  "__AVR_ATxmega32C3__",      0x2000, 0x0, 1, "x32c3")
-AVR_MCU ("atxmega32d3",      ARCH_AVRXMEGA2, AVR_ISA_NONE, "__AVR_ATxmega32D3__",      0x2000, 0x0, 1, "x32d3")
-AVR_MCU ("atxmega32d4",      ARCH_AVRXMEGA2, AVR_ISA_NONE, "__AVR_ATxmega32D4__",      0x2000, 0x0, 1, "x32d4")
-AVR_MCU ("atxmega16a4u",     ARCH_AVRXMEGA2, AVR_ISA_RMW,  "__AVR_ATxmega16A4U__",     0x2000, 0x0, 1, "x16a4u")
-AVR_MCU ("atxmega16c4",      ARCH_AVRXMEGA2, AVR_ISA_RMW,  "__AVR_ATxmega16C4__",      0x2000, 0x0, 1, "x16c4")
-AVR_MCU ("atxmega32a4u",     ARCH_AVRXMEGA2, AVR_ISA_RMW,  "__AVR_ATxmega32A4U__",     0x2000, 0x0, 1, "x32a4u")
-AVR_MCU ("atxmega32c4",      ARCH_AVRXMEGA2, AVR_ISA_RMW,  "__AVR_ATxmega32C4__",      0x2000, 0x0, 1, "x32c4")
-AVR_MCU ("atxmega32e5",      ARCH_AVRXMEGA2, AVR_ISA_NONE, "__AVR_ATxmega32E5__",      0x2000, 0x0, 1, "x32e5")
+AVR_MCU ("avrxmega2",        ARCH_AVRXMEGA2, AVR_ISA_NONE, NULL,                   0x2000, 0x0, 1)
+AVR_MCU ("atxmega8e5",       ARCH_AVRXMEGA2, AVR_ISA_NONE, "__AVR_ATxmega8E5__",   0x2000, 0x0, 1)
+AVR_MCU ("atxmega16a4",      ARCH_AVRXMEGA2, AVR_ISA_NONE, "__AVR_ATxmega16A4__",  0x2000, 0x0, 1)
+AVR_MCU ("atxmega16d4",      ARCH_AVRXMEGA2, AVR_ISA_NONE, "__AVR_ATxmega16D4__",  0x2000, 0x0, 1)
+AVR_MCU ("atxmega16e5",      ARCH_AVRXMEGA2, AVR_ISA_NONE, "__AVR_ATxmega16E5__",  0x2000, 0x0, 1)
+AVR_MCU ("atxmega32a4",      ARCH_AVRXMEGA2, AVR_ISA_NONE, "__AVR_ATxmega32A4__",  0x2000, 0x0, 1)
+AVR_MCU ("atxmega32c3",      ARCH_AVRXMEGA2, AVR_ISA_RMW,  "__AVR_ATxmega32C3__",  0x2000, 0x0, 1)
+AVR_MCU ("atxmega32d3",      ARCH_AVRXMEGA2, AVR_ISA_NONE, "__AVR_ATxmega32D3__",  0x2000, 0x0, 1)
+AVR_MCU ("atxmega32d4",      ARCH_AVRXMEGA2, AVR_ISA_NONE, "__AVR_ATxmega32D4__",  0x2000, 0x0, 1)
+AVR_MCU ("atxmega16a4u",     ARCH_AVRXMEGA2, AVR_ISA_RMW,  "__AVR_ATxmega16A4U__", 0x2000, 0x0, 1)
+AVR_MCU ("atxmega16c4",      ARCH_AVRXMEGA2, AVR_ISA_RMW,  "__AVR_ATxmega16C4__",  0x2000, 0x0, 1)
+AVR_MCU ("atxmega32a4u",     ARCH_AVRXMEGA2, AVR_ISA_RMW,  "__AVR_ATxmega32A4U__", 0x2000, 0x0, 1)
+AVR_MCU ("atxmega32c4",      ARCH_AVRXMEGA2, AVR_ISA_RMW,  "__AVR_ATxmega32C4__",  0x2000, 0x0, 1)
+AVR_MCU ("atxmega32e5",      ARCH_AVRXMEGA2, AVR_ISA_NONE, "__AVR_ATxmega32E5__",  0x2000, 0x0, 1)
 /* Xmega, 64K < Flash <= 128K, RAM <= 64K */
-AVR_MCU ("avrxmega4",        ARCH_AVRXMEGA4, AVR_ISA_NONE, NULL,                       0x2000, 0x0, 2, "x64a4")
-AVR_MCU ("atxmega64a3",      ARCH_AVRXMEGA4, AVR_ISA_NONE, "__AVR_ATxmega64A3__",      0x2000, 0x0, 2, "x64a3")
-AVR_MCU ("atxmega64d3",      ARCH_AVRXMEGA4, AVR_ISA_NONE, "__AVR_ATxmega64D3__",      0x2000, 0x0, 2, "x64d3")
-AVR_MCU ("atxmega64a3u",     ARCH_AVRXMEGA4, AVR_ISA_RMW,  "__AVR_ATxmega64A3U__",     0x2000, 0x0, 2, "x64a3u")
-AVR_MCU ("atxmega64a4u",     ARCH_AVRXMEGA4, AVR_ISA_RMW,  "__AVR_ATxmega64A4U__",     0x2000, 0x0, 2, "x64a4u")
-AVR_MCU ("atxmega64b1",      ARCH_AVRXMEGA4, AVR_ISA_RMW,  "__AVR_ATxmega64B1__",      0x2000, 0x0, 2, "x64b1")
-AVR_MCU ("atxmega64b3",      ARCH_AVRXMEGA4, AVR_ISA_RMW,  "__AVR_ATxmega64B3__",      0x2000, 0x0, 2, "x64b3")
-AVR_MCU ("atxmega64c3",      ARCH_AVRXMEGA4, AVR_ISA_RMW,  "__AVR_ATxmega64C3__",      0x2000, 0x0, 2, "x64c3")
-AVR_MCU ("atxmega64d4",      ARCH_AVRXMEGA4, AVR_ISA_NONE, "__AVR_ATxmega64D4__",      0x2000, 0x0, 2, "x64d4")
+AVR_MCU ("avrxmega4",        ARCH_AVRXMEGA4, AVR_ISA_NONE, NULL,                   0x2000, 0x0, 2)
+AVR_MCU ("atxmega64a3",      ARCH_AVRXMEGA4, AVR_ISA_NONE, "__AVR_ATxmega64A3__",  0x2000, 0x0, 2)
+AVR_MCU ("atxmega64d3",      ARCH_AVRXMEGA4, AVR_ISA_NONE, "__AVR_ATxmega64D3__",  0x2000, 0x0, 2)
+AVR_MCU ("atxmega64a3u",     ARCH_AVRXMEGA4, AVR_ISA_RMW,  "__AVR_ATxmega64A3U__", 0x2000, 0x0, 2)
+AVR_MCU ("atxmega64a4u",     ARCH_AVRXMEGA4, AVR_ISA_RMW,  "__AVR_ATxmega64A4U__", 0x2000, 0x0, 2)
+AVR_MCU ("atxmega64b1",      ARCH_AVRXMEGA4, AVR_ISA_RMW,  "__AVR_ATxmega64B1__",  0x2000, 0x0, 2)
+AVR_MCU ("atxmega64b3",      ARCH_AVRXMEGA4, AVR_ISA_RMW,  "__AVR_ATxmega64B3__",  0x2000, 0x0, 2)
+AVR_MCU ("atxmega64c3",      ARCH_AVRXMEGA4, AVR_ISA_RMW,  "__AVR_ATxmega64C3__",  0x2000, 0x0, 2)
+AVR_MCU ("atxmega64d4",      ARCH_AVRXMEGA4, AVR_ISA_NONE, "__AVR_ATxmega64D4__",  0x2000, 0x0, 2)
 /* Xmega, 64K < Flash <= 128K, RAM > 64K */
-AVR_MCU ("avrxmega5",        ARCH_AVRXMEGA5, AVR_ISA_NONE, NULL,                       0x2000, 0x0, 2, "x64a1")
-AVR_MCU ("atxmega64a1",      ARCH_AVRXMEGA5, AVR_ISA_NONE, "__AVR_ATxmega64A1__",      0x2000, 0x0, 2, "x64a1")
-AVR_MCU ("atxmega64a1u",     ARCH_AVRXMEGA5, AVR_ISA_RMW,  "__AVR_ATxmega64A1U__",     0x2000, 0x0, 2, "x64a1u")
+AVR_MCU ("avrxmega5",        ARCH_AVRXMEGA5, AVR_ISA_NONE, NULL,                   0x2000, 0x0, 2)
+AVR_MCU ("atxmega64a1",      ARCH_AVRXMEGA5, AVR_ISA_NONE, "__AVR_ATxmega64A1__",  0x2000, 0x0, 2)
+AVR_MCU ("atxmega64a1u",     ARCH_AVRXMEGA5, AVR_ISA_RMW,  "__AVR_ATxmega64A1U__", 0x2000, 0x0, 2)
 /* Xmega, 128K < Flash, RAM <= 64K */
-AVR_MCU ("avrxmega6",        ARCH_AVRXMEGA6, AVR_ISA_NONE, NULL,                       0x2000, 0x0, 6, "x128a3")
-AVR_MCU ("atxmega128a3",     ARCH_AVRXMEGA6, AVR_ISA_NONE, "__AVR_ATxmega128A3__",     0x2000, 0x0, 3, "x128a3")
-AVR_MCU ("atxmega128d3",     ARCH_AVRXMEGA6, AVR_ISA_NONE, "__AVR_ATxmega128D3__",     0x2000, 0x0, 3, "x128d3")
-AVR_MCU ("atxmega192a3",     ARCH_AVRXMEGA6, AVR_ISA_NONE, "__AVR_ATxmega192A3__",     0x2000, 0x0, 4, "x192a3")
-AVR_MCU ("atxmega192d3",     ARCH_AVRXMEGA6, AVR_ISA_NONE, "__AVR_ATxmega192D3__",     0x2000, 0x0, 4, "x192d3")
-AVR_MCU ("atxmega256a3",     ARCH_AVRXMEGA6, AVR_ISA_NONE, "__AVR_ATxmega256A3__",     0x2000, 0x0, 5, "x256a3")
-AVR_MCU ("atxmega256a3b",    ARCH_AVRXMEGA6, AVR_ISA_NONE, "__AVR_ATxmega256A3B__",    0x2000, 0x0, 5, "x256a3b")
-AVR_MCU ("atxmega256a3bu",   ARCH_AVRXMEGA6, AVR_ISA_NONE, "__AVR_ATxmega256A3BU__",   0x2000, 0x0, 5, "x256a3bu")
-AVR_MCU ("atxmega256d3",     ARCH_AVRXMEGA6, AVR_ISA_NONE, "__AVR_ATxmega256D3__",     0x2000, 0x0, 5, "x256d3")
-AVR_MCU ("atxmega128a3u",    ARCH_AVRXMEGA6, AVR_ISA_RMW, "__AVR_ATxmega128A3U__",    0x2000, 0x0, 3, "x128a3u")
-AVR_MCU ("atxmega128b1",     ARCH_AVRXMEGA6, AVR_ISA_RMW,  "__AVR_ATxmega128B1__",     0x2000, 0x0, 3, "x128b1")
-AVR_MCU ("atxmega128b3",     ARCH_AVRXMEGA6, AVR_ISA_RMW,  "__AVR_ATxmega128B3__",     0x2000, 0x0, 3, "x128b3")
-AVR_MCU ("atxmega128c3",     ARCH_AVRXMEGA6, AVR_ISA_RMW,  "__AVR_ATxmega128C3__",     0x2000, 0x0, 3, "x128c3")
-AVR_MCU ("atxmega128d4",     ARCH_AVRXMEGA6, AVR_ISA_NONE, "__AVR_ATxmega128D4__",     0x2000, 0x0, 3, "x128d4")
-AVR_MCU ("atxmega192a3u",    ARCH_AVRXMEGA6, AVR_ISA_RMW,  "__AVR_ATxmega192A3U__",    0x2000, 0x0, 4, "x192a3u")
-AVR_MCU ("atxmega192c3",     ARCH_AVRXMEGA6, AVR_ISA_RMW,  "__AVR_ATxmega192C3__",     0x2000, 0x0, 4, "x192c3")
-AVR_MCU ("atxmega256a3u",    ARCH_AVRXMEGA6, AVR_ISA_RMW,  "__AVR_ATxmega256A3U__",    0x2000, 0x0, 5, "x256a3u")
-AVR_MCU ("atxmega256c3",     ARCH_AVRXMEGA6, AVR_ISA_RMW,  "__AVR_ATxmega256C3__",     0x2000, 0x0, 5, "x256c3")
-AVR_MCU ("atxmega384c3",     ARCH_AVRXMEGA6, AVR_ISA_RMW,  "__AVR_ATxmega384C3__",     0x2000, 0x0, 6, "x384c3")
-AVR_MCU ("atxmega384d3",     ARCH_AVRXMEGA6, AVR_ISA_NONE, "__AVR_ATxmega384D3__",     0x2000, 0x0, 6, "x384d3")
+AVR_MCU ("avrxmega6",        ARCH_AVRXMEGA6, AVR_ISA_NONE, NULL,                       0x2000, 0x0, 6)
+AVR_MCU ("atxmega128a3",     ARCH_AVRXMEGA6, AVR_ISA_NONE, "__AVR_ATxmega128A3__",     0x2000, 0x0, 3)
+AVR_MCU ("atxmega128d3",     ARCH_AVRXMEGA6, AVR_ISA_NONE, "__AVR_ATxmega128D3__",     0x2000, 0x0, 3)
+AVR_MCU ("atxmega192a3",     ARCH_AVRXMEGA6, AVR_ISA_NONE, "__AVR_ATxmega192A3__",     0x2000, 0x0, 4)
+AVR_MCU ("atxmega192d3",     ARCH_AVRXMEGA6, AVR_ISA_NONE, "__AVR_ATxmega192D3__",     0x2000, 0x0, 4)
+AVR_MCU ("atxmega256a3",     ARCH_AVRXMEGA6, AVR_ISA_NONE, "__AVR_ATxmega256A3__",     0x2000, 0x0, 5)
+AVR_MCU ("atxmega256a3b",    ARCH_AVRXMEGA6, AVR_ISA_NONE, "__AVR_ATxmega256A3B__",    0x2000, 0x0, 5)
+AVR_MCU ("atxmega256a3bu",   ARCH_AVRXMEGA6, AVR_ISA_NONE, "__AVR_ATxmega256A3BU__",   0x2000, 0x0, 5)
+AVR_MCU ("atxmega256d3",     ARCH_AVRXMEGA6, AVR_ISA_NONE, "__AVR_ATxmega256D3__",     0x2000, 0x0, 5)
+AVR_MCU ("atxmega128a3u",    ARCH_AVRXMEGA6, AVR_ISA_RMW,  "__AVR_ATxmega128A3U__",    0x2000, 0x0, 3)
+AVR_MCU ("atxmega128b1",     ARCH_AVRXMEGA6, AVR_ISA_RMW,  "__AVR_ATxmega128B1__",     0x2000, 0x0, 3)
+AVR_MCU ("atxmega128b3",     ARCH_AVRXMEGA6, AVR_ISA_RMW,  "__AVR_ATxmega128B3__",     0x2000, 0x0, 3)
+AVR_MCU ("atxmega128c3",     ARCH_AVRXMEGA6, AVR_ISA_RMW,  "__AVR_ATxmega128C3__",     0x2000, 0x0, 3)
+AVR_MCU ("atxmega128d4",     ARCH_AVRXMEGA6, AVR_ISA_NONE, "__AVR_ATxmega128D4__",     0x2000, 0x0, 3)
+AVR_MCU ("atxmega192a3u",    ARCH_AVRXMEGA6, AVR_ISA_RMW,  "__AVR_ATxmega192A3U__",    0x2000, 0x0, 4)
+AVR_MCU ("atxmega192c3",     ARCH_AVRXMEGA6, AVR_ISA_RMW,  "__AVR_ATxmega192C3__",     0x2000, 0x0, 4)
+AVR_MCU ("atxmega256a3u",    ARCH_AVRXMEGA6, AVR_ISA_RMW,  "__AVR_ATxmega256A3U__",    0x2000, 0x0, 5)
+AVR_MCU ("atxmega256c3",     ARCH_AVRXMEGA6, AVR_ISA_RMW,  "__AVR_ATxmega256C3__",     0x2000, 0x0, 5)
+AVR_MCU ("atxmega384c3",     ARCH_AVRXMEGA6, AVR_ISA_RMW,  "__AVR_ATxmega384C3__",     0x2000, 0x0, 6)
+AVR_MCU ("atxmega384d3",     ARCH_AVRXMEGA6, AVR_ISA_NONE, "__AVR_ATxmega384D3__",     0x2000, 0x0, 6)
 /* Xmega, 128K < Flash, RAM > 64K RAM.  */
-AVR_MCU ("avrxmega7",        ARCH_AVRXMEGA7, AVR_ISA_NONE, NULL,                       0x2000, 0x0, 3, "x128a1")
-AVR_MCU ("atxmega128a1",     ARCH_AVRXMEGA7, AVR_ISA_NONE, "__AVR_ATxmega128A1__",     0x2000, 0x0, 3, "x128a1")
-AVR_MCU ("atxmega128a1u",    ARCH_AVRXMEGA7, AVR_ISA_RMW,  "__AVR_ATxmega128A1U__",    0x2000, 0x0, 3, "x128a1u")
-AVR_MCU ("atxmega128a4u",    ARCH_AVRXMEGA7, AVR_ISA_RMW,  "__AVR_ATxmega128A4U__",    0x2000, 0x0, 3, "x128a4u")
+AVR_MCU ("avrxmega7",        ARCH_AVRXMEGA7, AVR_ISA_NONE, NULL,                       0x2000, 0x0, 3)
+AVR_MCU ("atxmega128a1",     ARCH_AVRXMEGA7, AVR_ISA_NONE, "__AVR_ATxmega128A1__",     0x2000, 0x0, 3)
+AVR_MCU ("atxmega128a1u",    ARCH_AVRXMEGA7, AVR_ISA_RMW,  "__AVR_ATxmega128A1U__",    0x2000, 0x0, 3)
+AVR_MCU ("atxmega128a4u",    ARCH_AVRXMEGA7, AVR_ISA_RMW,  "__AVR_ATxmega128A4U__",    0x2000, 0x0, 3)
 /* Tiny family */
-AVR_MCU ("avrtiny",          ARCH_AVRTINY,   AVR_ISA_NONE, NULL,                       0x0040, 0x0, 1, "tn10")
-AVR_MCU ("attiny4",          ARCH_AVRTINY,   AVR_ISA_NONE, "__AVR_ATtiny4__",          0x0040, 0x0, 1, "tn4")
-AVR_MCU ("attiny5",          ARCH_AVRTINY,   AVR_ISA_NONE, "__AVR_ATtiny5__",          0x0040, 0x0, 1, "tn5")
-AVR_MCU ("attiny9",          ARCH_AVRTINY,   AVR_ISA_NONE, "__AVR_ATtiny9__",          0x0040, 0x0, 1, "tn9") 
-AVR_MCU ("attiny10",         ARCH_AVRTINY,   AVR_ISA_NONE, "__AVR_ATtiny10__",         0x0040, 0x0, 1, "tn10")
-AVR_MCU ("attiny20",         ARCH_AVRTINY,   AVR_ISA_NONE, "__AVR_ATtiny20__",         0x0040, 0x0, 1, "tn20")
-AVR_MCU ("attiny40",         ARCH_AVRTINY,   AVR_ISA_NONE, "__AVR_ATtiny40__",         0x0040, 0x0, 1, "tn40")
+AVR_MCU ("avrtiny",          ARCH_AVRTINY, AVR_ISA_NONE, NULL,                     0x0040, 0x0, 1)
+AVR_MCU ("attiny4",          ARCH_AVRTINY, AVR_ISA_NONE, "__AVR_ATtiny4__",        0x0040, 0x0, 1)
+AVR_MCU ("attiny5",          ARCH_AVRTINY, AVR_ISA_NONE, "__AVR_ATtiny5__",        0x0040, 0x0, 1)
+AVR_MCU ("attiny9",          ARCH_AVRTINY, AVR_ISA_NONE, "__AVR_ATtiny9__",        0x0040, 0x0, 1) 
+AVR_MCU ("attiny10",         ARCH_AVRTINY, AVR_ISA_NONE, "__AVR_ATtiny10__",       0x0040, 0x0, 1)
+AVR_MCU ("attiny20",         ARCH_AVRTINY, AVR_ISA_NONE, "__AVR_ATtiny20__",       0x0040, 0x0, 1)
+AVR_MCU ("attiny40",         ARCH_AVRTINY, AVR_ISA_NONE, "__AVR_ATtiny40__",       0x0040, 0x0, 1)
 /* Assembler only.  */
-AVR_MCU ("avr1",                 ARCH_AVR1, AVR_ISA_NONE, NULL,                        0x0060, 0x0, 1, "s1200")
-AVR_MCU ("at90s1200",            ARCH_AVR1, AVR_ISA_NONE, "__AVR_AT90S1200__",         0x0060, 0x0, 1, "s1200")
-AVR_MCU ("attiny11",             ARCH_AVR1, AVR_ISA_NONE, "__AVR_ATtiny11__",          0x0060, 0x0, 1, "tn11")
-AVR_MCU ("attiny12",             ARCH_AVR1, AVR_ISA_NONE, "__AVR_ATtiny12__",          0x0060, 0x0, 1, "tn12")
-AVR_MCU ("attiny15",             ARCH_AVR1, AVR_ISA_NONE, "__AVR_ATtiny15__",          0x0060, 0x0, 1, "tn15")
-AVR_MCU ("attiny28",             ARCH_AVR1, AVR_ISA_NONE, "__AVR_ATtiny28__",          0x0060, 0x0, 1, "tn28")
+AVR_MCU ("avr1",             ARCH_AVR1, AVR_ISA_NONE, NULL,                        0x0060, 0x0, 1)
+AVR_MCU ("at90s1200",        ARCH_AVR1, AVR_ISA_NONE, "__AVR_AT90S1200__",         0x0060, 0x0, 1)
+AVR_MCU ("attiny11",         ARCH_AVR1, AVR_ISA_NONE, "__AVR_ATtiny11__",          0x0060, 0x0, 1)
+AVR_MCU ("attiny12",         ARCH_AVR1, AVR_ISA_NONE, "__AVR_ATtiny12__",          0x0060, 0x0, 1)
+AVR_MCU ("attiny15",         ARCH_AVR1, AVR_ISA_NONE, "__AVR_ATtiny15__",          0x0060, 0x0, 1)
+AVR_MCU ("attiny28",         ARCH_AVR1, AVR_ISA_NONE, "__AVR_ATtiny28__",          0x0060, 0x0, 1)
Index: config/avr/gen-avr-mmcu-specs.c
===================================================================
--- config/avr/gen-avr-mmcu-specs.c	(revision 221448)
+++ config/avr/gen-avr-mmcu-specs.c	(working copy)
@@ -78,6 +78,40 @@ static const char header[] =
   "# for a documentation of spec files.\n"
   "\n";
 
+static const char help_copy_paste[] =
+  "# If you intend to use an existing device specs file as a starting point\n"
+  "# for a new device spec file, make sure you are copying from a specs\n"
+  "# file for a device from the same core architecture and SP width.\n";
+
+#if defined (WITH_AVRLIBC)
+static const char help_dev_lib_name[] =
+  "# AVR-LibC's avr/io.h uses the device specifying macro to determine\n"
+  "# the name of the device header.  For example, -mmcu=atmega8a triggers\n"
+  "# the definition of __AVR_ATmega8A__ and avr/io.h includes the device\n"
+  "# header 'iom8a.h' by means of:\n"
+  "#\n"
+  "#     ...\n"
+  "#     #elif defined (__AVR_ATmega8A__)\n"
+  "#     #  include <avr/iom8a.h>\n"
+  "#     #elif ...\n"
+  "# \n"
+  "# If no device macro is defined, AVR-LibC uses __AVR_DEV_LIB_NAME__\n"
+  "# as fallback to determine the name of the device header as\n"
+  "#\n"
+  "#     \"avr/io\" + __AVR_DEV_LIB_NAME__ + \".h\"\n"
+  "#\n"
+  "# If you provide your own specs file for a device not yet known to\n"
+  "# AVR-LibC, you can now define the hook macro __AVR_DEV_LIB_NAME__\n"
+  "# as needed so that\n"
+  "#\n"
+  "#     #include <avr/io.h>\n"
+  "#\n"
+  "# will include the desired device header.  For ATmega8A the supplement\n"
+  "# to *cpp would read\n"
+  "#\n"
+  "#     -D__AVR_DEV_LIB_NAME__=m8a\n"
+  "\n";
+#endif // WITH_AVRLIBC
 
 static void
 print_mcu (const avr_mcu_t *mcu)
@@ -128,19 +162,25 @@ bool is_arch = NULL == mcu->macro;
              mcu->name, arch->name, sp8 ? 8 : 16);
   fprintf (f, "%s\n", header);
 
-  // avrlibc-specific specs for linking / thelinker.
-
-  fprintf (f, "*avrlibc_startfile:\n");
   if (is_device)
-    fprintf (f, "\tdev/%s/crt1.o%%s", mcu->name);
-  fprintf (f, "\n\n");
+    fprintf (f, "%s\n", help_copy_paste);
+
+#if defined (WITH_AVRLIBC)
+  // AVR-LibC specific.  See avrlibc.h for the specs using them as subspecs.
 
-  fprintf (f, "*avrlibc_devicelib:\n");
   if (is_device)
-    fprintf (f, "\tdev/%s/libdev.a%%s", mcu->name);
-  fprintf (f, "\n\n");
+    {
+      fprintf (f, "*avrlibc_startfile:\n");
+      fprintf (f, "\tdev/%s/crt1.o%%s", mcu->name);
+      fprintf (f, "\n\n");
+
+      fprintf (f, "*avrlibc_devicelib:\n");
+      fprintf (f, "\t%%{!nodevicelib:dev/%s/libdev.a%%s}", mcu->name);
+      fprintf (f, "\n\n");
+    }
+#endif  // WITH_AVRLIBC
 
-  // avr-specific specs for the compilation / the compiler proper.
+  // avr-gcc specific specs for the compilation / the compiler proper.
 
   fprintf (f, "*cc1_n_flash:\n"
            "\t%%{!mn-flash=*:-mn-flash=%d}\n\n", mcu->n_flash);
@@ -153,19 +193,19 @@ bool is_arch = NULL == mcu->macro;
            ? "\t%{!mno-skip-bug: -mskip-bug}"
            : "\t%{!mskip-bug: -mno-skip-bug}");
 
-  // avr-specific specs for assembling / the assembler.
+  // avr-gcc specific specs for assembling / the assembler.
 
   fprintf (f, "*asm_arch:\n\t-mmcu=%s\n\n", arch->name);
 
 #ifdef HAVE_AS_AVR_MLINK_RELAX_OPTION
   fprintf (f, "*asm_relax:\n\t%s\n\n", ASM_RELAX_SPEC);
-#endif // have as --mlink-relax
+#endif // have avr-as --mlink-relax
 
 #ifdef HAVE_AS_AVR_MRMW_OPTION
   fprintf (f, "*asm_rmw:\n%s\n\n", rmw
            ? "\t%{!mno-rmw: -mrmw}"
            : "\t%{mrmw}");
-#endif // have as -mrmw
+#endif // have avr-as -mrmw
 
   fprintf (f, "*asm_errata_skip:\n%s\n\n", errata_skip
            ? "\t%{mno-skip-bug}"
@@ -192,50 +232,36 @@ bool is_arch = NULL == mcu->macro;
 
   fprintf (f, "*link_arch:\n\t%s\n\n", LINK_ARCH_SPEC);
 
-  fprintf (f, "*link_data_start:\n");
-  if (mcu->data_section_start
-      != arch->default_data_section_start)
-    fprintf (f, "\t-Tdata 0x%lX", 0x800000UL + mcu->data_section_start);
-  fprintf (f, "\n\n");
-
-  fprintf (f, "*link_text_start:\n");
-  if (mcu->text_section_start != 0x0)
-    fprintf (f, "\t-Ttext 0x%lX", 0UL + mcu->text_section_start);
-  fprintf (f, "\n\n");
-
-  // Default specs.  Rewritten to the device-specific specs file so
-  // they can be adjusted as needed.
-     
-  bool has_libs = arch_id != ARCH_AVR1;
-
-  fprintf (f, "*self_spec:\n");
-  if (is_device)
-    fprintf (f, "\t%%{!mmcu=avr*: %%<mmcu=* -mmcu=%s} ", arch->name);
-  fprintf (f, "%s\n\n", sp8_spec);
-
-  fprintf (f, "*cpp:\n");
   if (is_device)
-    fprintf (f,"\t-D__AVR_DEV_LIB_NAME__=%s"
-             " -D%s"
-	     " -D__AVR_DEVICE_NAME__=%s",
-	     mcu->library_name, mcu->macro, mcu->name);
-  fprintf (f, "\n\n");
-
-  fprintf (f, "*cc1:\n\t%s\n\n", CC1_SPEC);
-
-  fprintf (f, "*cc1plus:\n\t%s\n\n", CC1PLUS_SPEC);
-
-  fprintf (f, "*asm:\n\t%s\n\n", ASM_SPEC);
-
-  fprintf (f, "*link:\n\t%s\n\n", LINK_SPEC);
-
-  fprintf (f, "*lib:\n\t%s\n\n", has_libs ? LIB_SPEC : "");
-
-  fprintf (f, "*libgcc:\n\t%s\n\n", has_libs ? LIBGCC_SPEC : "");
+    {
+      fprintf (f, "*link_data_start:\n");
+      if (mcu->data_section_start
+          != arch->default_data_section_start)
+        fprintf (f, "\t-Tdata 0x%lX", 0x800000UL + mcu->data_section_start);
+      fprintf (f, "\n\n");
+
+      fprintf (f, "*link_text_start:\n");
+      if (mcu->text_section_start != 0x0)
+        fprintf (f, "\t-Ttext 0x%lX", 0UL + mcu->text_section_start);
+      fprintf (f, "\n\n");
+    }
 
-  fprintf (f, "*startfile:\n\t%s\n\n", STARTFILE_SPEC);
+  // Specs known to GCC.
 
-  fprintf (f, "*endfile:\n%s\n\n", ENDFILE_SPEC);
+  if (is_device)
+    {
+      fprintf (f, "*self_spec:\n");
+      fprintf (f, "\t%%{!mmcu=avr*: %%<mmcu=* -mmcu=%s} ", arch->name);
+      fprintf (f, "%s\n\n", sp8_spec);
+
+#if defined (WITH_AVRLIBC)
+      fprintf (f, "%s\n", help_dev_lib_name);
+#endif // WITH_AVRLIBC
+
+      fprintf (f, "*cpp:\n");
+      fprintf (f, "\t-D%s -D__AVR_DEVICE_NAME__=%s", mcu->macro, mcu->name);
+      fprintf (f, "\n\n");
+    }
 
   fprintf (f, "# End of file\n");
 }
Index: config/avr/driver-avr.c
===================================================================
--- config/avr/driver-avr.c	(revision 221448)
+++ config/avr/driver-avr.c	(working copy)
@@ -24,6 +24,9 @@ along with GCC; see the file COPYING3.
 #include "diagnostic.h"
 #include "tm.h"
 
+// Remove -nodevicelib from the command line if not needed
+#define X_NODEVLIB "%<nodevicelib"
+
 static const char dir_separator_str[] = { DIR_SEPARATOR, 0 };
 
 static const char specfiles_doc_url[] =
@@ -46,7 +49,7 @@ avr_diagnose_devicespecs_error (const ch
   inform (input_location, "you can provide your own specs files, "
           "see <%s> for details", specfiles_doc_url);
 
-  return "";
+  return X_NODEVLIB;
 }
 
 
@@ -73,7 +76,7 @@ avr_devicespecs_file (int argc, const ch
     case 0:
       fatal_error (input_location,
                    "bad usage of spec function %qs", "device-specs-file");
-      return "";
+      return X_NODEVLIB;
 
     case 1:
       mmcu = AVR_MMCU_DEFAULT;
@@ -85,7 +88,7 @@ avr_devicespecs_file (int argc, const ch
 
     default:
       error ("specified option %qs more than once", "-mmcu=");
-      return "";
+      return X_NODEVLIB;
     }
 
   specfile_name = concat (argv[0], dir_separator_str, "specs-", mmcu, NULL);
@@ -105,7 +108,7 @@ avr_devicespecs_file (int argc, const ch
       {
         error ("strange device name %qs after %qs: bad character %qc",
                mmcu, "-mmcu=", *s);
-        return "";
+        return X_NODEVLIB;
       }
 
   if (/* When building / configuring the compiler we might get a relative path
@@ -117,7 +120,16 @@ avr_devicespecs_file (int argc, const ch
       || (IS_ABSOLUTE_PATH (specfile_name)
           && !access (specfile_name, R_OK)))
     {
-      return concat ("-specs=", specfile_name, NULL);
+      return concat ("-specs=device-specs", dir_separator_str, "specs-", mmcu,
+                     // Use '%s' instead of the expanded specfile_name.  This
+                     // is the easiest way to handle pathes containing spaces.
+                     "%s",
+#if defined (WITH_AVRLIBC)
+                     " %{mmcu=avr*:" X_NODEVLIB "} %{!mmcu=*:" X_NODEVLIB "}",
+#else
+                     " " X_NODEVLIB,
+#endif
+                     NULL);
     }
 
   return avr_diagnose_devicespecs_error (mmcu, specfile_name);
Index: config/avr/specs.h
===================================================================
--- config/avr/specs.h	(revision 221448)
+++ config/avr/specs.h	(working copy)
@@ -68,10 +68,10 @@ along with GCC; see the file COPYING3.
   "%{shared:%eshared is not supported} "
 
 #undef  LIB_SPEC
-#define LIB_SPEC " -lc "
+#define LIB_SPEC " %{!mmcu=avr1:-lc} "
 
 #undef  LIBGCC_SPEC
-#define LIBGCC_SPEC " -lgcc "
+#define LIBGCC_SPEC " %{!mmcu=avr1:-lgcc} "
 
 #define STARTFILE_SPEC ""
 #define ENDFILE_SPEC ""
Index: doc/invoke.texi
===================================================================
--- doc/invoke.texi	(revision 221448)
+++ doc/invoke.texi	(working copy)
@@ -572,7 +572,7 @@ -remap -trigraphs  -undef  -U@var{macro}
 @emph{AVR Options}
 @gccoptlist{-mmcu=@var{mcu} -maccumulate-args -mbranch-cost=@var{cost} @gol
 -mcall-prologues -mint8 -mn_flash=@var{size} -mno-interrupts @gol
--mrelax -mrmw -mstrict-X -mtiny-stack -Waddr-space-convert}
+-mrelax -mrmw -mstrict-X -mtiny-stack -nodevicelib -Waddr-space-convert}
 
 @emph{Blackfin Options}
 @gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} @gol
@@ -13572,6 +13572,10 @@ sbiw r26, const   ; X -= const
 @opindex mtiny-stack
 Only change the lower 8@tie{}bits of the stack pointer.
 
+@item -nodevicelib
+@opindex nodevicelib
+Don't link against AVR-LibC's device specific library @code{libdev.a}.
+
 @item -Waddr-space-convert
 @opindex Waddr-space-convert
 Warn about conversions between address spaces in the case where the

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [patch,avr]: Part5: Fix various problems with specs and specs file generation.
  2015-03-16 18:18           ` [patch,avr]: Part5: " Georg-Johann Lay
@ 2015-03-17  6:37             ` Denis Chertykov
  0 siblings, 0 replies; 23+ messages in thread
From: Denis Chertykov @ 2015-03-17  6:37 UTC (permalink / raw)
  To: Georg-Johann Lay; +Cc: Senthil Kumar Selvaraj, GCC Patches, Joerg Wunsch

2015-03-16 21:17 GMT+03:00 Georg-Johann Lay <avr@gjlay.de>:
> This patch introduces a new avr specific command option '-nodevicelib' so
> that linking of libdev.a can be bypassed.
>
> The argument of -specs= is suffixed by %s instead of supplying the absolute
> path.  That way -specs= works with installation path that contains spaces.
>
> avr_mct_t.library_name and its initializers in avr-mcus.def are cleaned up.
>
> This field was used to define __AVR_DEV_LIB_NAME__.  If no device macro is
> defined because a device is not supported by avr-gcc, that hook macro can be
> defined to tell avr/io.h where to find the device's header file.
>
> This means it is pointless to define __AVR_DEV_LIB_NAME__ in avr-gcc:
>
> If a device is supported, the device macro (e.g. __AVR_ATmega8__) is defined
> and __AVR_DEV_LIB_NAME__ will never be used.
>
> The patch adds more help text to the device specs file to inform a potential
> reader about the role of the hook macro __AVR_DEV_LIB_NAME__.
>
> The patch also removes specs known to GCC and which don't directly depend on
> the device from the device specs file.  This makes the specs file smaller
> and easier less confusing.
>
> Ok for trunk?
>
> Johann
>
>
>         PR target/65296
>         * config/avr/avrlibc.h (LIB_SPEC, LIBGCC_SPEC) [AVR1]: Don't link
>         libgcc.a, libc.a, libm.a.
>         * config/avr/specs.h: Same.
>         * config/avr/gen-avr-mmcu-specs.c (print_mcu): Don't print specs
>         which don't (directly) depend on the device.  Print more help.
>         (*avrlibc_devicelib) [-nodevicelib]: Don't link libdev.a.
>         (*cpp): Don't define __AVR_DEV_LIB_NAME__.
>         * config/avr/driver-avr.c: Remove -nodevicelib from option list in
>         case of an error.
>         (avr_devicespecs_file): Use suffix "%s" instead of absolute path.
>         for specs file name instead of absolute path.
>         * config/avr/avr-arch.h (avr_mcu_t) [.library_name]: Remove.
>         * config/avr/avr-mcus.def: Same: Adjust initializers.
>         * config/avr/avr.opt (-nodevicelib): New option.
>         * doc/invoke.texi (AVR Options): Document it.
>

Please apply.

Denis.

^ permalink raw reply	[flat|nested] 23+ messages in thread

* RE: [patch,avr]: Part2: Fix various problems with specs and specs file generation.
  2015-03-09 16:03   ` [patch,avr]: Part2: " Georg-Johann Lay
  2015-03-09 20:00     ` Denis Chertykov
@ 2015-04-06  9:54     ` Sivanupandi, Pitchumani
  2015-04-07 12:34       ` Georg-Johann Lay
  1 sibling, 1 reply; 23+ messages in thread
From: Sivanupandi, Pitchumani @ 2015-04-06  9:54 UTC (permalink / raw)
  To: Georg-Johann Lay
  Cc: Denis Chertykov, GCC Patches, Joerg Wunsch, Selvaraj, Senthil_Kumar

Hi Johann,

Did you try running g++ tests?
It seems xgcc is invoked to get multilibs (from gcc/testsuite/lib/g++.exp) which failed to find specs file.

Regards,
Pitchumani

> -----Original Message-----
> From: gcc-patches-owner@gcc.gnu.org [mailto:gcc-patches-
> owner@gcc.gnu.org] On Behalf Of Georg-Johann Lay
> Sent: Monday, March 09, 2015 9:33 PM
> To: Selvaraj, Senthil_Kumar
> Cc: Denis Chertykov; GCC Patches; Joerg Wunsch; Joern Rennecke
> Subject: Re: [patch,avr]: Part2: Fix various problems with specs and specs
> file generation.
> 
> Am 03/03/2015 um 02:21 PM schrieb Senthil Kumar Selvaraj:
> > On Mon, Mar 02, 2015 at 08:40:17PM +0100, Georg-Johann Lay wrote:
> >> The new specs file generation introduces several problems.  This
> >> patch
> >>
> >> - Fix build warnings
> >>
> >> - Clean up unused code and the old, now dead specs definitions.
> >>
> >> - Removes unused files and adjust build scripts / rules.
> >>
> >> - Issues with avr-libc awareness:
> >>
> >> -- Makes specs-generation aware of avr-libc (include tm.h in build
> >> script and depend on WITH_AVRLIBC).
> >>
> >> -- avr-libc implements functions in libm.a which usually live in
> >> libgcc, hence add -lm to libgcc_spec, cf. PR54461.
> >>
> >> -- The new libdev.a is a feature of avr-libc and not available with,
> >> e.g., newlib.  Hence remove it from lib_spec if the compiler is not
> >> configured for avr-libc (--with-avrlibc=no).
> >>
> >> - Many minor issues with option propagation.
> >>
> >> - -march had been added to multilib generation some time ago, but
> >> driver_self_spec was not aware of that option.
> >>
> >>
> >> Ok for trunk?
> >>
> >>
> >> BTW, anyone knows what -march= is good for?  It allows all kinds of
> >> silly option combinations like "-march=avrtiny -mmcu=atmega8"
> without
> >> any complaints.
> >
> > IIRC, -march was added because replacing -mmcu=<device> to
> > -mmcu=<arch> in the driver's self specs broke multilib selection - the
> > driver always acted as if no -mmcu was specified. Adding
> 
> For me both multilib selection and multilib generation are working as
> expected with -mmcu= and without that -march=.
> 
> Attached is a 2nd part of improvements for the specs file generation:
> 
> - Remove -arch= and use -mmcu= again.
> 
> - Wrap specs file selection into a new specs function so that a
> comprehensible error message can be issued if no specs file is found.  It
> also informs about a link to spec file documentation of gcc inline docs.
> 
> - Remove genopt.sh and avr-tables.opt.  These files are no more used
> because -mmcu= is a vanilla string option now.  Using Enum option for -
> mmcu= does not allow to specify unknown devices, and
> target_handle_option cannot letgigimize unknown strings of Enum
> options.
> 
> - Resurrect driver-avr.c but with new content: The new specs function.
> 
> - New file specs.h with specs known to gcc and which can be overridden
> by avrlibc.h, rtems.h, etc.
> 
> - New device-specs files mostly repeat spec definitions, e.g.
> 
>      fprintf (f, "*startfile:\n\t%s\n\n", STARTFILE_SPEC);
>      fprintf (f, "*endfile:\n\t%s\n\n", ENDFILE_SPEC);
> 
> - Device feature are expressed as subspecs now, e.g. avrlibc_startfile spec.
> 
> - Clean up code from "current device" stuff, adjust diagnostics, avr-arch.h,
> etc.
> 
> - Use INSTALL_DATA to install spec files, not INSTALL_PROGRAM.
> 
> 
> 
> Ok to install this, too?
> 
> 
> Johann
> 
> 	PR target/65296
> 	* config.gcc (extra_options) [avr]: Remove.
> 	(extra_gcc_objs) [avr]: Use driver-avr.o, avr-devices.o.
> 	(tm_file) [avr]: Add avr/specs.h after avr/avr.h.
> 	(tm_defines) [avr, rtems]: Add WITH_RTEMS.
> 
> 	* config/avr/genmultilib.awk: Use -mmcu= instead of -march=.
> 	* config/avr/t-multilib: Regenerate.
> 	* config/avr/specs.h: New file.
> 	* config/avr/driver-avr.c: New file.
> 	* config/avr/genopt.sh: Remove file.
> 	* config/avr/avr-tables.opt: Remove file.
> 	* config/avr/predicates.md (avr_current_arch): Rename to
> avr_arch.
> 	* config/avr/avr-c.c: Same.
> 	* avr-arch.h: Same.
> 	(avr_current_device): Remove proto.
> 	* config/avr/avr.c (avr_current_arch): Rename to avr_arch.
> 	(avr_current_device): Remove definition and usage.
> 	(avr_set_core_architecture): New static function.
> 	(avr_option_override): Use it.
> 	* config/avr/avr.h (avr_current_arch): Rename to avr_arch.
> 	(AVR_HAVE_8BIT_SP): Don't depend on avr_current_device.
> 	(EXTRA_SPEC_FUNCTIONS): Define.
> 	(avr_devicespecs_file): New specs function proto.
> 	(DRIVER_SELF_SPECS): Use device-specs-file spec function.
> 	* config/avr/avr-devices.c (diagnostic.h, avr-arch.h): Include
> them.
> 	(mcu_name): New static array.
> 	(comparator, avr_archs_str, avr_mcus_str): New static functions.
> 	(avr_inform_devices, avr_inform_core_architectures): New
> functions.
> 	* config/avr/gen-avr-mmcu-specs.c (avr-arch.h, specs.h): Include.
> 	(avrlibc.h) [WITH_AVRLIBC]: Include.
> 	(../rtems.h, rtems.h) [WITH_RTEMS]: Include.
> 	(print_mcu): Rewrite from scratch.
> 	* config/avr/avrlibc.h (LIB_SPEC, LIBGCC_SPEC, STARTFILE_SPEC):
> 	Forward to avr-specific specs defined in device-specs file.
> 	* config/avr/avr.opt (config/avr/avr-arch.h): Remove include.
> 	(-mmcu=): Add Var and MissingArgError properties.
> 	(-march=): Remove.
> 	* config/avr/t-avr (driver-avr.o): New rule.
> 	(avr-devices.o): Depend on avr-arch.h.
> 	(avr-mcus): No more depend on avr-tables.opt.
> 	(avr-tables.opt): Remove rule.
> 	(install-device-specs): Use INSTALL_DATA, not INSTALL_PROGRAM.
> 
> 
> > a new option (-march), translating mmcu=<device> to march=<arch>
> and
> > then basing t-multilib on that worked ok.
> >
> >>
> >> What's wrong with -mmcu=avr* ? All architecture names start with
> >> "avr", and /no/ device name starts /with/ "avr", hence -mmcu= should
> >> be fine and work as smooth as in the last 10 years.
> >>
> >> Why that -march= option?  If there is not a good reason for -march=,
> >> I'd propose to clean it up and use -mmcu=avr* instead.
> >>
> >>
> >> Johann


^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [patch,avr]: Part2: Fix various problems with specs and specs file generation.
  2015-04-06  9:54     ` [patch,avr]: Part2: " Sivanupandi, Pitchumani
@ 2015-04-07 12:34       ` Georg-Johann Lay
  2015-04-08  8:28         ` Denis Chertykov
  0 siblings, 1 reply; 23+ messages in thread
From: Georg-Johann Lay @ 2015-04-07 12:34 UTC (permalink / raw)
  To: Sivanupandi, Pitchumani
  Cc: Denis Chertykov, GCC Patches, Joerg Wunsch, Selvaraj, Senthil_Kumar

Am 04/06/2015 um 11:54 AM schrieb Sivanupandi, Pitchumani:
> Hi Johann,
>
> Did you try running g++ tests?
> It seems xgcc is invoked to get multilibs (from gcc/testsuite/lib/g++.exp) which failed to find specs file.


This is because libgloss.exp:get_multilibs (used from g++_init) runs xgcc 
($compiler) without -B, i.e. without any prefix.  Without prefix there is no 
way to determine where the specs files are located.

Patching driver_self_specs to read a specs file by means of -specs= is, well, 
not very common.  I don't know any other target which does that.

As a work-around you can run the tests against the installed compiler.

Denis, what do you think?  I could add yet another fixme to avr backend like 
the following; that way there's no need to change dejagnu:


Johann

Index: config/avr/driver-avr.c
===================================================================
--- config/avr/driver-avr.c     (revision 221602)
+++ config/avr/driver-avr.c     (working copy)
@@ -80,6 +80,20 @@ avr_devicespecs_file (int argc, const ch
        return X_NODEVLIB;

      case 1:
+      if (0 == strcmp ("device-specs", argv[0]))
+        {
+          /* FIXME:  This means "device-specs%s" from avr.h:DRIVER_SELF_SPECS
+             has not been resolved to a path.  That case can occur when the
+             c++ testsuite is run from the build directory.  DejaGNU's
+             libgloss.exp:get_multilibs runs $compiler without -B, i.e.runs
+             xgcc without specifying a prefix.  Without any prefix, there is
+             no means to find out where the specs files might be located.
+             get_multilibs runs xgcc --print-multi-lib, hence we don't
+             actually need information form a specs file and may skip it
+             altogether.  */
+          return X_NODEVLIB;
+        }
+
        mmcu = AVR_MMCU_DEFAULT;
        break;

g



^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [patch,avr]: Part2: Fix various problems with specs and specs file generation.
  2015-04-07 12:34       ` Georg-Johann Lay
@ 2015-04-08  8:28         ` Denis Chertykov
  2015-04-08 11:25           ` Georg-Johann Lay
  0 siblings, 1 reply; 23+ messages in thread
From: Denis Chertykov @ 2015-04-08  8:28 UTC (permalink / raw)
  To: Georg-Johann Lay
  Cc: Sivanupandi, Pitchumani, GCC Patches, Joerg Wunsch, Selvaraj,
	Senthil_Kumar

2015-04-07 15:34 GMT+03:00 Georg-Johann Lay <avr@gjlay.de>:
> Am 04/06/2015 um 11:54 AM schrieb Sivanupandi, Pitchumani:
>>
>> Hi Johann,
>>
>> Did you try running g++ tests?
>> It seems xgcc is invoked to get multilibs (from gcc/testsuite/lib/g++.exp)
>> which failed to find specs file.
>
>
>
> This is because libgloss.exp:get_multilibs (used from g++_init) runs xgcc
> ($compiler) without -B, i.e. without any prefix.  Without prefix there is no
> way to determine where the specs files are located.
>
> Patching driver_self_specs to read a specs file by means of -specs= is,
> well, not very common.  I don't know any other target which does that.
>
> As a work-around you can run the tests against the installed compiler.
>
> Denis, what do you think?  I could add yet another fixme to avr backend like
> the following; that way there's no need to change dejagnu:
>
>
> Johann
>
> Index: config/avr/driver-avr.c
> ===================================================================
> --- config/avr/driver-avr.c     (revision 221602)
> +++ config/avr/driver-avr.c     (working copy)
> @@ -80,6 +80,20 @@ avr_devicespecs_file (int argc, const ch
>        return X_NODEVLIB;
>
>      case 1:
> +      if (0 == strcmp ("device-specs", argv[0]))
> +        {
> +          /* FIXME:  This means "device-specs%s" from
> avr.h:DRIVER_SELF_SPECS
> +             has not been resolved to a path.  That case can occur when the
> +             c++ testsuite is run from the build directory.  DejaGNU's
> +             libgloss.exp:get_multilibs runs $compiler without -B, i.e.runs
> +             xgcc without specifying a prefix.  Without any prefix, there
> is
> +             no means to find out where the specs files might be located.
> +             get_multilibs runs xgcc --print-multi-lib, hence we don't
> +             actually need information form a specs file and may skip it
> +             altogether.  */
> +          return X_NODEVLIB;
> +        }
> +
>        mmcu = AVR_MMCU_DEFAULT;
>        break;
>

I'm weak  in dejagnu internals and c++ testsuite.
It looks like an acceptable solution.

Denis.

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [patch,avr]: Part2: Fix various problems with specs and specs file generation.
  2015-04-08  8:28         ` Denis Chertykov
@ 2015-04-08 11:25           ` Georg-Johann Lay
  2015-04-09 10:59             ` Sivanupandi, Pitchumani
  0 siblings, 1 reply; 23+ messages in thread
From: Georg-Johann Lay @ 2015-04-08 11:25 UTC (permalink / raw)
  To: Denis Chertykov
  Cc: Sivanupandi, Pitchumani, GCC Patches, Joerg Wunsch, Selvaraj,
	Senthil_Kumar

Am 04/08/2015 um 10:28 AM schrieb Denis Chertykov:
> 2015-04-07 15:34 GMT+03:00 Georg-Johann Lay <avr@gjlay.de>:
>> Am 04/06/2015 um 11:54 AM schrieb Sivanupandi, Pitchumani:
>>>
>>> Hi Johann,
>>>
>>> Did you try running g++ tests?
>>> It seems xgcc is invoked to get multilibs (from gcc/testsuite/lib/g++.exp)
>>> which failed to find specs file.
>>
>>
>>
>> This is because libgloss.exp:get_multilibs (used from g++_init) runs xgcc
>> ($compiler) without -B, i.e. without any prefix.  Without prefix there is no
>> way to determine where the specs files are located.
>>
>> Patching driver_self_specs to read a specs file by means of -specs= is,
>> well, not very common.  I don't know any other target which does that.
>>
>> As a work-around you can run the tests against the installed compiler.
>>
>> Denis, what do you think?  I could add yet another fixme to avr backend like
>> the following; that way there's no need to change dejagnu:
>>
>>
>> Johann
>>
>> Index: config/avr/driver-avr.c
>> ===================================================================
>> --- config/avr/driver-avr.c     (revision 221602)
>> +++ config/avr/driver-avr.c     (working copy)
>> @@ -80,6 +80,20 @@ avr_devicespecs_file (int argc, const ch
>>         return X_NODEVLIB;
>>
>>       case 1:
>> +      if (0 == strcmp ("device-specs", argv[0]))
>> +        {
>> +          /* FIXME:  This means "device-specs%s" from
>> avr.h:DRIVER_SELF_SPECS
>> +             has not been resolved to a path.  That case can occur when the
>> +             c++ testsuite is run from the build directory.  DejaGNU's
>> +             libgloss.exp:get_multilibs runs $compiler without -B, i.e.runs
>> +             xgcc without specifying a prefix.  Without any prefix, there
>> is
>> +             no means to find out where the specs files might be located.
>> +             get_multilibs runs xgcc --print-multi-lib, hence we don't
>> +             actually need information form a specs file and may skip it
>> +             altogether.  */
>> +          return X_NODEVLIB;
>> +        }
>> +
>>         mmcu = AVR_MMCU_DEFAULT;
>>         break;
>>
>
> I'm weak  in dejagnu internals and c++ testsuite.
> It looks like an acceptable solution.
>
> Denis.

Pitchumani, does that patch work for you?  If so I'd go ahead and apply it.

And what about the spaces problem as mentioned in

http://savannah.nongnu.org/bugs/?44574
http://lists.gnu.org/archive/html/avr-libc-dev/2015-03/msg00010.html

Art there plans to fix that?

Johann



^ permalink raw reply	[flat|nested] 23+ messages in thread

* RE: [patch,avr]: Part2: Fix various problems with specs and specs file generation.
  2015-04-08 11:25           ` Georg-Johann Lay
@ 2015-04-09 10:59             ` Sivanupandi, Pitchumani
  2015-04-09 11:23               ` Georg-Johann Lay
  2015-04-09 11:44               ` [patch,avr,committed]: ad PR65296: work around device-specs file + dejagnu for c++ Georg-Johann Lay
  0 siblings, 2 replies; 23+ messages in thread
From: Sivanupandi, Pitchumani @ 2015-04-09 10:59 UTC (permalink / raw)
  To: Georg-Johann Lay, Denis Chertykov
  Cc: GCC Patches, Joerg Wunsch, Selvaraj, Senthil_Kumar



> -----Original Message-----
> From: Georg-Johann Lay [mailto:avr@gjlay.de]
> Sent: Wednesday, April 08, 2015 4:56 PM
> To: Denis Chertykov
> Cc: Sivanupandi, Pitchumani; GCC Patches; Joerg Wunsch; Selvaraj,
> Senthil_Kumar
> Subject: Re: [patch,avr]: Part2: Fix various problems with specs and specs
> file generation.
> 
> Am 04/08/2015 um 10:28 AM schrieb Denis Chertykov:
> > 2015-04-07 15:34 GMT+03:00 Georg-Johann Lay <avr@gjlay.de>:
> >> Am 04/06/2015 um 11:54 AM schrieb Sivanupandi, Pitchumani:
> >>>
> >>> Hi Johann,
> >>>
> >>> Did you try running g++ tests?
> >>> It seems xgcc is invoked to get multilibs (from
> >>> gcc/testsuite/lib/g++.exp) which failed to find specs file.
> >>
> >>
> >>
> >> This is because libgloss.exp:get_multilibs (used from g++_init) runs
> >> xgcc
> >> ($compiler) without -B, i.e. without any prefix.  Without prefix
> >> there is no way to determine where the specs files are located.
> >>
> >> Patching driver_self_specs to read a specs file by means of -specs=
> >> is, well, not very common.  I don't know any other target which does
> that.
> >>
> >> As a work-around you can run the tests against the installed compiler.
> >>
> >> Denis, what do you think?  I could add yet another fixme to avr
> >> backend like the following; that way there's no need to change
> dejagnu:
> >>
> >>
> >> Johann
> >>
> >> Index: config/avr/driver-avr.c
> >>
> ===========================================================
> ========
> >> --- config/avr/driver-avr.c     (revision 221602)
> >> +++ config/avr/driver-avr.c     (working copy)
> >> @@ -80,6 +80,20 @@ avr_devicespecs_file (int argc, const ch
> >>         return X_NODEVLIB;
> >>
> >>       case 1:
> >> +      if (0 == strcmp ("device-specs", argv[0]))
> >> +        {
> >> +          /* FIXME:  This means "device-specs%s" from
> >> avr.h:DRIVER_SELF_SPECS
> >> +             has not been resolved to a path.  That case can occur when
> the
> >> +             c++ testsuite is run from the build directory.  DejaGNU's
> >> +             libgloss.exp:get_multilibs runs $compiler without -B, i.e.runs
> >> +             xgcc without specifying a prefix.  Without any prefix,
> >> + there
> >> is
> >> +             no means to find out where the specs files might be located.
> >> +             get_multilibs runs xgcc --print-multi-lib, hence we don't
> >> +             actually need information form a specs file and may skip it
> >> +             altogether.  */
> >> +          return X_NODEVLIB;
> >> +        }
> >> +
> >>         mmcu = AVR_MMCU_DEFAULT;
> >>         break;
> >>
> >
> > I'm weak  in dejagnu internals and c++ testsuite.
> > It looks like an acceptable solution.
> >
> > Denis.
> 
> Pitchumani, does that patch work for you?  If so I'd go ahead and apply
> it.

Yes. It works for me.
Thanks.

> And what about the spaces problem as mentioned in
> 
> http://savannah.nongnu.org/bugs/?44574
> http://lists.gnu.org/archive/html/avr-libc-dev/2015-03/msg00010.html
> 
> Art there plans to fix that?

Yes. Will submit patch to avr-libc by next week.

Regards,
Pitchumani

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [patch,avr]: Part2: Fix various problems with specs and specs file generation.
  2015-04-09 10:59             ` Sivanupandi, Pitchumani
@ 2015-04-09 11:23               ` Georg-Johann Lay
  2015-04-09 12:55                 ` Sivanupandi, Pitchumani
  2015-04-09 11:44               ` [patch,avr,committed]: ad PR65296: work around device-specs file + dejagnu for c++ Georg-Johann Lay
  1 sibling, 1 reply; 23+ messages in thread
From: Georg-Johann Lay @ 2015-04-09 11:23 UTC (permalink / raw)
  To: Sivanupandi, Pitchumani, Denis Chertykov
  Cc: GCC Patches, Joerg Wunsch, Selvaraj, Senthil_Kumar

Am 04/09/2015 um 12:59 PM schrieb Sivanupandi, Pitchumani:
>> And what about the spaces problem as mentioned in
>>
>> http://savannah.nongnu.org/bugs/?44574
>> http://lists.gnu.org/archive/html/avr-libc-dev/2015-03/msg00010.html
>>
>> Art there plans to fix that?
>
> Yes. Will submit patch to avr-libc by next week.

Thanks.

> Regards,
> Pitchumani

If the device libs are moved, all the ~200 .dev/<device> directories will 
contain just 1 file each: crt1.o.  Is it much work to tidy that up?  (For 
example by renaming to, say, crt<device>.o and moving them to a common place or 
to their natural multilib location.)


Johann



^ permalink raw reply	[flat|nested] 23+ messages in thread

* [patch,avr,committed]: ad PR65296: work around  device-specs file + dejagnu for c++.
  2015-04-09 10:59             ` Sivanupandi, Pitchumani
  2015-04-09 11:23               ` Georg-Johann Lay
@ 2015-04-09 11:44               ` Georg-Johann Lay
  1 sibling, 0 replies; 23+ messages in thread
From: Georg-Johann Lay @ 2015-04-09 11:44 UTC (permalink / raw)
  To: GCC Patches
  Cc: Sivanupandi, Pitchumani, Denis Chertykov, Joerg Wunsch, Selvaraj,
	Senthil_Kumar


Applied this patch:

http://gcc.gnu.org/r221947


Johann


	* config/avr/driver-avr.c (avr_devicespecs_file): Don't specify a
	device specs file if "device-specs%s" didn't resolve to a path.



Index: config/avr/driver-avr.c
===================================================================
--- config/avr/driver-avr.c     (revision 221946)
+++ config/avr/driver-avr.c     (working copy)
@@ -80,6 +80,19 @@ avr_devicespecs_file (int argc, const ch
        return X_NODEVLIB;

      case 1:
+      if (0 == strcmp ("device-specs", argv[0]))
+        {
+          /* FIXME:  This means "device-specs%s" from avr.h:DRIVER_SELF_SPECS
+             has not been resolved to a path.  That case can occur when the
+             c++ testsuite is run from the build directory.  DejaGNU's
+             libgloss.exp:get_multilibs runs $compiler without -B, i.e.runs
+             xgcc without specifying a prefix.  Without any prefix, there is
+             no means to find out where the specs files might be located.
+             get_multilibs runs xgcc --print-multi-lib, hence we don't actually
+             need information form a specs file and may skip it here.  */
+          return X_NODEVLIB;
+        }
+
        mmcu = AVR_MMCU_DEFAULT;
        break;


^ permalink raw reply	[flat|nested] 23+ messages in thread

* RE: [patch,avr]: Part2: Fix various problems with specs and specs file generation.
  2015-04-09 11:23               ` Georg-Johann Lay
@ 2015-04-09 12:55                 ` Sivanupandi, Pitchumani
  2015-04-15 10:17                   ` Sivanupandi, Pitchumani
  0 siblings, 1 reply; 23+ messages in thread
From: Sivanupandi, Pitchumani @ 2015-04-09 12:55 UTC (permalink / raw)
  To: Georg-Johann Lay, Denis Chertykov
  Cc: GCC Patches, Joerg Wunsch, Selvaraj, Senthil_Kumar

> -----Original Message-----
> From: Georg-Johann Lay [mailto:avr@gjlay.de]
> Sent: Thursday, April 09, 2015 4:54 PM
> To: Sivanupandi, Pitchumani; Denis Chertykov
> Cc: GCC Patches; Joerg Wunsch; Selvaraj, Senthil_Kumar
> Subject: Re: [patch,avr]: Part2: Fix various problems with specs and specs
> file generation.
> 
> Am 04/09/2015 um 12:59 PM schrieb Sivanupandi, Pitchumani:
> >> And what about the spaces problem as mentioned in
> >>
> >> http://savannah.nongnu.org/bugs/?44574
> >> http://lists.gnu.org/archive/html/avr-libc-dev/2015-03/msg00010.html
> >>
> >> Art there plans to fix that?
> >
> > Yes. Will submit patch to avr-libc by next week.
> 
> Thanks.
> 
> > Regards,
> > Pitchumani
> 
> If the device libs are moved, all the ~200 .dev/<device> directories will
> contain just 1 file each: crt1.o.  Is it much work to tidy that up?  (For
> example by renaming to, say, crt<device>.o and moving them to a
> common place or to their natural multilib location.)

No, It is possible to do with the same patch.
I'll rename crt1.o to crt<device>.o and move it to multilib location.

Regards,
Pitchumani

^ permalink raw reply	[flat|nested] 23+ messages in thread

* RE: [patch,avr]: Part2: Fix various problems with specs and specs file generation.
  2015-04-09 12:55                 ` Sivanupandi, Pitchumani
@ 2015-04-15 10:17                   ` Sivanupandi, Pitchumani
  2015-04-17 14:03                     ` [patch,avr,installed] ad PR65296: Adjust specs to new avr-libc layout as of #44574 Georg-Johann Lay
  0 siblings, 1 reply; 23+ messages in thread
From: Sivanupandi, Pitchumani @ 2015-04-15 10:17 UTC (permalink / raw)
  To: Sivanupandi, Pitchumani, Georg-Johann Lay, Denis Chertykov
  Cc: GCC Patches, Joerg Wunsch, Selvaraj, Senthil_Kumar

[-- Attachment #1: Type: text/plain, Size: 1232 bytes --]

> -----Original Message-----
> From: gcc-patches-owner@gcc.gnu.org [mailto:gcc-patches-
> owner@gcc.gnu.org] On Behalf Of Sivanupandi, Pitchumani
> Sent: Thursday, April 09, 2015 6:26 PM
> To: Georg-Johann Lay; Denis Chertykov
> Cc: GCC Patches; Joerg Wunsch; Selvaraj, Senthil_Kumar
> Subject: RE: [patch,avr]: Part2: Fix various problems with specs and specs
> file generation.
...
> >
> > If the device libs are moved, all the ~200 .dev/<device> directories
> > will contain just 1 file each: crt1.o.  Is it much work to tidy that
> > up?  (For example by renaming to, say, crt<device>.o and moving
> them
> > to a common place or to their natural multilib location.)
> 
> No, It is possible to do with the same patch.
> I'll rename crt1.o to crt<device>.o and move it to multilib location.

Hi Johann,

This is done.
https://savannah.nongnu.org/bugs/?44574

Attached a patch for corresponding changes in gcc.

gcc/ChangeLog
* config/avr/avr-mcus.def: Change startup and device lib name
to crt<device>.o and lib<device>.a respectively.
* config/avr/avr.opt: Update device lib name.
* config/avr/gen-avr-mmcu-specs.c (print_mcu): Update start file name
and device lib name.

Regards,
Pitchumani

[-- Attachment #2: Change-crt-device-lib-name.patch --]
[-- Type: application/octet-stream, Size: 1868 bytes --]

diff --git a/gcc/config/avr/avr-mcus.def b/gcc/config/avr/avr-mcus.def
index ce4b782..8526578 100644
--- a/gcc/config/avr/avr-mcus.def
+++ b/gcc/config/avr/avr-mcus.def
@@ -44,8 +44,8 @@
                      used by DRIVER_SELF_SPECS and gen-avr-mmcu-specs.c for
                      - the name of the device specific specs file
                        in -specs=device-specs/spec-<NAME>
-                     - the name of the startup file dev/<NAME>/crt1.o
-                     - the name of the device library dev/<NAME>/libdev.a
+                     - the name of the startup file crt<NAME>.o
+                     - the name of the device library lib<NAME>.a
 
        ARCH          Specifies the multilib variant together with AVR_SHORT_SP
 
diff --git a/gcc/config/avr/avr.opt b/gcc/config/avr/avr.opt
index 5de5f90..1986c4f 100644
--- a/gcc/config/avr/avr.opt
+++ b/gcc/config/avr/avr.opt
@@ -97,4 +97,4 @@ Allow to use truncation instead of rounding towards 0 for fractional int types
 
 nodevicelib
 Driver Target Report RejectNegative
-Do not link against the device-specific library libdev.a
+Do not link against the device-specific library lib<device>.a
diff --git a/gcc/config/avr/gen-avr-mmcu-specs.c b/gcc/config/avr/gen-avr-mmcu-specs.c
index 3594d8a..0931920 100644
--- a/gcc/config/avr/gen-avr-mmcu-specs.c
+++ b/gcc/config/avr/gen-avr-mmcu-specs.c
@@ -171,11 +171,11 @@ print_mcu (const avr_mcu_t *mcu)
   if (is_device)
     {
       fprintf (f, "*avrlibc_startfile:\n");
-      fprintf (f, "\tdev/%s/crt1.o%%s", mcu->name);
+      fprintf (f, "\tcrt%s.o%%s", mcu->name);
       fprintf (f, "\n\n");
 
       fprintf (f, "*avrlibc_devicelib:\n");
-      fprintf (f, "\t%%{!nodevicelib:dev/%s/libdev.a%%s}", mcu->name);
+      fprintf (f, "\t%%{!nodevicelib:lib%s.a%%s}", mcu->name);
       fprintf (f, "\n\n");
     }
 #endif  // WITH_AVRLIBC

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [patch,avr,installed] ad PR65296: Adjust specs to new avr-libc layout as of #44574
  2015-04-15 10:17                   ` Sivanupandi, Pitchumani
@ 2015-04-17 14:03                     ` Georg-Johann Lay
  2015-04-17 14:43                       ` Denis Chertykov
  0 siblings, 1 reply; 23+ messages in thread
From: Georg-Johann Lay @ 2015-04-17 14:03 UTC (permalink / raw)
  To: Sivanupandi, Pitchumani, Denis Chertykov
  Cc: GCC Patches, Joerg Wunsch, Selvaraj, Senthil_Kumar

...I went ahead and installed as

http://gcc.gnu.org/r222179

It will be backported to 5.2 as soon as 5.1 is open for patches again (assuming 
RM won't approve this one for 5.1).


As far as I can tell, all works fine now, even with install-paths containing 
spaces and LTO.


Johann


2015-04-17  Sivanupandi Pitchumani <Pitchumani.Sivanupandi@atmel.com>

	PR target/65296
	* config/avr/gen-avr-mmcu-specs.c (*avrlibc_startfile): Adjust
	to new AVR-LibC file layout (bug #44574).
	(*avrlibc_devicelib): Same.
	* config/avr/avr-mcus.def: Adjust comments.
	* config/avr/avr.opt (nodevicelib): Adjust help.



Index: config/avr/gen-avr-mmcu-specs.c
===================================================================
--- config/avr/gen-avr-mmcu-specs.c     (revision 222178)
+++ config/avr/gen-avr-mmcu-specs.c     (revision 222179)
@@ -171,11 +171,11 @@ bool is_arch = NULL == mcu->macro;
    if (is_device)
      {
        fprintf (f, "*avrlibc_startfile:\n");
-      fprintf (f, "\tdev/%s/crt1.o%%s", mcu->name);
+      fprintf (f, "\tcrt%s.o%%s", mcu->name);
        fprintf (f, "\n\n");

        fprintf (f, "*avrlibc_devicelib:\n");
-      fprintf (f, "\t%%{!nodevicelib:dev/%s/libdev.a%%s}", mcu->name);
+      fprintf (f, "\t%%{!nodevicelib:-l%s}", mcu->name);
        fprintf (f, "\n\n");
      }
  #endif  // WITH_AVRLIBC
Index: config/avr/avr-mcus.def
===================================================================
--- config/avr/avr-mcus.def     (revision 222178)
+++ config/avr/avr-mcus.def     (revision 222179)
@@ -44,8 +44,8 @@ Before including this file, define a mac
                       used by DRIVER_SELF_SPECS and gen-avr-mmcu-specs.c for
                       - the name of the device specific specs file
                         in -specs=device-specs/spec-<NAME>
-                     - the name of the startup file dev/<NAME>/crt1.o
-                     - the name of the device library dev/<NAME>/libdev.a
+                     - the name of the startup file crt<NAME>.o
+                     - to link the device library by means of -l<NAME>

         ARCH          Specifies the multilib variant together with AVR_SHORT_SP

Index: config/avr/avr.opt
===================================================================
--- config/avr/avr.opt  (revision 222178)
+++ config/avr/avr.opt  (revision 222179)
@@ -97,4 +97,4 @@ Allow to use truncation instead of round

  nodevicelib
  Driver Target Report RejectNegative
-Do not link against the device-specific library libdev.a
+Do not link against the device-specific library lib<MCU>.a

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [patch,avr,installed] ad PR65296: Adjust specs to new avr-libc layout as of #44574
  2015-04-17 14:03                     ` [patch,avr,installed] ad PR65296: Adjust specs to new avr-libc layout as of #44574 Georg-Johann Lay
@ 2015-04-17 14:43                       ` Denis Chertykov
  2015-04-17 15:32                         ` Georg-Johann Lay
  0 siblings, 1 reply; 23+ messages in thread
From: Denis Chertykov @ 2015-04-17 14:43 UTC (permalink / raw)
  To: Georg-Johann Lay
  Cc: Sivanupandi, Pitchumani, GCC Patches, Joerg Wunsch, Selvaraj,
	Senthil_Kumar

2015-04-17 17:02 GMT+03:00 Georg-Johann Lay <avr@gjlay.de>:
> ...I went ahead and installed as
>
> http://gcc.gnu.org/r222179
>
> It will be backported to 5.2 as soon as 5.1 is open for patches again
> (assuming RM won't approve this one for 5.1).

IMHO AVR port is not locked for patches.
It's not a primary target.

>
>
> As far as I can tell, all works fine now, even with install-paths containing
> spaces and LTO.
>
>
> Johann
>
>
> 2015-04-17  Sivanupandi Pitchumani <Pitchumani.Sivanupandi@atmel.com>
>
>         PR target/65296
>         * config/avr/gen-avr-mmcu-specs.c (*avrlibc_startfile): Adjust
>         to new AVR-LibC file layout (bug #44574).
>         (*avrlibc_devicelib): Same.
>         * config/avr/avr-mcus.def: Adjust comments.
>         * config/avr/avr.opt (nodevicelib): Adjust help.
>
>
>
> Index: config/avr/gen-avr-mmcu-specs.c
> ===================================================================
> --- config/avr/gen-avr-mmcu-specs.c     (revision 222178)
> +++ config/avr/gen-avr-mmcu-specs.c     (revision 222179)
> @@ -171,11 +171,11 @@ bool is_arch = NULL == mcu->macro;
>    if (is_device)
>      {
>        fprintf (f, "*avrlibc_startfile:\n");
> -      fprintf (f, "\tdev/%s/crt1.o%%s", mcu->name);
> +      fprintf (f, "\tcrt%s.o%%s", mcu->name);
>        fprintf (f, "\n\n");
>
>        fprintf (f, "*avrlibc_devicelib:\n");
> -      fprintf (f, "\t%%{!nodevicelib:dev/%s/libdev.a%%s}", mcu->name);
> +      fprintf (f, "\t%%{!nodevicelib:-l%s}", mcu->name);
>        fprintf (f, "\n\n");
>      }
>  #endif  // WITH_AVRLIBC
> Index: config/avr/avr-mcus.def
> ===================================================================
> --- config/avr/avr-mcus.def     (revision 222178)
> +++ config/avr/avr-mcus.def     (revision 222179)
> @@ -44,8 +44,8 @@ Before including this file, define a mac
>                       used by DRIVER_SELF_SPECS and gen-avr-mmcu-specs.c for
>                       - the name of the device specific specs file
>                         in -specs=device-specs/spec-<NAME>
> -                     - the name of the startup file dev/<NAME>/crt1.o
> -                     - the name of the device library dev/<NAME>/libdev.a
> +                     - the name of the startup file crt<NAME>.o
> +                     - to link the device library by means of -l<NAME>
>
>         ARCH          Specifies the multilib variant together with
> AVR_SHORT_SP
>
> Index: config/avr/avr.opt
> ===================================================================
> --- config/avr/avr.opt  (revision 222178)
> +++ config/avr/avr.opt  (revision 222179)
> @@ -97,4 +97,4 @@ Allow to use truncation instead of round
>
>  nodevicelib
>  Driver Target Report RejectNegative
> -Do not link against the device-specific library libdev.a
> +Do not link against the device-specific library lib<MCU>.a
>

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [patch,avr,installed] ad PR65296: Adjust specs to new avr-libc layout as of #44574
  2015-04-17 14:43                       ` Denis Chertykov
@ 2015-04-17 15:32                         ` Georg-Johann Lay
  2015-04-17 16:46                           ` Denis Chertykov
  0 siblings, 1 reply; 23+ messages in thread
From: Georg-Johann Lay @ 2015-04-17 15:32 UTC (permalink / raw)
  To: Denis Chertykov
  Cc: Sivanupandi, Pitchumani, GCC Patches, Selvaraj, Senthil_Kumar

Am 04/17/2015 um 04:43 PM schrieb Denis Chertykov:
> 2015-04-17 17:02 GMT+03:00 Georg-Johann Lay <avr@gjlay.de>:
>> ...I went ahead and installed as
>>
>> http://gcc.gnu.org/r222179
>>
>> It will be backported to 5.2 as soon as 5.1 is open for patches again
>> (assuming RM won't approve this one for 5.1).
>
> IMHO AVR port is not locked for patches.
> It's not a primary target.

hmm, the usual text is that the complete branch is frozen:

> the branches/gcc-5-branch has been created last night and GCC 5.1-rc1 built and announced.
> The branch is now frozen for blocking regressions and documentation fixes only, all changes to the branch require a RM approval now.

https://gcc.gnu.org/ml/gcc/2015-04/msg00145.html

Johann

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [patch,avr,installed] ad PR65296: Adjust specs to new avr-libc layout as of #44574
  2015-04-17 15:32                         ` Georg-Johann Lay
@ 2015-04-17 16:46                           ` Denis Chertykov
  0 siblings, 0 replies; 23+ messages in thread
From: Denis Chertykov @ 2015-04-17 16:46 UTC (permalink / raw)
  To: Georg-Johann Lay
  Cc: Sivanupandi, Pitchumani, GCC Patches, Selvaraj, Senthil_Kumar

2015-04-17 18:32 GMT+03:00 Georg-Johann Lay <avr@gjlay.de>:
> Am 04/17/2015 um 04:43 PM schrieb Denis Chertykov:
>>
>> 2015-04-17 17:02 GMT+03:00 Georg-Johann Lay <avr@gjlay.de>:
>>>
>>> ...I went ahead and installed as
>>>
>>> http://gcc.gnu.org/r222179
>>>
>>> It will be backported to 5.2 as soon as 5.1 is open for patches again
>>> (assuming RM won't approve this one for 5.1).
>>
>>
>> IMHO AVR port is not locked for patches.
>> It's not a primary target.
>
>
> hmm, the usual text is that the complete branch is frozen:

I asked this question a few years ago.
The answe was that I can change the port in any time.
Maybe something has changed.

^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2015-04-17 16:46 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-02 19:40 [patch,avr]: Fix various problems with specs and specs file generation Georg-Johann Lay
2015-03-03  7:46 ` Denis Chertykov
2015-03-03 13:20 ` Senthil Kumar Selvaraj
2015-03-09 16:03   ` [patch,avr]: Part2: " Georg-Johann Lay
2015-03-09 20:00     ` Denis Chertykov
2015-03-10 15:02       ` [patch,avr]: Part3 and 4: " Georg-Johann Lay
2015-03-11 18:18         ` Denis Chertykov
2015-03-16 18:18           ` [patch,avr]: Part5: " Georg-Johann Lay
2015-03-17  6:37             ` Denis Chertykov
2015-04-06  9:54     ` [patch,avr]: Part2: " Sivanupandi, Pitchumani
2015-04-07 12:34       ` Georg-Johann Lay
2015-04-08  8:28         ` Denis Chertykov
2015-04-08 11:25           ` Georg-Johann Lay
2015-04-09 10:59             ` Sivanupandi, Pitchumani
2015-04-09 11:23               ` Georg-Johann Lay
2015-04-09 12:55                 ` Sivanupandi, Pitchumani
2015-04-15 10:17                   ` Sivanupandi, Pitchumani
2015-04-17 14:03                     ` [patch,avr,installed] ad PR65296: Adjust specs to new avr-libc layout as of #44574 Georg-Johann Lay
2015-04-17 14:43                       ` Denis Chertykov
2015-04-17 15:32                         ` Georg-Johann Lay
2015-04-17 16:46                           ` Denis Chertykov
2015-04-09 11:44               ` [patch,avr,committed]: ad PR65296: work around device-specs file + dejagnu for c++ Georg-Johann Lay
2015-03-09 16:21   ` [patch,avr]: Fix various problems with specs and specs file generation Georg-Johann Lay

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).