Re: [PATCH 1/5] efi/arm: Remove __efistub_global annotation
From: Ard Biesheuvel
Date: Thu Apr 16 2020 - 03:50:58 EST
On Thu, 16 Apr 2020 at 00:15, Arvind Sankar <nivedita@xxxxxxxxxxxx> wrote:
>
> Instead of using __efistub_global to force variables into the .data
> section, leave them in the .bss but pull the EFI stub's .bss section
> into .data in the linker script for the compressed kernel.
>
> Signed-off-by: Arvind Sankar <nivedita@xxxxxxxxxxxx>
Reviewed-by: Ard Biesheuvel <ardb@xxxxxxxxxx>
> ---
> arch/arm/boot/compressed/vmlinux.lds.S | 2 +-
> drivers/firmware/efi/libstub/Makefile | 7 ++++---
> drivers/firmware/efi/libstub/efistub.h | 2 +-
> 3 files changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/arch/arm/boot/compressed/vmlinux.lds.S b/arch/arm/boot/compressed/vmlinux.lds.S
> index b247f399de71..b6793c7932a9 100644
> --- a/arch/arm/boot/compressed/vmlinux.lds.S
> +++ b/arch/arm/boot/compressed/vmlinux.lds.S
> @@ -78,7 +78,7 @@ SECTIONS
> * The EFI stub always executes from RAM, and runs strictly before the
> * decompressor, so we can make an exception for its r/w data, and keep it
> */
> - *(.data.efistub)
> + *(.data.efistub .bss.efistub)
> __pecoff_data_end = .;
>
> /*
> diff --git a/drivers/firmware/efi/libstub/Makefile b/drivers/firmware/efi/libstub/Makefile
> index 094eabdecfe6..45ffe0822df1 100644
> --- a/drivers/firmware/efi/libstub/Makefile
> +++ b/drivers/firmware/efi/libstub/Makefile
> @@ -100,8 +100,9 @@ quiet_cmd_stubcopy = STUBCPY $@
>
> #
> # ARM discards the .data section because it disallows r/w data in the
> -# decompressor. So move our .data to .data.efistub, which is preserved
> -# explicitly by the decompressor linker script.
> +# decompressor. So move our .data to .data.efistub and .bss to .bss.efistub,
> +# which are preserved explicitly by the decompressor linker script.
> #
> -STUBCOPY_FLAGS-$(CONFIG_ARM) += --rename-section .data=.data.efistub
> +STUBCOPY_FLAGS-$(CONFIG_ARM) += --rename-section .data=.data.efistub \
> + --rename-section .bss=.bss.efistub,load,alloc
> STUBCOPY_RELOC-$(CONFIG_ARM) := R_ARM_ABS
> diff --git a/drivers/firmware/efi/libstub/efistub.h b/drivers/firmware/efi/libstub/efistub.h
> index bd0b86b63936..a92d42ffd9f7 100644
> --- a/drivers/firmware/efi/libstub/efistub.h
> +++ b/drivers/firmware/efi/libstub/efistub.h
> @@ -25,7 +25,7 @@
> #define EFI_ALLOC_ALIGN EFI_PAGE_SIZE
> #endif
>
> -#if defined(CONFIG_ARM) || defined(CONFIG_X86)
> +#if defined(CONFIG_X86)
> #define __efistub_global __section(.data)
> #else
> #define __efistub_global
> --
> 2.24.1
>