Patchwork [avr] : Add more devices take #2: 2/2

login
register
mail settings
Submitter Georg-Johann Lay
Date Feb. 13, 2013, 10:17 a.m.
Message ID <511B6844.900@gcc.gnu.org>
Download mbox | patch
Permalink /patch/220108/
State New
Headers show

Comments

Georg-Johann Lay - Feb. 13, 2013, 10:17 a.m.
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.
Georg-Johann Lay - Feb. 19, 2013, 3:35 p.m.
CCing Richard in case this needs RM approval (I don't think so because 
the patch just changes ternary parts).

Ping #1 for:
http://gcc.gnu.org/ml/gcc-patches/2013-02/msg00579.html


Georg-Johann Lay schrieb:
> 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.
>
Denis Chertykov - Feb. 24, 2013, 11:09 a.m.
2013/2/19 Georg-Johann Lay <avr@gjlay.de>:
> CCing Richard in case this needs RM approval (I don't think so because the
> patch just changes ternary parts).
>
> Ping #1 for:
> http://gcc.gnu.org/ml/gcc-patches/2013-02/msg00579.html
>
>
> Georg-Johann Lay schrieb:
>>
>> 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.
>>
>

I'm sorry. I was on vacation.

Approved.

Denis.

Patch

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;