This is just a small addendum to the option and specs handling:
- Document new avr-gcc command options
- Change -march= to -mmcu= in some test cases
- Add comfigure test to detect whether gas supports -mrmw and --mlink-relax.
- Use result of these tests in specs generatio, i.e. omit respective options if
they are not supported.
Ok to apply?
Two issues remain:
- The tests that add -mmcu= to the command options will fail because there must
not be more than one -mmcu=. Supporting several, incompatible MCUs makes no
sense (same for incompatible -march + -mmcu which was the case). In 4.9 this
works per accident with unspecified definitions for built-in macros or when the
options differ in default settings, for example.
- Spaces in the installation path are not supported. It's possible to recover
from spaces in -specs= by escaping them in spec function device-specs-file.
However this is almost impossible for the device library without changing gcc.c
which can use convert_white_space() as needed. Adding more than one escape
level is not possible because the '\' would be interpreted as part of the path.
Johann
gcc/
PR target/65296
* configure.ac [avr]: Check as for options -mrmw, --mlink-relax.
* configure: Regenerate.
* config.in: Regenerate.
* config/avr/gen-avr-mmcu-specs.c (config.h): Include it.
(*asm_relax): Only define spec if HAVE_AS_AVR_MLINK_RELAX_OPTION.
(*asm_rmw): Only define spec if HAVE_AS_AVR_MRMW_OPTION.
gcc/
PR target/65296
* doc/invoke.texi (AVR Options) [-mrmw]: Document it.
[-mn-flash]: Document it.
[__AVR_DEVICE_NAME__]: Document it.
[__ARV_ARCH__]: Document avrtiny.
gcc/testsuite/
PR target/65296
* gcc.target/avr/tiny-memx: Use -mmcu instead of -march.
* gcc.target/avr/tiny-caller-save.c: Same.
gcc/
PR target/65296
* configure.ac [avr]: Check as for option -mrmw.
* configure: Regenerate.
* config.in: Regenerate.
* config/avr/driver-avr.c (avr_device_to_as): Don't add -mrmw to
assembler options if not HAVE_AS_AVR_MRMW_OPTION.
Index: configure.ac
===
--- configure.ac (revision 221318)
+++ configure.ac (working copy)
@@ -3623,6 +3623,18 @@ [ .set nomacro
[Define if your assembler supports the lituse_jsrdirect relocation.])])
;;
+ avr-*-*)
+gcc_GAS_CHECK_FEATURE([--mlink-relax option], gcc_cv_as_avr_mlink_relax,,
+ [--mlink-relax], [.text],,
+ [AC_DEFINE(HAVE_AS_AVR_MLINK_RELAX_OPTION, 1,
+ [Define if your assembler supports --mlink-relax option.])])
+
+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.])])
+;;
+
cris-*-*)
gcc_GAS_CHECK_FEATURE([-no-mul-bug-abort option],
gcc_cv_as_cris_no_mul_bug,[2,15,91],
Index: configure
===
--- configure (revision 221318)
+++ configure (working copy)
@@ -24185,6 +24185,70 @@ $as_echo #define HAVE_AS_JSRDIRECT_RELO
fi
;;
+ avr-*-*)
+{ $as_echo $as_me:${as_lineno-$LINENO}: checking assembler for --mlink-relax option 5
+$as_echo_n checking assembler for --mlink-relax option... 6; }
+if test ${gcc_cv_as_avr_mlink_relax+set} = set; then :
+ $as_echo_n (cached) 6
+else
+ gcc_cv_as_avr_mlink_relax=no
+ if test x$gcc_cv_as != x; then
+$as_echo '.text' conftest.s
+if { ac_try='$gcc_cv_as $gcc_cv_as_flags --mlink-relax -o conftest.o conftest.s 5'
+ { { eval echo \\$as_me\:${as_lineno-$LINENO}: \$ac_try\; } 5
+ (eval $ac_try) 25
+ ac_status=$?
+ $as_echo $as_me:${as_lineno-$LINENO}: \$? = $ac_status 5
+ test $ac_status = 0; }; }
+then
+ gcc_cv_as_avr_mlink_relax=yes
+else
+ echo configure: failed program was 5
+ cat conftest.s 5
+fi
+rm -f conftest.o conftest.s
+ fi
+fi
+{ $as_echo $as_me:${as_lineno-$LINENO}: result: $gcc_cv_as_avr_mlink_relax 5
+$as_echo $gcc_cv_as_avr_mlink_relax 6; }
+if test $gcc_cv_as_avr_mlink_relax = yes; then
+
+$as_echo #define HAVE_AS_AVR_MLINK_RELAX_OPTION 1 confdefs.h
+
+fi
+
+{ $as_echo $as_me:${as_lineno-$LINENO}: checking assembler for -mrmw option 5
+$as_echo_n checking assembler for -mrmw option... 6; }
+if test ${gcc_cv_as_avr_mrmw+set} = set; then :
+ $as_echo_n (cached) 6
+else
+ gcc_cv_as_avr_mrmw=no
+ if test x$gcc_cv_as != x; then
+$as_echo '.text' conftest.s
+if { ac_try='$gcc_cv_as $gcc_cv_as_flags -mrmw -o conftest.o conftest.s 5'
+ { { eval echo \\$as_me\:${as_lineno-$LINENO}: \$ac_try\; } 5
+ (eval $ac_try) 25
+ ac_status=$?
+ $as_echo $as_me:${as_lineno-$LINENO}: \$? = $ac_status 5
+ test $ac_status = 0; }; }
+then
+ gcc_cv_as_avr_mrmw=yes
+else
+ echo configure: failed program was 5
+ cat conftest.s 5
+fi
+rm