On Tue, 26 Mar 2024 at 22:01, Glenn Griffin <ggriffin...@gmail.com> wrote:
>
> Prior to this change the alignment of the SEC module would be 4 bytes.
> This is inconsistent with the expectations of the compiler and can lead
> to unexpected behavior.
>
> For example a modern version of clang with size optimizations enabled
> (-Oz) can break the ALIGN_POINTER macro in the SEC module.
>

...
>
> However by mapping the data section that contains mArray onto a
> 4-byte-aligned base address we violate the compiler's expectations. The
> last 4 bits of the mArray address are no longer zeroes leading to an
> ALIGN_POINTER macro that doesn't work.
>
> Cc: Ard Biesheuvel <ardb+tianoc...@kernel.org>
>
> Signed-off-by: Glenn Griffin <ggriffin...@gmail.com>
> ---
>  OvmfPkg/OvmfPkgX64.fdf | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/OvmfPkg/OvmfPkgX64.fdf b/OvmfPkg/OvmfPkgX64.fdf
> index eb3fb90cb8b6..8b60355de40b 100644
> --- a/OvmfPkg/OvmfPkgX64.fdf
> +++ b/OvmfPkg/OvmfPkgX64.fdf
> @@ -434,7 +434,7 @@ [FV.FVMAIN_COMPACT]
>
>  [Rule.Common.SEC]
>    FILE SEC = $(NAMED_GUID) {
> -    PE32     PE32           $(INF_OUTPUT)/$(MODULE_NAME).efi
> +    PE32     PE32   Align=Auto    $(INF_OUTPUT)/$(MODULE_NAME).efi
>      UI       STRING ="$(MODULE_NAME)" Optional
>      VERSION  STRING ="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
>    }

Thanks Glenn. As you have mentioned to me off-list, this is the same
issue Andrew reported here

Link: https://bugzilla.tianocore.org/show_bug.cgi?id=3887

Your fix is obviously correct, and I intend to merge it unless anyone
has any concerns with this.


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#117140): https://edk2.groups.io/g/devel/message/117140
Mute This Topic: https://groups.io/mt/105165329/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to