From patchwork Wed Jul 5 13:59:54 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Georg-Johann Lay X-Patchwork-Id: 784631 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3x2jDr2vhGz9s7g for ; Thu, 6 Jul 2017 00:00:11 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="EI/DnvOR"; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :subject:to:references:cc:from:message-id:date:mime-version :in-reply-to:content-type; q=dns; s=default; b=L5ywH8ZMHP8QzACgq bmhrcl8D2zG7Q8NVm0UyzvIPBpzCm/2v6/0JTiF8DlrNTsv5ubVqz5JTgsL3aff9 22hUC4iFL2Z2tJB4dIeVCIb1VgQo8dhWrgJUPZl4wdERDuhm/toDiJS15Ek7dKf8 AxWOczgcziCkv5JjQId0Jnn4kQ= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :subject:to:references:cc:from:message-id:date:mime-version :in-reply-to:content-type; s=default; bh=uoXqGQWwNO8UfppJ7c+m3Hj cl+U=; b=EI/DnvORwdbMINL8PaWzc8lXZW/Vmv0gybGKJ0JPHHhpwZxP2dFagN6 shL3fJ8n04ZvSuuIvcvRjku49z4tZVjdHPQhWUrVg9Rn/Fa36oQSKO0HhMq+YKdG Z99IJAglIkcZZ4bmsHfepi8lCdpCb+MIMIA+1qU5/RJ2BQj9BIZU= Received: (qmail 94593 invoked by alias); 5 Jul 2017 14:00:02 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 94531 invoked by uid 89); 5 Jul 2017 14:00:01 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.4 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 spammy= X-HELO: mo4-p00-ob.smtp.rzone.de Received: from mo4-p00-ob.smtp.rzone.de (HELO mo4-p00-ob.smtp.rzone.de) (81.169.146.219) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 05 Jul 2017 13:59:59 +0000 X-RZG-AUTH: :LXoWVUeid/7A29J/hMvvT3ol15ykJcYwR/bcHRirORRW3yMcVao= X-RZG-CLASS-ID: mo00 Received: from [192.168.0.123] (mail.hightec-rt.com [213.135.1.215]) by smtp.strato.de (RZmta 41.1 DYNA|AUTH) with ESMTPSA id 60be82t65DxsBAz (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (curve secp521r1 with 521 ECDH bits, eq. 15360 bits RSA)) (Client did not present a certificate); Wed, 5 Jul 2017 15:59:54 +0200 (CEST) Subject: [patch, avr, committed] Ad PR81072: Be less aggressive when testing for Binutils PR21472. To: gcc-patches , richard.sandiford@linaro.org References: <87inj8oyvx.fsf@linaro.org> <7077f5e5-1229-35c8-ba44-c33b879b7878@gjlay.de> <8f1d1920-029d-3cfe-a136-716745cb7e30@gjlay.de> <87shibjhuo.fsf@linaro.org> Cc: Denis Chertykov From: Georg-Johann Lay Message-ID: <5a581fba-9f33-e7dc-d5c6-7fb9fc2a08e2@gjlay.de> Date: Wed, 5 Jul 2017 15:59:54 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <87shibjhuo.fsf@linaro.org> X-IsSubscribed: yes Well, it's all only avr stuff... and I decided that it's obvious :-) Applied the addendum to PR81072 / trunk r249124 from below. Sorry for the inconvenience. Johann On 05.07.2017 12:30, Richard Sandiford wrote: > Georg-Johann Lay writes: >> On 05.07.2017 10:17, Georg-Johann Lay wrote: >>> On 04.07.2017 20:11, Richard Sandiford wrote: >>>> Georg-Johann Lay writes: >>>>> Hi, >>>>> >>>>> This patch adds support for devices that can access flash memory >>>>> by LD* instructions, hence there is no need to put .rodata in RAM. >>>>> >>>>> The default linker script for the new multilib versions already >>>>> supports this feature, it's similar to avrtiny, cf. >>>>> >>>>> https://sourceware.org/PR21472 >>>>> >>>>> This patch does the following: >>>>> >>>>> * Add multilib variants avrxmega3 and avrxmega3/short-calls. >>>>> >>>>> * Add new option -mshort-calls for multilib selection between >>>>> devices with <= 8KiB flash and > 8KiB flash. >>>>> >>>>> * Add specs handling for -mshort-calls: The compiler knows >>>>> if this option is needed or not appropriate (similar to -msp8). >>>>> >>>>> * Add new ISA feature AVR_ISA_RCALL for multilib selection >>>>> via -mshort-calls. >>>>> >>>>> * Add a new row to architecture description that contains the >>>>> start address of flash memory in the RAM address range. >>>>> (The actual value is not needed). >>>>> >>>>> * For devices with flash in RAM space, don't let .rodata >>>>> objects trigger need for __do_copy_data. >>>>> >>>>> * Add some devices. >>>>> >>>>> * Add configure test for Binutils PR21472. >>>> >>>> Sorry if this has already been discussed, but it's useful to be >>>> able to do things like: >>>> >>>> .../configure --target=avr-elf --with-cpu=arc700 >>>> make -j... all-gcc >>>> >>>> as a basic sanity test of a pan-target patch. (I usually do >>>> before-and-after assembly comparisons too if no changes are >>>> expected.) The way the configure test is written means that >>>> it's no longer possible to do this without first building a >>>> trunk version of binutils for avr-elf. >>>> >>>> Thanks, >>>> Richard >>> >>> Okay, I already thought of a less aggressive approach, I'll >>> try to address it soon. >> >> Is the following addendum in order? >> >> The avr maintainers appear to be offline since several weeks already, >> maybe a global maintainer can have a look and approve it for trunk? > > Thanks for doing this. LGTM (though obviously I can't approve) > > Richard https://gcc.gnu.org/r250000 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. Index: config/avr/avr.c =================================================================== --- config/avr/avr.c (revision 249995) +++ config/avr/avr.c (working copy) @@ -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, || 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: config.in =================================================================== --- config.in (revision 249982) +++ config.in (working copy) @@ -1460,6 +1460,13 @@ that are supported for each access macro #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: configure =================================================================== --- configure (revision 249982) +++ configure (working copy) @@ -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: configure.ac =================================================================== --- configure.ac (revision 249982) +++ configure.ac (working copy) @@ -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-*-*)