public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
To: Andrew Fish <afish@apple.com>
Cc: edk2-devel-01 <edk2-devel@lists.01.org>,
	Leif Lindholm <leif.lindholm@linaro.org>
Subject: Re: [PATCH 2/2] ArmPkg/AsmMacroIoLib: force word alignment for functions
Date: Tue, 13 Sep 2016 18:49:09 +0100	[thread overview]
Message-ID: <CAKv+Gu-im7iDLVJNrKZbNQff0=3fDSJWP-FgStKEsm7GkZcR+Q@mail.gmail.com> (raw)
In-Reply-To: <D2AF5DC7-0364-4D82-A211-9FB7A606E585@apple.com>

On 13 September 2016 at 18:45, Andrew Fish <afish@apple.com> wrote:
>
>> On Sep 13, 2016, at 10:27 AM, Ard Biesheuvel <ard.biesheuvel@linaro.org> wrote:
>>
>> Without an explicit .align directive, the Clang assembler defaults to
>> no alignment, which may result in instructions appearing misaligned in
>> the final executable. So use word alignment in all cases.
>>
>> Contributed-under: TianoCore Contribution Agreement 1.0
>> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
>> ---
>> ArmPkg/Include/AsmMacroIoLib.h | 1 +
>> 1 file changed, 1 insertion(+)
>>
>> diff --git a/ArmPkg/Include/AsmMacroIoLib.h b/ArmPkg/Include/AsmMacroIoLib.h
>> index fb73ea9a4694..5e4de1f269c8 100644
>> --- a/ArmPkg/Include/AsmMacroIoLib.h
>> +++ b/ArmPkg/Include/AsmMacroIoLib.h
>> @@ -56,6 +56,7 @@
>>   .global   Name                  ; \
>>   .section  #Section, "ax"        ; \
>>   .type     Name, %function       ; \
>> +  .align    2                     ; \
>
> Ard,
>
> I've been burned in the past by as .align is bytes or power of 2 based on what the native assembler defaults to (over simplification). I'm not sure if that issues exists in the ARM world?
>

The GNU assembler for ARM interprets this as power-of-2, and so does
Clang, according to my testing. Both support the .p2align directive as
well, which makes it 100% unambiguous, so I suppose I could use that
instead.

-- 
Ard.


  reply	other threads:[~2016-09-13 17:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-13 17:27 [PATCH 2/2] ArmPkg/AsmMacroIoLib: force word alignment for functions Ard Biesheuvel
2016-09-13 17:45 ` Andrew Fish
2016-09-13 17:49   ` Ard Biesheuvel [this message]
2016-09-13 17:52     ` 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-im7iDLVJNrKZbNQff0=3fDSJWP-FgStKEsm7GkZcR+Q@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