]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Graceful degrade if Binutils PR21472 is not available.
authorGeorg-Johann Lay <avr@gjlay.de>
Wed, 5 Jul 2017 13:57:28 +0000 (13:57 +0000)
committerGeorg-Johann Lay <gjl@gcc.gnu.org>
Wed, 5 Jul 2017 13:57:28 +0000 (13:57 +0000)
gcc/
Graceful degrade if Binutils PR21472 is not available.
PR target/81072
* configure.ac [target=avr]: WARN instead of ERROR if avrxmega3
.rodata in flash test fails.
(HAVE_LD_AVR_AVRXMEGA3_RODATA_IN_FLASH): Define it if test passes.
* confgure: Regenerate.
* config.in: Regenerate.
* config/avr/avr.c (avr_asm_named_section)
[HAVE_LD_AVR_AVRXMEGA3_RODATA_IN_FLASH]: Only trigger
__do_copy_data for stuff in .rodata if flash_pm_offset = 0.
(avr_asm_init_sections): Same.

From-SVN: r250000

gcc/ChangeLog
gcc/config.in
gcc/config/avr/avr.c
gcc/configure
gcc/configure.ac

index c566a3a6cf935720535fd7cb6c30fa862e0d57fa..5e1eecde4488fcfb02951338c420fb43e741a9ff 100644 (file)
@@ -1,3 +1,18 @@
+2017-07-05  Georg-Johann Lay  <avr@gjlay.de>
+
+       Graceful degrade if Binutils PR21472 is not available.
+
+       PR target/81072
+       * configure.ac [target=avr]: WARN instead of ERROR if avrxmega3
+       .rodata in flash test fails.
+       (HAVE_LD_AVR_AVRXMEGA3_RODATA_IN_FLASH): Define it if test passes.
+       * confgure: Regenerate.
+       * config.in: Regenerate.
+       * config/avr/avr.c (avr_asm_named_section)
+       [HAVE_LD_AVR_AVRXMEGA3_RODATA_IN_FLASH]: Only trigger
+       __do_copy_data for stuff in .rodata if flash_pm_offset = 0.
+       (avr_asm_init_sections): Same.
+
 2017-07-05  Ramana Radhakrishnan  <ramana.radhakrishnan@arm.com>
 
        * config/arm/neon.md (fma<VCVTF:mode>4): Remove %?.
index bf2aa7b2e7d81a593b72a8d0359864773754ef5d..44c7a68eaa8f8a1bb376450a3c852d60df69a71d 100644 (file)
 #endif
 
 
+/* Define if your default avr linker script for avrxmega3 leaves .rodata in
+   flash. */
+#ifndef USED_FOR_TARGET
+#undef HAVE_LD_AVR_AVRXMEGA3_RODATA_IN_FLASH
+#endif
+
+
 /* Define if your linker supports -z bndplt */
 #ifndef USED_FOR_TARGET
 #undef HAVE_LD_BNDPLT_SUPPORT
index 030a9d9ee97606deb01bead9cd5d289318890b30..ba35b9e15424f39475dafe273254f9dff213e597 100644 (file)
@@ -10000,7 +10000,9 @@ avr_asm_init_sections (void)
      resp. `avr_need_copy_data_p'.  If flash is not mapped to RAM then
      we have also to track .rodata because it is located in RAM then.  */
 
+#if defined HAVE_LD_AVR_AVRXMEGA3_RODATA_IN_FLASH
   if (0 == avr_arch->flash_pm_offset)
+#endif
     readonly_data_section->unnamed.callback = avr_output_data_section_asm_op;
   data_section->unnamed.callback = avr_output_data_section_asm_op;
   bss_section->unnamed.callback = avr_output_bss_section_asm_op;
@@ -10036,7 +10038,10 @@ avr_asm_named_section (const char *name, unsigned int flags, tree decl)
                             || STR_PREFIX_P (name, ".gnu.linkonce.d"));
 
   if (!avr_need_copy_data_p
-      && 0 == avr_arch->flash_pm_offset)
+#if defined HAVE_LD_AVR_AVRXMEGA3_RODATA_IN_FLASH
+      && 0 == avr_arch->flash_pm_offset
+#endif
+      )
     avr_need_copy_data_p = (STR_PREFIX_P (name, ".rodata")
                             || STR_PREFIX_P (name, ".gnu.linkonce.r"));
 
index 317517c1ab0247c7d546bb5b1f1a01987f935005..4c5900fc1ba45ff75cc4f8732564c36aa8d20dbe 100755 (executable)
@@ -24851,29 +24851,32 @@ EOF
   ac_status=$?
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; }; }
-    if test -f conftest.nm
+    if test -s conftest.nm
     then
        if grep ' R xxvaryy' conftest.nm > /dev/null; then
            { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
-           rm -f conftest.s conftest.o conftest.elf conftest.nm
+
+$as_echo "#define HAVE_LD_AVR_AVRXMEGA3_RODATA_IN_FLASH 1" >>confdefs.h
+
        else
            { $as_echo "$as_me:${as_lineno-$LINENO}: result: no: avrxmega3 .rodata located in RAM" >&5
 $as_echo "no: avrxmega3 .rodata located in RAM" >&6; }
            echo "$as_me: nm output was" >&5
            cat conftest.nm >&5
-           rm -f conftest.s conftest.o conftest.elf conftest.nm
            avr_ld_ver="`$gcc_cv_ld -v | sed -e 's:^.* ::'`"
-           as_fn_error "support for avrxmega3 needs Binutils 2.29 or higher (have $avr_ld_ver)" "$LINENO" 5
+           { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: support for avrxmega3 .rodata in flash needs Binutils 2.29 or higher (have $avr_ld_ver)" >&5
+$as_echo "$as_me: WARNING: support for avrxmega3 .rodata in flash needs Binutils 2.29 or higher (have $avr_ld_ver)" >&2;}
        fi
     else
        { $as_echo "$as_me:${as_lineno-$LINENO}: result: test failed" >&5
 $as_echo "test failed" >&6; }
        echo "$as_me: failed program was" >&5
        cat conftest.s >&5
-       rm -f conftest.s conftest.o conftest.elf
-       as_fn_error "see \`config.log' for details" "$LINENO" 5
+       { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: see \`config.log' for details" >&5
+$as_echo "$as_me: WARNING: see \`config.log' for details" >&2;}
     fi
+    rm -f conftest.s conftest.o conftest.elf conftest.nm
     ;;
 
   cris-*-*)
index e1b03a9ac96a4363407a4a82feaaffceea1e055c..f50223a70bae9c2e3add95accb1665cdea46009d 100644 (file)
@@ -3832,26 +3832,26 @@ EOF
     AC_TRY_COMMAND([$gcc_cv_as -mmcu=avrxmega3 conftest.s -o conftest.o])
     AC_TRY_COMMAND([$gcc_cv_ld -mavrxmega3 conftest.o -o conftest.elf])
     AC_TRY_COMMAND([$gcc_cv_nm conftest.elf > conftest.nm])
-    if test -f conftest.nm
+    if test -s conftest.nm
     then
        if grep ' R xxvaryy' conftest.nm > /dev/null; then
            AC_MSG_RESULT(yes)
-           rm -f conftest.s conftest.o conftest.elf conftest.nm
+           AC_DEFINE(HAVE_LD_AVR_AVRXMEGA3_RODATA_IN_FLASH, 1,
+               [Define if your default avr linker script for avrxmega3 leaves .rodata in flash.])
        else
            AC_MSG_RESULT(no: avrxmega3 .rodata located in RAM)
            echo "$as_me: nm output was" >&AS_MESSAGE_LOG_FD
            cat conftest.nm >&AS_MESSAGE_LOG_FD
-           rm -f conftest.s conftest.o conftest.elf conftest.nm
            avr_ld_ver="`$gcc_cv_ld -v | sed -e 's:^.* ::'`"
-           AC_MSG_ERROR([[support for avrxmega3 needs Binutils 2.29 or higher (have $avr_ld_ver)]])
+           AC_MSG_WARN([[support for avrxmega3 .rodata in flash needs Binutils 2.29 or higher (have $avr_ld_ver)]])
        fi
     else
        AC_MSG_RESULT(test failed)
        echo "$as_me: failed program was" >&AS_MESSAGE_LOG_FD
        cat conftest.s >&AS_MESSAGE_LOG_FD
-       rm -f conftest.s conftest.o conftest.elf
-       AC_MSG_ERROR([[see `config.log' for details]])
+       AC_MSG_WARN([[see `config.log' for details]])
     fi
+    rm -f conftest.s conftest.o conftest.elf conftest.nm
     ;;
 
   cris-*-*)