fix: prefix.mk — patch sysroot+redoxer cstdlib for strtold

Previously only gcc-install was patched. Recipes use sysroot copy
which is a copy of relibc-install (NOT gcc-install), so the cstdlib
strtold fix never propagated to the actual compilation environment.
Patch both sysroot and redoxer toolchain copies.
This commit is contained in:
2026-06-30 03:57:51 +03:00
parent 7dfebab9bf
commit 2382aa496f
+16
View File
@@ -103,6 +103,22 @@ ifeq ($(PODMAN_BUILD),1)
else
rm -rf "$@"
cp -r "$(PREFIX)/relibc-install/" "$@"
# Patch relibc sysroot and redoxer toolchain GCC <cstdlib> for strtold.
# relibc declares strtold in stdlib.h (cbindgen trailer) but GCC's
# cstdlib does 'using ::strtold' before the trailer is processed.
# Add explicit #include <stdlib.h> after #include_next <stdlib.h>
# so ::strtold is visible when the C++ wrapper runs its using.
for _cstdlib in "$(COOKBOOK_ROOT)/prefix/${TARGET}/sysroot/${GNU_TARGET}/include/c++"/*/cstdlib; do \
[ -f "$$_cstdlib" ] || continue; \
sed -i '/^#include_next <stdlib.h>$$/a\\n// Red Bear: relibc declares strtold via cbindgen trailer.\n// The explicit include ensures ::strtold is visible when the\n// C++ wrapper processes its using-directives below.\n#include <stdlib.h>' "$$_cstdlib"; \
done
@REDOXER_TC=$(HOME)/.redoxer/$(TARGET)/toolchain/$(GNU_TARGET); \
if [ -d "$$REDOXER_TC/include/c++" ]; then \
for _cstdlib in "$$REDOXER_TC/include/c++"/*/cstdlib; do \
[ -f "$$_cstdlib" ] || continue; \
sed -i '/^#include_next <stdlib.h>$$/a\\n// Red Bear: relibc declares strtold via cbindgen trailer.\n// The explicit include ensures ::strtold is visible when the\n// C++ wrapper processes its using-directives below.\n#include <stdlib.h>' "$$_cstdlib"; \
done; \
fi
# Propagate fresh relibc artifacts (libc.a, crt*.o, headers) from the
# rebuilt sysroot back into gcc-install. The GCC driver's built-in
# library search path always looks inside gcc-install/ first; if that