From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 34516 invoked by alias); 7 Oct 2015 07:05:03 -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 34507 invoked by uid 89); 7 Oct 2015 07:05:02 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.7 required=5.0 tests=AWL,BAYES_05,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 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; Wed, 07 Oct 2015 07:05:01 +0000 Received: from pps.filterd (m0046668.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.14.5/8.14.5) with SMTP id t976rOJo006177; Wed, 7 Oct 2015 09:04:54 +0200 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 1xct0s8xfr-1 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Wed, 07 Oct 2015 09:04:54 +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 7224131; Wed, 7 Oct 2015 07:04:31 +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 7C47B125C; Wed, 7 Oct 2015 07:04:51 +0000 (GMT) Received: from [164.129.122.197] (164.129.122.197) by webmail-eu.st.com (10.75.90.13) with Microsoft SMTP Server (TLS) id 8.3.389.2; Wed, 7 Oct 2015 09:04:50 +0200 From: Christian Bruel Subject: Re: [PATCH ARM]: PR67745: Fix function alignment after __attribute__ 2/2 To: References: <560A90F2.5010708@st.com> <560C31CD.7060009@redhat.com> <560CDCD7.9080108@st.com> <560D5B36.2020600@st.com> CC: , , , X-No-Archive: yes Message-ID: <5614C412.5080400@st.com> Date: Wed, 07 Oct 2015 07:05:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <560D5B36.2020600@st.com> Content-Type: multipart/mixed; boundary="------------050504020707070401030901" X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.14.151,1.0.33,0.0.0000 definitions=2015-10-07_04:2015-10-06,2015-10-07,1970-01-01 signatures=0 X-IsSubscribed: yes X-SW-Source: 2015-10/txt/msg00667.txt.bz2 --------------050504020707070401030901 Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit Content-length: 840 The ARM target can switch different alignment requirements between the thumb or arm, thanks to the attribute ((target)). Using FUNCTION_BOUNDARY that now depends on the switchable target_flag. The previous attempt to fix this was to use the set_current_function hook to reset DECL_ALIGN. On a second thought I found this not satisfactory because this hook is called multiple time between passes, whereas the setting only needs to be done once. Instead, this patch resets the function's DECL_ALIGN in allocate_struct_function, when not enforced by the user or the language, after the attributes are processed. Tested for arm-none-eabi (with the 1/2 part https://gcc.gnu.org/ml/gcc-patches/2015-09/msg02198.html) Bootstraped for x86_64-unknown-linux-gnu and tested (c+,c++,fortran) Comments ? OK for trunk ? thanks Christian --------------050504020707070401030901 Content-Type: text/x-patch; name="align3.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="align3.patch" Content-length: 818 2015-10-07 Christian Bruel PR target/67745 * function.c (allocate_struct_function): Relayout function's alignment. Index: gcc/function.c =================================================================== --- gcc/function.c (revision 228515) +++ gcc/function.c (working copy) @@ -4840,6 +4840,12 @@ allocate_struct_function (tree fndecl, b for (tree parm = DECL_ARGUMENTS (fndecl); parm; parm = DECL_CHAIN (parm)) relayout_decl (parm); + + /* Similarly, relayout function's alignment if not forced. */ + if (!DECL_USER_ALIGN (fndecl) + && (TREE_CODE (fntype) != METHOD_TYPE + || TARGET_PTRMEMFUNC_VBIT_LOCATION != ptrmemfunc_vbit_in_pfn)) + DECL_ALIGN (fndecl) = FUNCTION_BOUNDARY; } if (!abstract_p && aggregate_value_p (result, fndecl)) --------------050504020707070401030901--