diff mbox series

libgcc: fix build for baremetal

Message ID 20261007055706.1493585-1-joerg.vehlow@emlix.com
State Under Review
Headers show
Series libgcc: fix build for baremetal | expand

Commit Message

Jörg Vehlow Oct. 7, 2026, 5:57 a.m. UTC
By removing the erroneous EXTRA_OECONF override in 020d5f0, gcc-cross is now configured with correct sysroot flags, which removes the hosts include directory from the internal paths.
This in turn leads to libgcc not finding libc headers (as it should) and breaks libgcc build.
In order to fix this, libgcc must be built almost like libgcc-initial.

Signed-off-by: Joerg Vehlow <joerg.vehlow@emlix.com>
---
 meta/recipes-devtools/gcc/libgcc.inc | 10 ++++++++++
 1 file changed, 10 insertions(+)
diff mbox series

Patch

diff --git a/meta/recipes-devtools/gcc/libgcc.inc b/meta/recipes-devtools/gcc/libgcc.inc
index e92dadf021..93e217f567 100644
--- a/meta/recipes-devtools/gcc/libgcc.inc
+++ b/meta/recipes-devtools/gcc/libgcc.inc
@@ -37,6 +37,16 @@  LICENSE:${PN}-dev = "GPL-3.0-or-later WITH GCC-exception-3.1"
 LICENSE:${PN}-dbg = "GPL-3.0-or-later WITH GCC-exception-3.1"
 LICENSE:${PN}-src = "GPL-3.0-or-later WITH GCC-exception-3.1"
 
+# On baremetal there is no libc:
+# configure need limits.h for its sanity check
+# libc dependencies have to be patched out just like in libgcc-initial
+do_configure:prepend:libc-baremetal () {
+	install -d ${STAGING_INCDIR}
+	touch ${STAGING_INCDIR}/limits.h
+	sed -i -e 's#INHIBIT_LIBC_CFLAGS =.*#INHIBIT_LIBC_CFLAGS = -Dinhibit_libc#' ${B}/gcc/libgcc.mvars
+	sed -i -e 's#inhibit_libc = false#inhibit_libc = true#' ${B}/gcc/Makefile
+}
+
 FILES:${PN}-dev = "\
     ${base_libdir}/libgcc*.so \
     ${@oe.utils.conditional('BASETARGET_SYS', '${TARGET_SYS}', '', '${libdir}/${BASETARGET_SYS}', d)} \