Commit 0c9dc4ae by Georg-Johann Lay Committed by Georg-Johann Lay

re PR target/65296 ([avr] fix various issues with specs file generation)

gcc/
	PR target/65296
	* configure.ac [avr]: Check as for options -mrmw, --mlink-relax.
	* configure: Regenerate.
	* config.in: Regenerate.
	* doc/invoke.texi (AVR Options) [-mrmw]: Document it.
	[-mn-flash]: Document it.
	[__AVR_ARCH__]: Document avrtiny.
	* 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/testsuite/
	PR target/65296
	* gcc.target/avr/tiny-memx: Use -mmcu instead of -march.
	* gcc.target/avr/tiny-caller-save.c: Same.

From-SVN: r221355
parent 91d4a5ea
2015-03-10 Georg-Johann Lay <avr@gjlay.de>
PR target/65296
* configure.ac [avr]: Check as for options -mrmw, --mlink-relax.
* configure: Regenerate.
* config.in: Regenerate.
* doc/invoke.texi (AVR Options) [-mrmw]: Document it.
[-mn-flash]: Document it.
[__AVR_ARCH__]: Document avrtiny.
* 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.
2015-03-11 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
* doc/invoke.texi: Add missing cpu values (z196, zEC12).
......
......@@ -247,6 +247,18 @@
#endif
/* Define if your avr assembler supports --mlink-relax option. */
#ifndef USED_FOR_TARGET
#undef HAVE_AS_AVR_MLINK_RELAX_OPTION
#endif
/* Define if your avr 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
......
......@@ -21,6 +21,8 @@
#include <stdio.h>
#include <string.h>
#include "config.h"
#define IN_GEN_AVR_MMCU_TEXI
#include "avr-devices.c"
......@@ -155,11 +157,15 @@ print_mcu (const avr_mcu_t *mcu)
fprintf (f, "*asm_arch:\n\t-mmcu=%s\n\n", arch->name);
#ifdef HAVE_AS_AVR_MLINK_RELAX_OPTION
fprintf (f, "*asm_relax:\n\t%s\n\n", ASM_RELAX_SPEC);
#endif // have as --mlink-relax
#ifdef HAVE_AS_AVR_MRMW_OPTION
fprintf (f, "*asm_rmw:\n%s\n\n", rmw
? "\t%{!mno-rmw: -mrmw}"
: "\t%{mrmw}");
#endif // have as -mrmw
fprintf (f, "*asm_errata_skip:\n%s\n\n", errata_skip
? "\t%{mno-skip-bug}"
......
......@@ -24185,6 +24185,70 @@ $as_echo "#define HAVE_AS_JSRDIRECT_RELOCS 1" >>confdefs.h
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) 2>&5
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) 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
;;
cris-*-*)
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for -no-mul-bug-abort option" >&5
$as_echo_n "checking assembler for -no-mul-bug-abort option... " >&6; }
......
......@@ -3623,6 +3623,18 @@ AS_HELP_STRING([--disable-fix-cortex-a53-835769],
[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 avr 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 avr assembler supports -mrmw option.])])
;;
cris-*-*)
gcc_GAS_CHECK_FEATURE([-no-mul-bug-abort option],
gcc_cv_as_cris_no_mul_bug,[2,15,91],
......
......@@ -571,8 +571,8 @@ Objective-C and Objective-C++ Dialects}.
@emph{AVR Options}
@gccoptlist{-mmcu=@var{mcu} -maccumulate-args -mbranch-cost=@var{cost} @gol
-mcall-prologues -mint8 -mno-interrupts -mrelax @gol
-mstrict-X -mtiny-stack -Waddr-space-convert}
-mcall-prologues -mint8 -mn_flash=@var{size} -mno-interrupts @gol
-mrelax -mrmw -mstrict-X -mtiny-stack -Waddr-space-convert}
@emph{Blackfin Options}
@gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} @gol
......@@ -13509,6 +13509,11 @@ and @code{long long} is 4 bytes. Please note that this option does not
conform to the C standards, but it results in smaller code
size.
@item -mn-flash=@var{num}
@opindex mn-flash
Assume that the flash memory has a size of
@var{num} times 64@tie{}KiB.
@item -mno-interrupts
@opindex mno-interrupts
Generated code is not compatible with hardware interrupts.
......@@ -13518,8 +13523,9 @@ Code size is smaller.
@opindex mrelax
Try to replace @code{CALL} resp.@: @code{JMP} instruction by the shorter
@code{RCALL} resp.@: @code{RJMP} instruction if applicable.
Setting @option{-mrelax} just adds the @option{--relax} option to the
linker command line when the linker is called.
Setting @option{-mrelax} just adds the @option{--mlink-relax} option to
the assembler's command line and the @option{--relax} option to the
linker's command line.
Jump relaxing is performed by the linker because jump offsets are not
known before code is located. Therefore, the assembler code generated by the
......@@ -13529,6 +13535,11 @@ differ from instructions in the assembler code.
Relaxing must be turned on if linker stubs are needed, see the
section on @code{EIND} and linker stubs below.
@item -mrmw
@opindex mrmw
Assume that the device supports the Read-Modify-Write
instructions @code{XCH}, @code{LAC}, @code{LAS} and @code{LAT}.
@item -msp8
@opindex msp8
Treat the stack pointer register as an 8-bit register,
......@@ -13769,13 +13780,18 @@ architecture and depends on the @option{-mmcu=@var{mcu}} option.
Possible values are:
@code{2}, @code{25}, @code{3}, @code{31}, @code{35},
@code{4}, @code{5}, @code{51}, @code{6}, @code{102}, @code{104},
@code{4}, @code{5}, @code{51}, @code{6}
for @var{mcu}=@code{avr2}, @code{avr25}, @code{avr3}, @code{avr31},
@code{avr35}, @code{avr4}, @code{avr5}, @code{avr51}, @code{avr6},
respectively and
@code{100}, @code{102}, @code{104},
@code{105}, @code{106}, @code{107}
for @var{mcu}=@code{avr2}, @code{avr25}, @code{avr3},
@code{avr31}, @code{avr35}, @code{avr4}, @code{avr5}, @code{avr51},
@code{avr6}, @code{avrxmega2}, @code{avrxmega4}, @code{avrxmega5},
@code{avrxmega6}, @code{avrxmega7}, respectively.
for @var{mcu}=@code{avrtiny}, @code{avrxmega2}, @code{avrxmega4},
@code{avrxmega5}, @code{avrxmega6}, @code{avrxmega7}, respectively.
If @var{mcu} specifies a device, this built-in macro is set
accordingly. For example, with @option{-mmcu=atmega8} the macro is
defined to @code{4}.
......@@ -13795,7 +13811,7 @@ the device name as from the AVR user manual. The difference between
If @var{device} is not a device but only a core architecture like
@samp{avr51}, this macro is not defined.
@item __AVR_DEVICE_NAME__
@item __AVR_DEVICE_NAME__
Setting @option{-mmcu=@var{device}} defines this built-in macro to
the device's name. For example, with @option{-mmcu=atmega8} the macro
is defined to @code{atmega8}.
......
2015-03-11 Georg-Johann Lay <avr@gjlay.de>
PR target/65296
* gcc.target/avr/tiny-memx: Use -mmcu instead of -march.
* gcc.target/avr/tiny-caller-save.c: Same.
2015-03-11 Michael Meissner <meissner@linux.vnet.ibm.com>
PR target/65242
......
/* { dg-do compile } */
/* { dg-options "-march=avrtiny -gdwarf -Os" } */
/* { dg-options "-mmcu=avrtiny -gdwarf -Os" } */
/* This is a stripped down piece of libgcc2.c that triggerd an ICE for avr with
"-march=avrtiny -g -Os"; replace_reg_with_saved_mem would generate:
"-mmcu=avrtiny -g -Os"; replace_reg_with_saved_mem would generate:
(concatn:SI [
(reg:SI 18 r18)
(reg:SI 19 r19)
......
/* { dg-do compile } */
/* { dg-options "-march=avrtiny" } */
/* { dg-options "-mmcu=avrtiny" } */
const __memx char ascmonth[] = "Jan"; /* { dg-error "not supported" } */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment