From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 121996 invoked by alias); 2 Mar 2015 13:29:08 -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 121985 invoked by uid 89); 2 Mar 2015 13:29:07 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: cam-smtp0.cambridge.arm.com Received: from fw-tnat.cambridge.arm.com (HELO cam-smtp0.cambridge.arm.com) (217.140.96.140) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Mon, 02 Mar 2015 13:29:06 +0000 Received: from arm.com (e106375-lin.cambridge.arm.com [10.2.206.37]) by cam-smtp0.cambridge.arm.com (8.13.8/8.13.8) with ESMTP id t22DSFFg030584; Mon, 2 Mar 2015 13:28:15 GMT Date: Mon, 02 Mar 2015 13:29:00 -0000 From: James Greenhalgh To: Maxim Kuvyrkov Cc: Terry Guo , "gcc-patches@gcc.gnu.org" , Ramana Radhakrishnan , Richard Earnshaw Subject: Re: [PATCH][ARM]Automatically add -mthumb for thumb-only target when mode isn't specified Message-ID: <20150302132814.GA16212@arm.com> References: <000001d0548a$789a1bd0$69ce5370$@arm.com> <0E847550-2947-46C3-991C-2720641BC881@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <0E847550-2947-46C3-991C-2720641BC881@linaro.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes X-SW-Source: 2015-03/txt/msg00059.txt.bz2 On Mon, Mar 02, 2015 at 01:08:13PM +0000, Maxim Kuvyrkov wrote: > > On Mar 2, 2015, at 4:44 AM, Terry Guo wrote: > > > > Hi there, > > > > If target mode isn't specified via either gcc configuration option > > --with-mode or command line, this patch intends to improve gcc driver to > > automatically add option -mthumb for thumb-only target. Tested with gcc > > regression test for various arm targets, no regression. Is it OK? > > > > BR, > > Terry > > > > gcc/ChangeLog: > > > > 2015-03-02 Terry Guo > > > > * common/config/arm/arm-common.c (arm_is_target_thumb_only): New > > function. > > * config/arm/arm-protos.h (FL_ Macros): Move to ... > > * config/arm/arm-opts.h (FL_ Macros): ... here. > > (struct arm_arch_core_flag): New struct. > > (arm_arch_core_flags): New array for arch/core and flag map. > > * config/arm/arm.h (MODE_SET_SPEC_FUNCTIONS): Define new SPEC > > function. > > (EXTRA_SPEC_FUNCTIONS): Include new SPEC function. > > (MODE_SET_SPECS): New SPEC. > > (DRIVER_SELF_SPECS): Include new SPEC. > > Did you consider approach of implementing this purely inside cc1 rather than driver? > > We do not seem to need to pass -mthumb to assembler or linker since those > will pick up ARM-ness / Thumb-ness from function annotations. Therefore we > need to handle -marm / -mthumb for cc1 only. What am I missing? I recently had a similar argument with myself regarding the usefulness of rewriting -mcpu values in the driver before handing them off the assembler (as we do for big.LITTLE systems), we could just rely on the .arch directives in the assembler files. The problem with this argument, and the one you make here, is that it doesn't cover users driving the assembler with a GCC command to assemble hand-rolled files without directives. i.e. gcc foo.s bar.c -mthumb -mcpu=cortex-a57.cortex-a53 Should have the effect when assembling foo.s of enforcing thumb mode, and permitting ARMv8-A instructions, regardless whether foo.s explicitly enables these through directives. Cheers, James