diff mbox

[avr] Propagate -mrelax gcc driver flag to assembler

Message ID 53734A8C.9010401@gjlay.de
State New
Headers show

Commit Message

Georg-Johann Lay May 14, 2014, 10:50 a.m. UTC
Am 05/13/2014 02:48 PM, schrieb Senthil Kumar Selvaraj:
> On Mon, May 12, 2014 at 01:19:37PM +0200, Georg-Johann Lay wrote:
>> Am 04/18/2014 11:52 AM, schrieb Senthil Kumar Selvaraj:
>>>
>>> On Sat, Apr 12, 2014 at 06:36:01PM +0200, Georg-Johann Lay wrote:
>>>> Senthil Kumar Selvaraj schrieb:

[...]

>>> 2014-04-18  Senthil Kumar Selvaraj  <senthil_kumar.selvaraj@atmel.com>
>>>
>>> 	* config/avr/avr.h: Pass on mlink-relax to assembler.
>>> 	* configure.ac: Test for mlink-relax support in assembler.
>>> 	* configure: Regenerate.
>>>
>>> diff --git gcc/config/avr/avr.h gcc/config/avr/avr.h
>>> index 78434ec..b4e3eb1 100644
>>> --- gcc/config/avr/avr.h
>>> +++ gcc/config/avr/avr.h
>>> @@ -512,7 +512,28 @@ extern const char *avr_device_to_sp8 (int argc, const char **argv);
>>>       %{!fenforce-eh-specs:-fno-enforce-eh-specs} \
>>>       %{!fexceptions:-fno-exceptions}"
>>>
>>> -#define ASM_SPEC "%:device_to_as(%{mmcu=*:%*}) "
>>> +#ifdef HAVE_AS_RELAX_OPTION
>>> +#define ASM_RELAX_SPEC "%{mrelax:-mlink-relax}"
>>> +#else
>>> +#define ASM_RELAX_SPEC ""
>>> +#endif
>>> +
>>> +#define ASM_SPEC "%:device_to_as(%{mmcu=*:%*})\
>>> +%(asm_relax)"
>>> +
>>> +/* This macro defines names of additional specifications to put in the specs
>>> +   that can be used in various specifications like CC1_SPEC.  Its definition
>>> +   is an initializer with a subgrouping for each command option.
>>> +
>>> +   Each subgrouping contains a string constant, that defines the
>>> +   specification name, and a string constant that used by the GCC driver
>>> +   program.
>>> +
>>> +   Do not define this macro if it does not need to do anything.  */
>>> +
>>> +#define EXTRA_SPECS \
>>> +  { "asm_relax",	ASM_RELAX_SPEC }
>>> +
>>
>> Hi, wouldn't it be easier to add just a line to driver-avr.c:avr_device_to_as ?
>
> Well, I couldn't figure out how to do it without passing in the nested spec and
> then do argument checking inside avr_device_to_as. Something like
>
> #define ASM_SPEC "%:device_to_as(%{mmcu=*:%*} %{mrelax:-mlink-relax})"
>
> and then handle argc==0, 1 and 2 cases by strcmp'ing against
> -mlink-relax if HAVE_AVR_AS_LINK_RELAX_OPTION.
> Did I miss something?

Or what about simply that, which works for me:




Johann

Comments

Rainer Orth May 14, 2014, 10:56 a.m. UTC | #1
Georg-Johann Lay <avr@gjlay.de> writes:

> Or what about simply that, which works for me:
>
>
> Index: config/avr/avr.h
> ===================================================================
> --- config/avr/avr.h    (revision 210276)
> +++ config/avr/avr.h    (working copy)
> @@ -512,7 +512,11 @@ extern const char *avr_device_to_sp8 (in
>      %{!fenforce-eh-specs:-fno-enforce-eh-specs} \
>      %{!fexceptions:-fno-exceptions}"
>
> +#ifdef HAVE_AS_AVR_LINK_RELAX_OPTION
> +#define ASM_SPEC "%:device_to_as(%{mmcu=*:%*}) %{mrelax:-mlink-relax} "
> +#else
>  #define ASM_SPEC "%:device_to_as(%{mmcu=*:%*}) "
> +#endif
>
>  #define LINK_SPEC "\
>  %{mrelax:--relax\

Better yet something like

#ifdef HAVE_AS_AVR_LINK_RELAX_OPTION
#define LINK_RELAX_SPEC "%{mrelax:-mlink-relax} "
#else
#define LINK_RELAX_SPEC ""
#endif

#define ASM_SPEC "%:device_to_as(%{mmcu=*:%*}) " LINK_RELAX_SPEC

to avoid unnecessary duplication.

	Rainer
diff mbox

Patch

Index: config/avr/avr.h
===================================================================
--- config/avr/avr.h    (revision 210276)
+++ config/avr/avr.h    (working copy)
@@ -512,7 +512,11 @@  extern const char *avr_device_to_sp8 (in
      %{!fenforce-eh-specs:-fno-enforce-eh-specs} \
      %{!fexceptions:-fno-exceptions}"

+#ifdef HAVE_AS_AVR_LINK_RELAX_OPTION
+#define ASM_SPEC "%:device_to_as(%{mmcu=*:%*}) %{mrelax:-mlink-relax} "
+#else
  #define ASM_SPEC "%:device_to_as(%{mmcu=*:%*}) "
+#endif

  #define LINK_SPEC "\
  %{mrelax:--relax\