Message ID | 1473787620-26953-1-git-send-email-ard.biesheuvel@linaro.org |
---|---|
State | Accepted |
Commit | 493b40451d4f841c14f9ee35da1492084baa8d9b |
Headers | show |
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. _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
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 ; \ Name: #define ASM_FUNC(Name) _ASM_FUNC(ASM_PFX(Name), .text. ## Name)
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(+) -- 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel