From patchwork Thu Nov 3 07:58:52 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pitchumani Sivanupandi X-Patchwork-Id: 690713 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 3t8cl15t5Rz9svs for ; Thu, 3 Nov 2016 18:57:32 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=L4N4fXiO; 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:to:cc :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=VT1yP3/BHBUs/a3lNtVnUlT/gPlji/CY7zqqNHej/gMr/iCMh0 Wa42ef2BVUtgySMmwnplGMSagT68AfqymMGVpQkpJY9FpKmFySAsXYK8y0GDe3ht +tmNeDpjzgaCt6PAmDhZKnLaxgRQ9B0nfsanb27bWQ/LmQGOlvukpJhLY= 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:to:cc :from:subject:message-id:date:mime-version:content-type; s= default; bh=Fh91mh1qURcrvxoiq1iau2Y43qc=; b=L4N4fXiOcl/BHYS2xDc7 kCgvBhSDL6kzwpeM8/xlUq9QMb4dOKTeGIZOYveaWAlxcuQ48/zHPhvIhhNY9Ee5 fWX9wK3sjljDP44ol/YhuehhOZKtgdGu2Rbqap8rapKVG8c9WRPk78DDVAXcJdSF t4yNw/alaynSSpzVQ+CzEd8= Received: (qmail 129622 invoked by alias); 3 Nov 2016 07:57:25 -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 129565 invoked by uid 89); 3 Nov 2016 07:57:24 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 spammy=sk:pitchum, flash, 2016-11-03 X-HELO: email.microchip.com Received: from exsmtp02.microchip.com (HELO email.microchip.com) (198.175.253.38) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 03 Nov 2016 07:57:14 +0000 Received: from [10.40.233.140] (10.10.76.4) by chn-sv-exch02.mchp-main.com (10.10.76.38) with Microsoft SMTP Server id 14.3.181.6; Thu, 3 Nov 2016 00:57:09 -0700 To: GCC Patches CC: Senthil Kumar Selvaraj - I41766 , Georg-Johann Lay , Denis Chertykov From: Pitchumani Sivanupandi Subject: [patch, avr] Make pmem-wrap-around option as default Message-ID: Date: Thu, 3 Nov 2016 13:28:52 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 Most of the AVR's 8k memorydevices have only rjmp instruction, not jmp. So, it is important to wrap around jump destination to check if it can reach backwards. Currently link specs passes --pmem-wrap-around=xxK when mrelax and mpmem-wrap-around options are enabled. Attached patch changes the specs so that option --pmem-wrap-around=8K is passed for 8k memory devices if -mno-pmem-wrap-around is not enabled. If OK, could someone commit please? Note: Currently 8k devices are identified based on name prefix. We are working on alternative method to incorporate flash memory size. Regards, Pitchumani gcc/ChangeLog 2016-11-03 Pitchumani Sivanupandi * config/avr/gen-avr-mmcu-specs.c (print_mcu): Update link_pmem_wrap spec string to add linker option --pmem-wrap-around=8k. * config/avr/specs.h: Add link_pmem_wrap to linker specs (LINK_SPEC). diff --git a/gcc/config/avr/gen-avr-mmcu-specs.c b/gcc/config/avr/gen-avr-mmcu-specs.c index 7fca756..41dbd80 100644 --- a/gcc/config/avr/gen-avr-mmcu-specs.c +++ b/gcc/config/avr/gen-avr-mmcu-specs.c @@ -220,7 +220,9 @@ print_mcu (const avr_mcu_t *mcu) : 0; fprintf (f, "*link_pmem_wrap:\n"); - if (wrap_k) + if (wrap_k == 8) + fprintf (f, "\t%%{!mno-pmem-wrap-around: --pmem-wrap-around=8k}"); + else if (wrap_k > 8) fprintf (f, "\t%%{mpmem-wrap-around: --pmem-wrap-around=%dk}", wrap_k); fprintf (f, "\n\n"); diff --git a/gcc/config/avr/specs.h b/gcc/config/avr/specs.h index 52763cc..fbf0ce6 100644 --- a/gcc/config/avr/specs.h +++ b/gcc/config/avr/specs.h @@ -65,6 +65,7 @@ along with GCC; see the file COPYING3. If not see "%(link_data_start) " \ "%(link_text_start) " \ "%(link_relax) " \ + "%(link_pmem_wrap) " \ "%{shared:%eshared is not supported} " #undef LIB_SPEC