[Patch, avr] Propagate -mrelax gcc driver flag to assembler

Georg-Johann Lay avr@gjlay.de
Sat Apr 12 16:36:00 GMT 2014


Senthil Kumar Selvaraj schrieb:
> This patch modifies AVR target's ASM spec to pass -mlink-relax to the
> assembler if -mrelax is passed to the compiler driver. This was already
> being passed on to the linker, this patch merely makes the assembler
> also aware of it.
> 
> The corresponding patch in binutils to handle the -mlink-relax patch is
> already committed in the binutils repo. I'm not sure how to manage a
> running a newer gcc with an older version of binutils though - how is this
> generally handled?

The right place is gcc/configure.ac and have a macro defined depending 
on whether gas supports -mlink-relax.


Same should be done for -mrmw, IMO, for similar reasons, e.g. something like

case "$target" in
   ...
   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.])])

or

     gcc_GAS_CHECK_FEATURE([-mrmw option], gcc_cv_as_avr_mrmw,,
                           [-mrmw], [.text],,,)
     if test x$gcc_cv_as_avr_mrmw = xyes; then
       AC_DEFINE(HAVE_AS_AVR_MRMW_OPTION, 1,
                 [Define if your assembler supports the -mrmw option.])


However, the gcc-4_9-branch has already been created...

Johann


> If ok, could someone commit please? I don't have commit access.
> 
> Regards
> Senthil
> 
> 2014-04-11  Senthil Kumar Selvaraj  <senthil_kumar.selvaraj@atmel.com>
> 
> 	* config/avr/avr.h: Modify ASM_SPEC to pass -mlink-relax
> 	to assembler.
> 
> 
> diff --git gcc/config/avr/avr.h gcc/config/avr/avr.h
> index 78434ec..c1b4dd9 100644
> --- gcc/config/avr/avr.h
> +++ gcc/config/avr/avr.h
> @@ -512,7 +512,8 @@ 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=*:%*}) "
> +#define ASM_SPEC "%:device_to_as(%{mmcu=*:%*})\
> +%{mrelax:-mlink-relax}"
>    
>  #define LINK_SPEC "\
>  %{mrelax:--relax\
> 



More information about the Gcc-patches mailing list