[PATCH 01/11] sandbox: Set the EFI symbols in linker script

Heinrich Schuchardt xypron.glpk at gmx.de
Tue Apr 12 00:15:15 CEST 2022


On 4/7/22 11:41, Andrew Scull wrote:
> The sandbox doesn't populate the EFI lists so explicitly set the list
> start and end symbols to indicate that the lists are empty. This
> simplifies the linker scripts, removed references to non-existant
> sections and removes '.' prefixed sections that conflicted with clang's
> ASAN.


In u-boot.map I see:

10636  .text.efi_runtime
10637                 0x00000000000df50a      0x72d
/tmp/cctuEBRS.ltrans19.ltrans.o
10638                 0x00000000000df50a                efi_get_time
10639                 0x00000000000df519                efi_set_time
10640                 0x00000000000df528
efi_unimplemented.lto_priv.0
10641                 0x00000000000df54a
efi_update_capsule_unsupported
10642                 0x00000000000df559
efi_query_capsule_caps_unsupported

So there are definively functions that should go between
__efi_runtime_start and __efi_runtime_stop.

If ._efi_runtime_start == .__efi_runtime_stop, there is a bug in the
linker script. Deleting the symbols is the wrong way to deal with this
deficiency. Instead ensure correct placement of the functions marked as
__efi_runtime and the data marked as __efi_runtime_data.

Best regards

Heinrich

>
> Signed-off-by: Andrew Scull <ascull at google.com>
> ---
>   arch/sandbox/cpu/u-boot.lds | 32 +++++---------------------------
>   arch/sandbox/lib/Makefile   |  2 +-
>   arch/sandbox/lib/sections.c | 13 -------------
>   3 files changed, 6 insertions(+), 41 deletions(-)
>   delete mode 100644 arch/sandbox/lib/sections.c
>
> diff --git a/arch/sandbox/cpu/u-boot.lds b/arch/sandbox/cpu/u-boot.lds
> index 6d710618f5..dd675cc3d2 100644
> --- a/arch/sandbox/cpu/u-boot.lds
> +++ b/arch/sandbox/cpu/u-boot.lds
> @@ -19,33 +19,11 @@ SECTIONS
>   		*(.u_boot_sandbox_getopt_end)
>   	}
>
> -	.__efi_runtime_start : {
> -		*(.__efi_runtime_start)
> -	}
> -
> -	.efi_runtime : {
> -		*(efi_runtime_text)
> -		*(efi_runtime_data)
> -	}
> -
> -	.__efi_runtime_stop : {
> -		*(.__efi_runtime_stop)
> -	}
> -
> -	.efi_runtime_rel_start :
> -	{
> -		*(.__efi_runtime_rel_start)
> -	}
> -
> -	.efi_runtime_rel : {
> -		*(.relefi_runtime_text)
> -		*(.relefi_runtime_data)
> -	}
> -
> -	.efi_runtime_rel_stop :
> -	{
> -		*(.__efi_runtime_rel_stop)
> -	}
> +	/* Sandbox has empty EFI runtime lists. */
> +	__efi_runtime_start = .;
> +	__efi_runtime_stop = __efi_runtime_start;
> +	__efi_runtime_rel_start = .;
> +	__efi_runtime_rel_stop = __efi_runtime_rel_start;
>
>   	.dynsym :
>   	{
> diff --git a/arch/sandbox/lib/Makefile b/arch/sandbox/lib/Makefile
> index a2bc5a7ee6..05f06180f8 100644
> --- a/arch/sandbox/lib/Makefile
> +++ b/arch/sandbox/lib/Makefile
> @@ -5,7 +5,7 @@
>   # (C) Copyright 2002-2006
>   # Wolfgang Denk, DENX Software Engineering, wd at denx.de.
>
> -obj-y	+= fdt_fixup.o interrupts.o sections.o
> +obj-y	+= fdt_fixup.o interrupts.o
>   obj-$(CONFIG_PCI)	+= pci_io.o
>   obj-$(CONFIG_CMD_BOOTM) += bootm.o
>   obj-$(CONFIG_CMD_BOOTZ) += bootm.o
> diff --git a/arch/sandbox/lib/sections.c b/arch/sandbox/lib/sections.c
> deleted file mode 100644
> index 2559eeea38..0000000000
> --- a/arch/sandbox/lib/sections.c
> +++ /dev/null
> @@ -1,13 +0,0 @@
> -// SPDX-License-Identifier: GPL-2.0+
> -/*
> - * Copyright 2013 Albert ARIBAUD <albert.u.boot at aribaud.net>
> - *
> - */
> -#include <linux/compiler.h>
> -
> -char __efi_runtime_start[0] __section(".__efi_runtime_start");
> -char __efi_runtime_stop[0] __section(".__efi_runtime_stop");
> -char __efi_runtime_rel_start[0]
> -		__section(".__efi_runtime_rel_start");
> -char __efi_runtime_rel_stop[0]
> -		__section(".__efi_runtime_rel_stop");



More information about the U-Boot mailing list