public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Bernd Schmidt <bschmidt@redhat.com>
To: Christian Bruel <christian.bruel@st.com>,
	       "law@redhat.com" <law@redhat.com>
Cc: "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>,
	       "Ramana.Radhakrishnan@arm.com"
	<Ramana.Radhakrishnan@arm.com>,
	       "kyrylo.tkachov@arm.com" <kyrylo.tkachov@arm.com>,
	       "richard.earnshaw@arm.com" <richard.earnshaw@arm.com>
Subject: Re: [PATCH ARM]: PR67745: Fix function alignment after __attribute__ 2/2
Date: Wed, 07 Oct 2015 17:37:00 -0000	[thread overview]
Message-ID: <56155841.6000404@redhat.com> (raw)
In-Reply-To: <5614F7D0.8010409@st.com>

On 10/07/2015 12:45 PM, Christian Bruel wrote:
>
>
> On 10/07/2015 12:18 PM, Bernd Schmidt wrote:
>> On 10/07/2015 09:04 AM, Christian Bruel wrote:
>>> +      /* 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;
>>>        }
>>
>> That's a very odd-looking condition. Why the vbit location test?
>
> This is for member functions to make sure that the lsb address is
> reserved for the virtual function bit.
>
> see cp/decl.c:
>
>    /* If pointers to member functions use the least significant bit to
>       indicate whether a function is virtual, ensure a pointer
>       to this function will have that bit clear.  */
>    if (TARGET_PTRMEMFUNC_VBIT_LOCATION == ptrmemfunc_vbit_in_pfn
>        && TREE_CODE (type) == METHOD_TYPE
>        && DECL_ALIGN (decl) < 2 * BITS_PER_UNIT)
>      DECL_ALIGN (decl) = 2 * BITS_PER_UNIT;
>
> This happens for instance on i386 that aligns member functions on 2
> bytes, bigger than the one byte required boundary. So we cannot
> re-layout bellow that.

Hmm, at least that would need to be spelled out in a comment, but I 
think this would better be abstracted as

#define MINIMUM_FUNCTION_BOUNDARY(FN) \
  ....
in a header file, and used in both places.


Bernd

  reply	other threads:[~2015-10-07 17:37 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-29 13:44 Christian Bruel
2015-09-29 13:59 ` Christian Bruel
2015-09-30 19:30 ` Jeff Law
2015-10-01  7:12   ` Christian Bruel
2015-10-01 16:11     ` Christian Bruel
2015-10-07  7:05       ` Christian Bruel
2015-10-07 10:18         ` Bernd Schmidt
2015-10-07 10:45           ` Christian Bruel
2015-10-07 17:37             ` Bernd Schmidt [this message]
2015-10-07 17:50               ` Bernd Schmidt
2015-10-08 13:14                 ` Christian Bruel
2015-10-08 13:20                   ` Bernd Schmidt
2015-10-08 13:51                     ` Christian Bruel
2015-10-08 14:30                       ` Bernd Schmidt
2015-10-12 10:56                         ` Christian Bruel
2015-10-12 11:19                           ` Bernd Schmidt
2015-10-12 11:26                             ` Christian Bruel
2015-10-16  8:03                             ` refactoring TARGET_PTRMEMFUNC_VBIT_LOCATION checks Christian Bruel
2015-10-16  9:47                               ` Bernd Schmidt
2015-10-16 10:50                                 ` Christian Bruel
2015-10-16 10:56                                   ` Bernd Schmidt
2015-10-16 10:56                                   ` Christian Bruel
2015-10-13  8:03                           ` [PATCH ARM]: PR67745: Fix function alignment after __attribute__ 2/2 Ramana Radhakrishnan
2015-10-13 10:18                             ` Christian Bruel
2015-10-16 14:18                             ` Christian Bruel
2015-10-08 14:01               ` Christian Bruel
2015-10-08 14:05                 ` Bernd Schmidt
2015-10-07 17:40         ` Jeff Law

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56155841.6000404@redhat.com \
    --to=bschmidt@redhat.com \
    --cc=Ramana.Radhakrishnan@arm.com \
    --cc=christian.bruel@st.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=kyrylo.tkachov@arm.com \
    --cc=law@redhat.com \
    --cc=richard.earnshaw@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).