[Concept,06/15] riscv: Exclude -static -pie from LDFLAGS for EFI apps

Message ID 20260212001410.1919749-7-sjg@u-boot.org
State New
Headers
Series riscv: Add EFI-application support |

Commit Message

Simon Glass Feb. 12, 2026, 12:13 a.m. UTC
  From: Simon Glass <simon.glass@canonical.com>

The RISC-V LDFLAGS_u-boot includes -static -pie, which conflicts with
the -shared flag needed for building EFI applications as shared
objects.

Guard these flags with ifndef CONFIG_EFI_APP so that EFI app builds
can use their own linker flags.

Co-developed-by: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
---

 arch/riscv/config.mk | 2 ++
 1 file changed, 2 insertions(+)
  

Patch

diff --git a/arch/riscv/config.mk b/arch/riscv/config.mk
index 9f16dda92a0..123b5d24cca 100644
--- a/arch/riscv/config.mk
+++ b/arch/riscv/config.mk
@@ -27,7 +27,9 @@  endif
 
 PLATFORM_CPPFLAGS	+= -ffixed-x3 -fpic
 PLATFORM_RELFLAGS	+= -fno-common -ffunction-sections -fdata-sections
+ifndef CONFIG_EFI_APP
 LDFLAGS_u-boot		+= --gc-sections -static -pie
+endif
 
 EFI_CRT0		:= crt0_riscv_efi.o
 EFI_RELOC		:= reloc_riscv_efi.o