From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 116690 invoked by alias); 19 Sep 2016 09:12:53 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 116669 invoked by uid 89); 19 Sep 2016 09:12:52 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-5.0 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 spammy=terry, H*UA:38.2.0, H*u:38.2.0, subs X-HELO: foss.arm.com Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 19 Sep 2016 09:12:42 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 4B6A1F0; Mon, 19 Sep 2016 02:12:40 -0700 (PDT) Received: from [10.2.206.234] (e107157-lin.cambridge.arm.com [10.2.206.234]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id CFCA43F251; Mon, 19 Sep 2016 02:12:39 -0700 (PDT) Subject: Re: [PATCHv2, PING 4][ARM] -mpure-code option for ARM To: gcc-patches@gcc.gnu.org References: <57752D6E.9070006@arm.com> <47c8a674-3af0-afff-776b-9d71c0d1bb46@st.com> <5783CFD1.2070500@arm.com> <5795EF77.5060204@arm.com> <57AC87F6.9030808@arm.com> <57C53D46.4000306@arm.com> Cc: Richard Earnshaw From: "Andre Vieira (lists)" Message-ID: <57DFAC06.8020606@arm.com> Date: Mon, 19 Sep 2016 09:25:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: <57C53D46.4000306@arm.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2016-09/txt/msg01150.txt.bz2 On 30/08/16 09:01, Andre Vieira (lists) wrote: > On 11/08/16 15:13, Andre Vieira (lists) wrote: >> On 25/07/16 11:52, Andre Vieira (lists) wrote: >>> On 11/07/16 17:56, Andre Vieira (lists) wrote: >>>> On 07/07/16 13:30, mickael guene wrote: >>>>> Hi Andre, >>>>> >>>>> Another feedback on your purecode patch. >>>>> You have to disable casesi pattern since then it will >>>>> generate wrong code with -mpure-code option. >>>>> Indeed it will generate an 'adr rx, .Lx' (aka >>>>> 'subs rx, PC, #offset') which will not work in our >>>>> case since 'Lx' label is put in an .rodata section. >>>>> So offset value is unknown and can be impossible >>>>> to encode correctly. >>>>> >>>>> Regards >>>>> Mickael >>>>> >>>>> On 06/30/2016 04:32 PM, Andre Vieira (lists) wrote: >>>>>> Hello, >>>>>> >>>>>> This patch adds the -mpure-code option for ARM. This option ensures >>>>>> functions are put into sections that contain only code and no data. To >>>>>> ensure this throughout compilation we give these sections the ARM >>>>>> processor-specific ELF section attribute "SHF_ARM_PURECODE". This option >>>>>> is only supported for non-pic code for armv7-m targets. >>>>>> >>>>>> This patch introduces a new target hook 'TARGET_ASM_ELF_FLAGS_NUMERIC'. >>>>>> This target hook enables a target to use the numeric value for elf >>>>>> section attributes rather than their alphabetical representation. If >>>>>> TARGET_ASM_ELF_FLAGS_NUMERIC returns TRUE, the existing >>>>>> 'default_elf_asm_named_section', will print the numeric value of the >>>>>> section attributes for the current section. This target hook has two >>>>>> parameters: >>>>>> unsigned int FLAGS, the input parameter that tells the function the >>>>>> current section's attributes; >>>>>> unsigned int *NUM, used to pass down the numerical representation of the >>>>>> section's attributes. >>>>>> >>>>>> The default implementation for TARGET_ASM_ELF_FLAGS_NUMERIC will return >>>>>> false, so existing behavior is not changed. >>>>>> >>>>>> Bootstrapped and tested for arm-none-linux-gnueabihf. Further tested for >>>>>> arm-none-eabi with a Cortex-M3 target. >>>>>> >>>>>> >>>>>> gcc/ChangeLog: >>>>>> 2016-06-30 Andre Vieira >>>>>> Terry Guo >>>>>> >>>>>> * target.def (elf_flags_numeric): New target hook. >>>>>> * targhooks.h (default_asm_elf_flags_numeric): New. >>>>>> * varasm.c (default_asm_elf_flags_numeric): New. >>>>>> (default_elf_asm_named_section): Use new target hook. >>>>>> * config/arm/arm.opt (mpure-code): New. >>>>>> * config/arm/arm.h (SECTION_ARM_PURECODE): New. >>>>>> * config/arm/arm.c (arm_asm_init_sections): Add section >>>>>> attribute to default text section if -mpure-code. >>>>>> (arm_option_check_internal): Diagnose use of option with >>>>>> non supported targets and/or options. >>>>>> (arm_asm_elf_flags_numeric): New. >>>>>> (arm_function_section): New. >>>>>> (arm_elf_section_type_flags): New. >>>>>> * config/arm/elf.h (JUMP_TABLES_IN_TEXT_SECTION): Disable >>>>>> for -mpure-code. >>>>>> * gcc/doc/texi (TARGET_ASM_ELF_FLAGS_NUMERIC): New. >>>>>> * gcc/doc/texi.in (TARGET_ASM_ELF_FLAGS_NUMERIC): Likewise. >>>>>> >>>>>> >>>>>> >>>>>> gcc/testsuite/ChangeLog: >>>>>> 2016-06-30 Andre Vieira >>>>>> Terry Guo >>>>>> >>>>>> * gcc.target/arm/pure-code/ffunction-sections.c: New. >>>>>> * gcc.target/arm/pure-code/no-literal-pool.c: New. >>>>>> * gcc.target/arm/pure-code/pure-code.exp: New. >>>>>> >>>>> >>>> Hi Sandra, Mickael, >>>> >>>> Thank you for your comments. I changed the description of -mpure-code in >>>> invoke.texi to better reflect the error message you get wrt supported >>>> targets. >>>> >>>> As for the target hook description, I hope the text is clearer now. Let >>>> me know if you think it needs further explanation. >>>> >>>> I also fixed the double '%' in the text string for unnamed text sections >>>> and disabled the casesi pattern. >>>> >>>> I duplicated the original casesi test >>>> 'gcc/testsuite/gcc.c-torture/compile/pr46934.c' for pure-code to make >>>> sure the casesi was disabled and other patterns were selected instead. >>>> >>>> Reran regressions for pure-code.exp for Cortex-M3. >>>> >>>> Cheers, >>>> Andre >>>> >>>> >>>> gcc/ChangeLog: >>>> 2016-07-11 Andre Vieira >>>> Terry Guo >>>> >>>> * target.def (elf_flags_numeric): New target hook. >>>> * hooks.c (hook_uint_uintp_false): New generic hook. >>>> * varasm.c (default_elf_asm_named_section): Use new target hook. >>>> * config/arm/arm.opt (mpure-code): New. >>>> * config/arm/arm.h (SECTION_ARM_PURECODE): New. >>>> * config/arm/arm.c (arm_asm_init_sections): Add section >>>> attribute to default text section if -mpure-code. >>>> (arm_option_check_internal): Diagnose use of option with >>>> non supported targets and/or options. >>>> (arm_asm_elf_flags_numeric): New. >>>> (arm_function_section): New. >>>> (arm_elf_section_type_flags): New. >>>> * config/arm/elf.h (JUMP_TABLES_IN_TEXT_SECTION): Disable >>>> for -mpure-code. >>>> * config/arm/arm.md (casesi): Disable pattern for >>>> -mpure-code. >>>> * gcc/doc/texi (TARGET_ASM_ELF_FLAGS_NUMERIC): New. >>>> * gcc/doc/texi.in (TARGET_ASM_ELF_FLAGS_NUMERIC): Likewise. >>>> >>>> >>>> >>>> gcc/testsuite/ChangeLog: >>>> 2016-07-11 Andre Vieira >>>> Terry Guo >>>> >>>> * gcc.target/arm/pure-code/ffunction-sections.c: New. >>>> * gcc.target/arm/pure-code/no-literal-pool.c: New. >>>> * gcc.target/arm/pure-code/no-casesi.c: New. >>>> * gcc.target/arm/pure-code/pure-code.exp: New. >>>> >>> Ping. >>> >> Ping >> > > Ping > Ping