From e927cef0ce3f650dc741c0fdc0b256c5d8cee7e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20P=C3=B6tzsch?= Date: Wed, 24 Jun 2026 16:30:08 +0200 Subject: [PATCH] gcc: defer L4Re loader symbols to runtime in LINK_SPEC MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The dynamic-executable LINK_SPEC sets /rom/libld-l4.so.1 as the interpreter but does not allow undefined symbols in shared libraries. L4Re's libc.so carries no DT_NEEDED on the loader, so ld cannot resolve the loader-provided symbols (_dl_*, l4re_global_env, l4_global_kip, l4re_env_posix_vfs_ops) at link time and a plain link fails. Add --allow-shlib-undefined to the dynamic-exe branch so these symbols are bound at load time by the interpreter, matching what the libc -> ld-linux DT_NEEDED chain achieves implicitly on GNU/Linux. Signed-off-by: Christian Pötzsch --- recipes/devel/gcc/0103-Add-L4Re-support.patch | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/recipes/devel/gcc/0103-Add-L4Re-support.patch b/recipes/devel/gcc/0103-Add-L4Re-support.patch index 5b00e5bb..351187e2 100644 --- a/recipes/devel/gcc/0103-Add-L4Re-support.patch +++ b/recipes/devel/gcc/0103-Add-L4Re-support.patch @@ -5,7 +5,7 @@ Subject: [PATCH 5/5] Add L4Re support diff -Nurp a/gcc/config/i386/l4re64.h b/gcc/config/i386/l4re64.h --- a/gcc/config/i386/l4re64.h 1970-01-01 01:00:00.000000000 +0100 +++ b/gcc/config/i386/l4re64.h 2025-12-12 10:56:34.558135410 +0100 -@@ -0,0 +1,22 @@ +@@ -0,0 +1,23 @@ +#ifdef TARGET_LIBC_PROVIDES_SSP +/* i386 uclibc provides __stack_chk_guard in %gs:0x14, + x86_64 uclibc provides it in %fs:0x28. */ @@ -22,6 +22,7 @@ diff -Nurp a/gcc/config/i386/l4re64.h b/gcc/config/i386/l4re64.h + %{!static: \ + %{!static-pie: \ + %{rdynamic:-export-dynamic} \ ++ --allow-shlib-undefined \ + -dynamic-linker=/rom/libld-l4.so.1}} \ + %{static:-static} \ + %{static-pie:-static -pie --no-dynamic-linker -z text}}" @@ -31,7 +32,7 @@ diff -Nurp a/gcc/config/i386/l4re64.h b/gcc/config/i386/l4re64.h diff -Nurp a/gcc/config/l4re.h b/gcc/config/l4re.h --- a/gcc/config/l4re.h 1970-01-01 01:00:00.000000000 +0100 +++ b/gcc/config/l4re.h 2025-12-12 10:58:45.131911725 +0100 -@@ -0,0 +1,70 @@ +@@ -0,0 +1,71 @@ +/* The GNU C++ standard library requires that these macros be defined. */ +#undef CPLUSPLUS_CPP_SPEC +#define CPLUSPLUS_CPP_SPEC "-D_GNU_SOURCE %(cpp)" @@ -69,6 +70,7 @@ diff -Nurp a/gcc/config/l4re.h b/gcc/config/l4re.h + %{!static: \ + %{!static-pie: \ + %{rdynamic:-export-dynamic} \ ++ --allow-shlib-undefined \ + -dynamic-linker=/rom/libld-l4.so.1}} \ + %{static:-static} \ + %{static-pie:-static -pie --no-dynamic-linker -z text}}"