This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


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

Re: [Patch,avr]: Add more devices take #2: 2/2


And here 2/2 with the device -> arch mapping for gas.


Ok for trunk?

Johann


	* config/avr/avr.h (device_to_arch): Rename to device_to_ld.
	(avr_device_to_arch): Rename to avr_device_to_ld.
	(avr_device_to_as): New prototype.
	(EXTRA_SPEC_FUNCTIONS): Add device_to_as.
	(ASM_SPEC): Use device_to_as to get -mmcu= and -mno-skip-bug=.
	* config/avr/driver-avr.c (avr_device_to_as): New.
	(avr_device_to_arch): Rename to avr_device_to_ld.
Index: config/avr/avr.h
===================================================================
--- config/avr/avr.h	(revision 195877)
+++ config/avr/avr.h	(working copy)
@@ -486,14 +486,16 @@ typedef struct avr_args
 #define ADJUST_INSN_LENGTH(INSN, LENGTH)                \
     (LENGTH = avr_adjust_insn_length (INSN, LENGTH))
 
-extern const char *avr_device_to_arch (int argc, const char **argv);
+extern const char *avr_device_to_as (int argc, const char **argv);
+extern const char *avr_device_to_ld (int argc, const char **argv);
 extern const char *avr_device_to_data_start (int argc, const char **argv);
 extern const char *avr_device_to_startfiles (int argc, const char **argv);
 extern const char *avr_device_to_devicelib (int argc, const char **argv);
 extern const char *avr_device_to_sp8 (int argc, const char **argv);
 
 #define EXTRA_SPEC_FUNCTIONS                            \
-  { "device_to_arch", avr_device_to_arch },             \
+  { "device_to_as", avr_device_to_as },                 \
+  { "device_to_ld", avr_device_to_ld },                 \
   { "device_to_data_start", avr_device_to_data_start }, \
   { "device_to_startfile", avr_device_to_startfiles },  \
   { "device_to_devicelib", avr_device_to_devicelib },   \
@@ -507,14 +509,9 @@ extern const char *avr_device_to_sp8 (in
 #define CC1PLUS_SPEC "%{!frtti:-fno-rtti} \
     %{!fenforce-eh-specs:-fno-enforce-eh-specs} \
     %{!fexceptions:-fno-exceptions}"
-/* A C string constant that tells the GCC driver program options to
-   pass to `cc1plus'.  */
-
-#define ASM_SPEC "%{mmcu=avr25:-mmcu=avr2;mmcu=avr35:-mmcu=avr3;mmcu=avr31:-mmcu=avr3;mmcu=avr51:-mmcu=avr5;\
-mmcu=*:-mmcu=%*} \
-%{mmcu=*:%{!mmcu=avr2:%{!mmcu=at90s8515:%{!mmcu=avr31:%{!mmcu=atmega103:\
--mno-skip-bug}}}}}"
 
+#define ASM_SPEC "%:device_to_as(%{mmcu=*:%*}) "
+  
 #define LINK_SPEC "\
 %{mrelax:--relax\
          %{mpmem-wrap-around:%{mmcu=at90usb8*:--pmem-wrap-around=8k}\
@@ -524,7 +521,7 @@ mmcu=*:-mmcu=%*} \
                              %{mmcu=atmega64*|\
                                mmcu=at90can64*|\
                                mmcu=at90usb64*:--pmem-wrap-around=64k}}}\
-%:device_to_arch(%{mmcu=*:%*})\
+%:device_to_ld(%{mmcu=*:%*})\
 %:device_to_data_start(%{mmcu=*:%*})"
 
 #define LIB_SPEC \
Index: config/avr/driver-avr.c
===================================================================
--- config/avr/driver-avr.c	(revision 195877)
+++ config/avr/driver-avr.c	(working copy)
@@ -48,10 +48,25 @@ avr_set_current_device (const char *name
   avr_current_arch = &avr_arch_types[avr_current_device->arch];
 }
 
-/* Returns command line parameters that describe the device architecture.  */
+/* Returns command line parameters to pass to as.  */
 
-const char *
-avr_device_to_arch (int argc, const char **argv)
+const char*
+avr_device_to_as (int argc, const char **argv)
+{
+  if (0 == argc)
+    return NULL;
+
+  avr_set_current_device (argv[0]);
+
+  return concat ("-mmcu=", avr_current_arch->arch_name,
+                 avr_current_device->errata_skip ? "" : " -mno-skip-bug",
+                 NULL);
+}
+
+/* Returns command line parameters to pass to ld.  */
+
+const char*
+avr_device_to_ld (int argc, const char **argv)
 {
   if (0 == argc)
     return NULL;

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