[patch, avr] Fix PR30417: Wrap -Tdata into %{!Tdata:...}.

2016-06-20 Thread Georg-Johann Lay
This patch allows to specify -Tdata and -Ttext on the command line for MCUs 
where the specs file sets these options.  For -mmcu=atmega88 for example, the 
respective specs reads:


*link_data_start:
-Tdata 0x800100

and the patch changes this to

*link_data_start:
%{!Tdata:-Tdata 0x800100}

Same for *link_text_start and -Ttext.

Ok for trunk and backport?

Johann


PR target/30417
* config/avr/gen-avr-mmcu-specs.c (print_mcu):
[*link_data_start]: Wrap -Tdata into %{!Tdata:...}.
[*link_text_start]: Wrap -Ttext into %{!Ttext:...}.

Index: config/avr/gen-avr-mmcu-specs.c
===
--- config/avr/gen-avr-mmcu-specs.c	(revision 237587)
+++ config/avr/gen-avr-mmcu-specs.c	(working copy)
@@ -242,12 +242,13 @@ bool is_arch = NULL == mcu->macro;
   fprintf (f, "*link_data_start:\n");
   if (mcu->data_section_start
   != arch->default_data_section_start)
-fprintf (f, "\t-Tdata 0x%lX", 0x80UL + mcu->data_section_start);
+fprintf (f, "\t%%{!Tdata:-Tdata 0x%lX}",
+ 0x80UL + 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, "\t%%{!Ttext:-Ttext 0x%lX}", 0UL + mcu->text_section_start);
   fprintf (f, "\n\n");
 }
 


Re: [patch, avr] Fix PR30417: Wrap -Tdata into %{!Tdata:...}.

2016-06-20 Thread Denis Chertykov
2016-06-20 16:36 GMT+03:00 Georg-Johann Lay :
> This patch allows to specify -Tdata and -Ttext on the command line for MCUs
> where the specs file sets these options.  For -mmcu=atmega88 for example,
> the respective specs reads:
>
> *link_data_start:
> -Tdata 0x800100
>
> and the patch changes this to
>
> *link_data_start:
> %{!Tdata:-Tdata 0x800100}
>
> Same for *link_text_start and -Ttext.
>
> Ok for trunk and backport?
>
> Johann
>
>
> PR target/30417
> * config/avr/gen-avr-mmcu-specs.c (print_mcu):
> [*link_data_start]: Wrap -Tdata into %{!Tdata:...}.
> [*link_text_start]: Wrap -Ttext into %{!Ttext:...}.
>

Ok. Please apply.