public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
To: Laszlo Ersek <lersek@redhat.com>
Cc: Evan Lloyd <Evan.Lloyd@arm.com>,
	"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>,
	nd <nd@arm.com>,
	 Stephanie Hughes-Fitt <Stephanie.Hughes-Fitt@arm.com>,
	Leif Lindholm <leif.lindholm@linaro.org>
Subject: Re: Query about variable initialization
Date: Wed, 20 Jun 2018 21:01:36 +0200	[thread overview]
Message-ID: <CAKv+Gu-JBNvxjYYNwzx12Kb6HcEU22FLEXq2Yvv7Cqhkt8Yy0Q@mail.gmail.com> (raw)
In-Reply-To: <f273ab53-4064-8ab4-1ec2-f7854aecba80@redhat.com>

On 20 June 2018 at 20:57, Laszlo Ersek <lersek@redhat.com> wrote:
> On 06/20/18 20:03, Ard Biesheuvel wrote:
>> On 20 June 2018 at 19:48, Evan Lloyd <Evan.Lloyd@arm.com> wrote:
>>> Hi Ard, Leif.
>>> I've noticed a number of comments like Ard's recent "We don't permit initialized automatic variables.",
>>> and similar changes have been made to Sami's AcpiView.  Note: I'm not objecting to doing it the way maintainers prefer, which is why this is not a response.
>>>
>>> My understanding was that the CCS was changed some time back to remove the restriction on initializing variables (and I further think I remember Leif being a prime mover in that).
>>
>> I don't remember, to be honest. But I think it is a stupid rule, and
>> so if we haven't already, I hope we can get rid of it.
>>
>> IIRC, this limitation had something to do with a particularly nice
>> exhibit in the Tianocore toolchain museum that generated bigger
>> binaries for initialized automatic variables (as compared to
>> assignments performed separately). But let's not get into the
>> toolchain situation, shall we?
>
> One special case of initialization is when the variable in question has
> structure type. For such initialization the compiler may generate calls
> to internal helper functions (memset and friends), and then the module
> fails to link. I've seen this myself earlier, although I can't tell
> whether on gcc-4.4 or gcc-4.8.
>

That is a very good point. Note that this does not affect ARM, given
that we already have to provide the AEABI intrinsics (and memset and
memcpy for GCC), but I can see how other architectures may be bitten
by this.

I suppose the compiler is free to apply the same optimization to a
block of automatic POD type variables, although I'd be surprised if
that ever occurs in practice.


  reply	other threads:[~2018-06-20 19:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-20 17:48 Query about variable initialization Evan Lloyd
2018-06-20 18:03 ` Ard Biesheuvel
2018-06-20 18:57   ` Laszlo Ersek
2018-06-20 19:01     ` Ard Biesheuvel [this message]
2018-06-20 19:22       ` Andrew Fish

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-list 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=CAKv+Gu-JBNvxjYYNwzx12Kb6HcEU22FLEXq2Yvv7Cqhkt8Yy0Q@mail.gmail.com \
    --to=devel@edk2.groups.io \
    /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