From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 128995 invoked by alias); 7 Jul 2016 12:31:04 -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 128976 invoked by uid 89); 7 Jul 2016 12:31:03 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy=our, terry X-HELO: mx07-00178001.pphosted.com Received: from mx07-00178001.pphosted.com (HELO mx07-00178001.pphosted.com) (62.209.51.94) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Thu, 07 Jul 2016 12:30:51 +0000 Received: from pps.filterd (m0046037.ppops.net [127.0.0.1]) by m0046037.ppops.net (8.16.0.11/8.16.0.11) with SMTP id u67CSfaF013392; Thu, 7 Jul 2016 14:30:45 +0200 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by m0046037.ppops.net with ESMTP id 23x3ctkgst-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Thu, 07 Jul 2016 14:30:45 +0200 Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id E0F0834; Thu, 7 Jul 2016 12:30:44 +0000 (GMT) Received: from Webmail-eu.st.com (safex1hubcas4.st.com [10.75.90.69]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id C73C52945; Thu, 7 Jul 2016 12:30:44 +0000 (GMT) Received: from [10.129.186.101] (164.129.122.161) by webmail-eu.st.com (10.75.90.13) with Microsoft SMTP Server (TLS) id 8.3.444.0; Thu, 7 Jul 2016 14:30:44 +0200 Subject: Re: [PATCH][ARM] -mpure-code option for ARM To: "Andre Vieira (lists)" , GCC Patches References: <57752D6E.9070006@arm.com> From: mickael guene Message-ID: <47c8a674-3af0-afff-776b-9d71c0d1bb46@st.com> Date: Thu, 07 Jul 2016 12:31:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.1.0 MIME-Version: 1.0 In-Reply-To: <57752D6E.9070006@arm.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-07-07_08:,, signatures=0 X-IsSubscribed: yes X-SW-Source: 2016-07/txt/msg00306.txt.bz2 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. >