diff mbox series

[v3,3/3] grub,grub-efi: Always use BFD linker with clang

Message ID 20250904051509.798465-3-raj.khem@gmail.com
State New
Headers show
Series [v2,1/3] kea: Fix build with clang/libc++ 21 | expand

Commit Message

Khem Raj Sept. 4, 2025, 5:15 a.m. UTC
LLD 21+ is erroring on text address being lower than the default
segment address for binaries. Erroring during configure e.g.

cannot link at address 0x2000

With LLD 21, -Ttext,<addr> only moves the .text section
it does not change the image base and LLD 21 errors out
if any section VMA is below the image base and the segment (image)
base still defaults to 0x400000 when using LLD, hence the error

LLD support in Grub needs to be done properly, it will need
to adjust how linker options are constructed in configure. We
default to use BFD linker always when using clang for now.

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
v3: No change

 meta/recipes-bsp/grub/grub2.inc | 1 +
 1 file changed, 1 insertion(+)
diff mbox series

Patch

diff --git a/meta/recipes-bsp/grub/grub2.inc b/meta/recipes-bsp/grub/grub2.inc
index ffa04e415d3..dd1587acd6e 100644
--- a/meta/recipes-bsp/grub/grub2.inc
+++ b/meta/recipes-bsp/grub/grub2.inc
@@ -71,6 +71,7 @@  CFLAGS:remove = "-O2"
 # CFLAGS += -mno-mmx -mno-sse
 # So also remove -mfpmath=sse from TUNE_CCARGS
 TUNE_CCARGS:remove = "-mfpmath=sse"
+TUNE_CCARGS:append:toolchain-clang = " -fuse-ld=bfd -Wno-error=unused-command-line-argument"
 
 EXTRA_OECONF = "--with-platform=${GRUBPLATFORM} \
                 --disable-grub-mkfont \