On Mon, Feb 03, 2025 at 10:41:55AM -0700, Simon Glass wrote:

> This value is only available if CONFIG_HAVE_TEXT_BASE is enabled. Add
> conditions to avoid introducing errors in link scripts when it is not.
> 
> Signed-off-by: Simon Glass <s...@chromium.org>
> ---
> 
>  Makefile | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/Makefile b/Makefile
> index 2f7614191a1..3958ea45b9a 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -1050,8 +1050,10 @@ LDFLAGS_u-boot += -z notext $(call 
> ld-option,--apply-dynamic-relocs)
>  LDFLAGS_u-boot += --build-id=none
>  
>  ifeq ($(CONFIG_ARC)$(CONFIG_NIOS2)$(CONFIG_X86)$(CONFIG_XTENSA),)
> +ifdef CONFIG_HAVE_TEXT_BASE
>  LDFLAGS_u-boot += -Ttext $(CONFIG_TEXT_BASE)
>  endif
> +endif

This is for linking of the "u-boot" target, and we can just add EFI_APP
here. Looking at the cases above (arc and x86 at least), it's arguable
that they're abusing CONFIG_TEXT_BASE when they really want some
slightly different symbol to be used, but we can just set that can of
worms aside now instead.

>  # make the checker run with the right architecture
>  CHECKFLAGS += --arch=$(ARCH)
> @@ -1741,7 +1743,7 @@ quiet_cmd_u-boot-elf ?= LD      $@
>       cmd_u-boot-elf ?= $(LD) u-boot-elf.o -o $@ \
>       $(if $(CONFIG_SYS_BIG_ENDIAN),-EB,-EL) \
>       -T u-boot-elf.lds 
> --defsym=$(CONFIG_PLATFORM_ELFENTRY)=$(CONFIG_TEXT_BASE) \
> -     -Ttext=$(CONFIG_TEXT_BASE)
> +     $(if $(CONFIG_HAVE_TEXT_BASE),-Ttext=$(CONFIG_TEXT_BASE))
>  u-boot.elf: u-boot.bin u-boot-elf.lds
>       $(Q)$(OBJCOPY) -I binary $(PLATFORM_ELFFLAGS) $< u-boot-elf.o
>       $(call if_changed,u-boot-elf)

This is for u-boot-elf and I think not defining CONFIG_PLATFORM_ELFENTRY
to CONFIG_TEXT_BASE will be a functional error.

-- 
Tom

Attachment: signature.asc
Description: PGP signature

Reply via email to