diff mbox

[avr] : Part3 and 4: Fix various problems with specs and specs file generation.

Message ID 54FF0788.6050108@gjlay.de
State New
Headers show

Commit Message

Georg-Johann Lay March 10, 2015, 3:02 p.m. UTC
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.

Comments

Denis Chertykov March 11, 2015, 6:18 p.m. UTC | #1
2015-03-10 18:02 GMT+03:00 Georg-Johann Lay <avr@gjlay.de>:
> 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.
>

Approved.

Denis.
diff mbox

Patch

Index: config/avr/driver-avr.c
===================================================================
--- config/avr/driver-avr.c	(revision 221321)
+++ config/avr/driver-avr.c	(working copy)
@@ -60,7 +60,10 @@  avr_device_to_as (int argc, const char *
 
   return concat ("-mmcu=", avr_current_arch->arch_name,
     avr_current_device->dev_attribute & AVR_ERRATA_SKIP ? "" : " -mno-skip-bug",
-    avr_current_device->dev_attribute & AVR_ISA_RMW ? " -mrmw" : "", NULL);
+#ifdef HAVE_AS_AVR_MRMW_OPTION
+    avr_current_device->dev_attribute & AVR_ISA_RMW ? " -mrmw" : "",
+#endif // have as -mrmw
+    NULL);
 }
 
 /* Returns command line parameters to pass to ld.  */
Index: configure
===================================================================
--- configure	(revision 221321)
+++ configure	(working copy)
@@ -24158,6 +24158,39 @@  $as_echo "#define HAVE_AS_NO_MUL_BUG_ABO
 fi
     ;;
 
+  avr-*-*)
+    { $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) 2>&5
+  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 -f conftest.o conftest.s
+  fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_as_avr_mrmw" >&5
+$as_echo "$gcc_cv_as_avr_mrmw" >&6; }
+if test $gcc_cv_as_avr_mrmw = yes; then
+
+$as_echo "#define HAVE_AS_AVR_MRMW_OPTION 1" >>confdefs.h
+
+fi
+    ;;
+
   sparc*-*-*)
     { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for .register" >&5
 $as_echo_n "checking assembler for .register... " >&6; }
Index: config.in
===================================================================
--- config.in	(revision 221321)
+++ config.in	(working copy)
@@ -211,6 +211,12 @@  that are supported for each access macro
 #endif
 
 
+/* Define if your assembler supports -mrmw option. */
+#ifndef USED_FOR_TARGET
+#undef HAVE_AS_AVR_MRMW_OPTION
+#endif
+
+
 /* Define if your assembler supports cmpb. */
 #ifndef USED_FOR_TARGET
 #undef HAVE_AS_CMPB
@@ -235,6 +241,12 @@  that are supported for each access macro
 #endif
 
 
+/* Define if your assembler supports .module. */
+#ifndef USED_FOR_TARGET
+#undef HAVE_AS_DOT_MODULE
+#endif
+
+
 /* Define if your assembler supports DSPR1 mult. */
 #ifndef USED_FOR_TARGET
 #undef HAVE_AS_DSPR1_MULT
@@ -447,12 +459,6 @@  that are supported for each access macro
 #endif
 
 
-/* Define if the assembler understands .module. */
-#ifndef USED_FOR_TARGET
-#undef HAVE_AS_DOT_MODULE
-#endif
-
-
 /* Define if your assembler supports the -no-mul-bug-abort option. */
 #ifndef USED_FOR_TARGET
 #undef HAVE_AS_NO_MUL_BUG_ABORT_OPTION
Index: configure.ac
===================================================================
--- configure.ac	(revision 221321)
+++ configure.ac	(working copy)
@@ -3603,6 +3603,13 @@  [	.set nomacro
 		[Define if your assembler supports the -no-mul-bug-abort option.])])
     ;;
 
+  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.])])
+    ;;
+
   sparc*-*-*)
     gcc_GAS_CHECK_FEATURE([.register], gcc_cv_as_sparc_register_op,,,
       [.register %g2, #scratch],,