From: Simon Glass <simon.glass@canonical.com> Add the build machinery for RISC-V EFI applications in config.mk: - OBJCOPYFLAGS_EFI for the EFI stub binary sections - LDFLAGS_FINAL with -shared -Bsymbolic for the shared-object link - LDSCRIPT pointing to the EFI app linker script - Separate OBJCOPYFLAGS_EFI for the app, which uses a different set of sections since the linker script groups data contiguously Co-developed-by: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Simon Glass <simon.glass@canonical.com> --- arch/riscv/config.mk | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/arch/riscv/config.mk b/arch/riscv/config.mk index 123b5d24cca..1d98c015357 100644 --- a/arch/riscv/config.mk +++ b/arch/riscv/config.mk @@ -33,3 +33,20 @@ endif EFI_CRT0 := crt0_riscv_efi.o EFI_RELOC := reloc_riscv_efi.o + +OBJCOPYFLAGS_EFI += -j .text -j .rodata -j .data -j .sdata -j .dynamic \ + -j .dynsym -j .rela -j .reloc -j .got -j .got.plt \ + -j __u_boot_list -j .embedded_dtb -O binary + +ifeq ($(CONFIG_EFI_APP),y) + +LDFLAGS_FINAL += -znocombreloc -shared -Bsymbolic --gc-sections +LDSCRIPT := $(srctree)/arch/riscv/lib/elf_riscv64_efi_app.lds + +# The EFI app linker script places all data sections contiguously +# between _data and _edata so the PE .data section covers them. +OBJCOPYFLAGS_EFI := -j .text -j .rela.dyn \ + -j .dynsym -j .dynstr -j .embedded_dtb -j .data \ + -O binary + +endif -- 2.43.0