diff --git a/packages/gcc/10.3.0/0023-Remove-use-of-include_next-from-c-headers.patch b/packages/gcc/10.3.0/0023-Remove-use-of-include_next-from-c-headers.patch new file mode 100644 index 00000000..47584c2a --- /dev/null +++ b/packages/gcc/10.3.0/0023-Remove-use-of-include_next-from-c-headers.patch @@ -0,0 +1,307 @@ +From 4cea8f51c23ce7112f21ff4091e7d97272b81664 Mon Sep 17 00:00:00 2001 +From: Keith Packard +Date: Sun, 24 Jan 2021 14:20:33 -0800 +Subject: [PATCH] Remove use of include_next from c++ headers + +Using include_next bypasses the default header search path and lets +files later in the include path take priority over earlier files. + +This makes replacing libc impossible as the default libc headers will +occur after the libstdc++ headers, and so be picked up in place of +headers inserted at the begining of the search path or appended to the +end of the search path. + +Using include_next is a hack to work-around broken combinations of +libraries, and is not necessary in a well constructed toolchain. + +Signed-off-by: Keith Packard +--- + libstdc++-v3/include/bits/std_abs.h | 4 ++-- + libstdc++-v3/include/c/cassert | 2 +- + libstdc++-v3/include/c/cctype | 2 +- + libstdc++-v3/include/c/cerrno | 2 +- + libstdc++-v3/include/c/cfloat | 2 +- + libstdc++-v3/include/c/climits | 2 +- + libstdc++-v3/include/c/clocale | 2 +- + libstdc++-v3/include/c/cmath | 2 +- + libstdc++-v3/include/c/csetjmp | 2 +- + libstdc++-v3/include/c/csignal | 2 +- + libstdc++-v3/include/c/cstdarg | 2 +- + libstdc++-v3/include/c/cstddef | 2 +- + libstdc++-v3/include/c/cstdio | 2 +- + libstdc++-v3/include/c/cstdlib | 2 +- + libstdc++-v3/include/c/cstring | 2 +- + libstdc++-v3/include/c/ctime | 2 +- + libstdc++-v3/include/c/cuchar | 2 +- + libstdc++-v3/include/c/cwchar | 2 +- + libstdc++-v3/include/c/cwctype | 2 +- + libstdc++-v3/include/c_global/cmath | 2 +- + libstdc++-v3/include/c_global/cstdlib | 2 +- + 21 files changed, 22 insertions(+), 22 deletions(-) + +diff --git a/libstdc++-v3/include/bits/std_abs.h b/libstdc++-v3/include/bits/std_abs.h +index ae6bfc1b1ac..249ed53a3ce 100644 +--- a/libstdc++-v3/include/bits/std_abs.h ++++ b/libstdc++-v3/include/bits/std_abs.h +@@ -35,9 +35,9 @@ + #include + + #define _GLIBCXX_INCLUDE_NEXT_C_HEADERS +-#include_next ++#include + #ifdef __CORRECT_ISO_CPP_MATH_H_PROTO +-# include_next ++# include + #endif + #undef _GLIBCXX_INCLUDE_NEXT_C_HEADERS + +diff --git a/libstdc++-v3/include/c/cassert b/libstdc++-v3/include/c/cassert +index abd8c0538ef..3e1b97f1626 100644 +--- a/libstdc++-v3/include/c/cassert ++++ b/libstdc++-v3/include/c/cassert +@@ -31,4 +31,4 @@ + #pragma GCC system_header + + #include +-#include_next ++#include +diff --git a/libstdc++-v3/include/c/cctype b/libstdc++-v3/include/c/cctype +index d53cb3d43f3..3def33f2077 100644 +--- a/libstdc++-v3/include/c/cctype ++++ b/libstdc++-v3/include/c/cctype +@@ -31,6 +31,6 @@ + + #pragma GCC system_header + +-#include_next ++#include + + #endif +diff --git a/libstdc++-v3/include/c/cerrno b/libstdc++-v3/include/c/cerrno +index a8d3869efb6..3725137c115 100644 +--- a/libstdc++-v3/include/c/cerrno ++++ b/libstdc++-v3/include/c/cerrno +@@ -41,7 +41,7 @@ + #pragma GCC system_header + + #include +-#include_next ++#include + + // Adhere to section 17.4.1.2 clause 5 of ISO 14882:1998 + #ifndef errno +diff --git a/libstdc++-v3/include/c/cfloat b/libstdc++-v3/include/c/cfloat +index 5865d427c20..df821645e4d 100644 +--- a/libstdc++-v3/include/c/cfloat ++++ b/libstdc++-v3/include/c/cfloat +@@ -32,6 +32,6 @@ + #pragma GCC system_header + + #include +-#include_next ++#include + + #endif +diff --git a/libstdc++-v3/include/c/climits b/libstdc++-v3/include/c/climits +index 849afadeffc..b153fa8c27c 100644 +--- a/libstdc++-v3/include/c/climits ++++ b/libstdc++-v3/include/c/climits +@@ -32,6 +32,6 @@ + #pragma GCC system_header + + #include +-#include_next ++#include + + #endif +diff --git a/libstdc++-v3/include/c/clocale b/libstdc++-v3/include/c/clocale +index fc84745397d..5ebccdf5006 100644 +--- a/libstdc++-v3/include/c/clocale ++++ b/libstdc++-v3/include/c/clocale +@@ -31,6 +31,6 @@ + + #pragma GCC system_header + +-#include_next ++#include + + #endif +diff --git a/libstdc++-v3/include/c/cmath b/libstdc++-v3/include/c/cmath +index 2c51f2f13bc..2fcd09e4ef9 100644 +--- a/libstdc++-v3/include/c/cmath ++++ b/libstdc++-v3/include/c/cmath +@@ -33,7 +33,7 @@ + + #include + +-#include_next ++#include + + // Get rid of those macros defined in in lieu of real functions. + #undef abs +diff --git a/libstdc++-v3/include/c/csetjmp b/libstdc++-v3/include/c/csetjmp +index db83610d95f..5abafcb160d 100644 +--- a/libstdc++-v3/include/c/csetjmp ++++ b/libstdc++-v3/include/c/csetjmp +@@ -31,7 +31,7 @@ + + #pragma GCC system_header + +-#include_next ++#include + + // Get rid of those macros defined in in lieu of real functions. + #undef longjmp +diff --git a/libstdc++-v3/include/c/csignal b/libstdc++-v3/include/c/csignal +index 986c5d3daca..77cb7634a69 100644 +--- a/libstdc++-v3/include/c/csignal ++++ b/libstdc++-v3/include/c/csignal +@@ -31,6 +31,6 @@ + + #pragma GCC system_header + +-#include_next ++#include + + #endif +diff --git a/libstdc++-v3/include/c/cstdarg b/libstdc++-v3/include/c/cstdarg +index 6b6e1850753..0dfc60cc6ba 100644 +--- a/libstdc++-v3/include/c/cstdarg ++++ b/libstdc++-v3/include/c/cstdarg +@@ -32,6 +32,6 @@ + #pragma GCC system_header + + #undef __need___va_list +-#include_next ++#include + + #endif +diff --git a/libstdc++-v3/include/c/cstddef b/libstdc++-v3/include/c/cstddef +index 7fc8ce34efc..fc90dfb3f18 100644 +--- a/libstdc++-v3/include/c/cstddef ++++ b/libstdc++-v3/include/c/cstddef +@@ -35,6 +35,6 @@ + #define __need_ptrdiff_t + #define __need_NULL + #define __need_offsetof +-#include_next ++#include + + #endif +diff --git a/libstdc++-v3/include/c/cstdio b/libstdc++-v3/include/c/cstdio +index e943aa8e725..89bcd2d7391 100644 +--- a/libstdc++-v3/include/c/cstdio ++++ b/libstdc++-v3/include/c/cstdio +@@ -31,7 +31,7 @@ + + #pragma GCC system_header + +-#include_next ++#include + + // Get rid of those macros defined in in lieu of real functions. + #undef clearerr +diff --git a/libstdc++-v3/include/c/cstdlib b/libstdc++-v3/include/c/cstdlib +index 86d9587482f..a26013286be 100644 +--- a/libstdc++-v3/include/c/cstdlib ++++ b/libstdc++-v3/include/c/cstdlib +@@ -31,6 +31,6 @@ + + #pragma GCC system_header + +-#include_next ++#include + + #endif +diff --git a/libstdc++-v3/include/c/cstring b/libstdc++-v3/include/c/cstring +index 8b1e89b13b6..ca56c75e753 100644 +--- a/libstdc++-v3/include/c/cstring ++++ b/libstdc++-v3/include/c/cstring +@@ -31,6 +31,6 @@ + + #pragma GCC system_header + +-#include_next ++#include + + #endif +diff --git a/libstdc++-v3/include/c/ctime b/libstdc++-v3/include/c/ctime +index 367172b21eb..135da2a25c4 100644 +--- a/libstdc++-v3/include/c/ctime ++++ b/libstdc++-v3/include/c/ctime +@@ -31,6 +31,6 @@ + + #pragma GCC system_header + +-#include_next ++#include + + #endif +diff --git a/libstdc++-v3/include/c/cuchar b/libstdc++-v3/include/c/cuchar +index e63b55ae12c..c79708fba6a 100644 +--- a/libstdc++-v3/include/c/cuchar ++++ b/libstdc++-v3/include/c/cuchar +@@ -39,7 +39,7 @@ + #include + + #if _GLIBCXX_USE_C11_UCHAR_CXX11 +-# include_next ++# include + #endif + + #endif // C++11 +diff --git a/libstdc++-v3/include/c/cwchar b/libstdc++-v3/include/c/cwchar +index 05d4d70c6fc..0fc9a9a394a 100644 +--- a/libstdc++-v3/include/c/cwchar ++++ b/libstdc++-v3/include/c/cwchar +@@ -36,7 +36,7 @@ + #include + + #if _GLIBCXX_HAVE_WCHAR_H +-#include_next ++#include + #endif + + // Need to do a bit of trickery here with mbstate_t as char_traits +diff --git a/libstdc++-v3/include/c/cwctype b/libstdc++-v3/include/c/cwctype +index 0626765d6c8..4839b693e46 100644 +--- a/libstdc++-v3/include/c/cwctype ++++ b/libstdc++-v3/include/c/cwctype +@@ -34,7 +34,7 @@ + #include + + #if _GLIBCXX_HAVE_WCTYPE_H +-#include_next ++#include + #endif + + #endif +diff --git a/libstdc++-v3/include/c_global/cmath b/libstdc++-v3/include/c_global/cmath +index 39a6b036b8c..bfb6dcd4c88 100644 +--- a/libstdc++-v3/include/c_global/cmath ++++ b/libstdc++-v3/include/c_global/cmath +@@ -42,7 +42,7 @@ + #include + #include + #define _GLIBCXX_INCLUDE_NEXT_C_HEADERS +-#include_next ++#include + #undef _GLIBCXX_INCLUDE_NEXT_C_HEADERS + #include + +diff --git a/libstdc++-v3/include/c_global/cstdlib b/libstdc++-v3/include/c_global/cstdlib +index 47b954cf2fa..996a87b372c 100644 +--- a/libstdc++-v3/include/c_global/cstdlib ++++ b/libstdc++-v3/include/c_global/cstdlib +@@ -72,7 +72,7 @@ namespace std + // Need to ensure this finds the C library's not a libstdc++ + // wrapper that might already be installed later in the include search path. + #define _GLIBCXX_INCLUDE_NEXT_C_HEADERS +-#include_next ++#include + #undef _GLIBCXX_INCLUDE_NEXT_C_HEADERS + #include + +-- +2.30.0 + diff --git a/packages/gcc/11.1.0/0009-Remove-use-of-include_next-from-c-headers.patch b/packages/gcc/11.1.0/0009-Remove-use-of-include_next-from-c-headers.patch new file mode 100644 index 00000000..a4e32152 --- /dev/null +++ b/packages/gcc/11.1.0/0009-Remove-use-of-include_next-from-c-headers.patch @@ -0,0 +1,307 @@ +From 9db1164d68ee1da7434af48db4f828d7df51b055 Mon Sep 17 00:00:00 2001 +From: Keith Packard +Date: Sun, 24 Jan 2021 14:20:33 -0800 +Subject: [PATCH] Remove use of include_next from c++ headers + +Using include_next bypasses the default header search path and lets +files later in the include path take priority over earlier files. + +This makes replacing libc impossible as the default libc headers will +occur after the libstdc++ headers, and so be picked up in place of +headers inserted at the begining of the search path or appended to the +end of the search path. + +Using include_next is a hack to work-around broken combinations of +libraries, and is not necessary in a well constructed toolchain. + +Signed-off-by: Keith Packard +--- + libstdc++-v3/include/bits/std_abs.h | 4 ++-- + libstdc++-v3/include/c/cassert | 2 +- + libstdc++-v3/include/c/cctype | 2 +- + libstdc++-v3/include/c/cerrno | 2 +- + libstdc++-v3/include/c/cfloat | 2 +- + libstdc++-v3/include/c/climits | 2 +- + libstdc++-v3/include/c/clocale | 2 +- + libstdc++-v3/include/c/cmath | 2 +- + libstdc++-v3/include/c/csetjmp | 2 +- + libstdc++-v3/include/c/csignal | 2 +- + libstdc++-v3/include/c/cstdarg | 2 +- + libstdc++-v3/include/c/cstddef | 2 +- + libstdc++-v3/include/c/cstdio | 2 +- + libstdc++-v3/include/c/cstdlib | 2 +- + libstdc++-v3/include/c/cstring | 2 +- + libstdc++-v3/include/c/ctime | 2 +- + libstdc++-v3/include/c/cuchar | 2 +- + libstdc++-v3/include/c/cwchar | 2 +- + libstdc++-v3/include/c/cwctype | 2 +- + libstdc++-v3/include/c_global/cmath | 2 +- + libstdc++-v3/include/c_global/cstdlib | 2 +- + 21 files changed, 22 insertions(+), 22 deletions(-) + +diff --git a/libstdc++-v3/include/bits/std_abs.h b/libstdc++-v3/include/bits/std_abs.h +index ae6bfc1b1ac..249ed53a3ce 100644 +--- a/libstdc++-v3/include/bits/std_abs.h ++++ b/libstdc++-v3/include/bits/std_abs.h +@@ -35,9 +35,9 @@ + #include + + #define _GLIBCXX_INCLUDE_NEXT_C_HEADERS +-#include_next ++#include + #ifdef __CORRECT_ISO_CPP_MATH_H_PROTO +-# include_next ++# include + #endif + #undef _GLIBCXX_INCLUDE_NEXT_C_HEADERS + +diff --git a/libstdc++-v3/include/c/cassert b/libstdc++-v3/include/c/cassert +index abd8c0538ef..3e1b97f1626 100644 +--- a/libstdc++-v3/include/c/cassert ++++ b/libstdc++-v3/include/c/cassert +@@ -31,4 +31,4 @@ + #pragma GCC system_header + + #include +-#include_next ++#include +diff --git a/libstdc++-v3/include/c/cctype b/libstdc++-v3/include/c/cctype +index d53cb3d43f3..3def33f2077 100644 +--- a/libstdc++-v3/include/c/cctype ++++ b/libstdc++-v3/include/c/cctype +@@ -31,6 +31,6 @@ + + #pragma GCC system_header + +-#include_next ++#include + + #endif +diff --git a/libstdc++-v3/include/c/cerrno b/libstdc++-v3/include/c/cerrno +index a8d3869efb6..3725137c115 100644 +--- a/libstdc++-v3/include/c/cerrno ++++ b/libstdc++-v3/include/c/cerrno +@@ -41,7 +41,7 @@ + #pragma GCC system_header + + #include +-#include_next ++#include + + // Adhere to section 17.4.1.2 clause 5 of ISO 14882:1998 + #ifndef errno +diff --git a/libstdc++-v3/include/c/cfloat b/libstdc++-v3/include/c/cfloat +index 5865d427c20..df821645e4d 100644 +--- a/libstdc++-v3/include/c/cfloat ++++ b/libstdc++-v3/include/c/cfloat +@@ -32,6 +32,6 @@ + #pragma GCC system_header + + #include +-#include_next ++#include + + #endif +diff --git a/libstdc++-v3/include/c/climits b/libstdc++-v3/include/c/climits +index 849afadeffc..b153fa8c27c 100644 +--- a/libstdc++-v3/include/c/climits ++++ b/libstdc++-v3/include/c/climits +@@ -32,6 +32,6 @@ + #pragma GCC system_header + + #include +-#include_next ++#include + + #endif +diff --git a/libstdc++-v3/include/c/clocale b/libstdc++-v3/include/c/clocale +index fc84745397d..5ebccdf5006 100644 +--- a/libstdc++-v3/include/c/clocale ++++ b/libstdc++-v3/include/c/clocale +@@ -31,6 +31,6 @@ + + #pragma GCC system_header + +-#include_next ++#include + + #endif +diff --git a/libstdc++-v3/include/c/cmath b/libstdc++-v3/include/c/cmath +index 2c51f2f13bc..2fcd09e4ef9 100644 +--- a/libstdc++-v3/include/c/cmath ++++ b/libstdc++-v3/include/c/cmath +@@ -33,7 +33,7 @@ + + #include + +-#include_next ++#include + + // Get rid of those macros defined in in lieu of real functions. + #undef abs +diff --git a/libstdc++-v3/include/c/csetjmp b/libstdc++-v3/include/c/csetjmp +index db83610d95f..5abafcb160d 100644 +--- a/libstdc++-v3/include/c/csetjmp ++++ b/libstdc++-v3/include/c/csetjmp +@@ -31,7 +31,7 @@ + + #pragma GCC system_header + +-#include_next ++#include + + // Get rid of those macros defined in in lieu of real functions. + #undef longjmp +diff --git a/libstdc++-v3/include/c/csignal b/libstdc++-v3/include/c/csignal +index 986c5d3daca..77cb7634a69 100644 +--- a/libstdc++-v3/include/c/csignal ++++ b/libstdc++-v3/include/c/csignal +@@ -31,6 +31,6 @@ + + #pragma GCC system_header + +-#include_next ++#include + + #endif +diff --git a/libstdc++-v3/include/c/cstdarg b/libstdc++-v3/include/c/cstdarg +index 6b6e1850753..0dfc60cc6ba 100644 +--- a/libstdc++-v3/include/c/cstdarg ++++ b/libstdc++-v3/include/c/cstdarg +@@ -32,6 +32,6 @@ + #pragma GCC system_header + + #undef __need___va_list +-#include_next ++#include + + #endif +diff --git a/libstdc++-v3/include/c/cstddef b/libstdc++-v3/include/c/cstddef +index 7fc8ce34efc..fc90dfb3f18 100644 +--- a/libstdc++-v3/include/c/cstddef ++++ b/libstdc++-v3/include/c/cstddef +@@ -35,6 +35,6 @@ + #define __need_ptrdiff_t + #define __need_NULL + #define __need_offsetof +-#include_next ++#include + + #endif +diff --git a/libstdc++-v3/include/c/cstdio b/libstdc++-v3/include/c/cstdio +index e943aa8e725..89bcd2d7391 100644 +--- a/libstdc++-v3/include/c/cstdio ++++ b/libstdc++-v3/include/c/cstdio +@@ -31,7 +31,7 @@ + + #pragma GCC system_header + +-#include_next ++#include + + // Get rid of those macros defined in in lieu of real functions. + #undef clearerr +diff --git a/libstdc++-v3/include/c/cstdlib b/libstdc++-v3/include/c/cstdlib +index 86d9587482f..a26013286be 100644 +--- a/libstdc++-v3/include/c/cstdlib ++++ b/libstdc++-v3/include/c/cstdlib +@@ -31,6 +31,6 @@ + + #pragma GCC system_header + +-#include_next ++#include + + #endif +diff --git a/libstdc++-v3/include/c/cstring b/libstdc++-v3/include/c/cstring +index 8b1e89b13b6..ca56c75e753 100644 +--- a/libstdc++-v3/include/c/cstring ++++ b/libstdc++-v3/include/c/cstring +@@ -31,6 +31,6 @@ + + #pragma GCC system_header + +-#include_next ++#include + + #endif +diff --git a/libstdc++-v3/include/c/ctime b/libstdc++-v3/include/c/ctime +index 367172b21eb..135da2a25c4 100644 +--- a/libstdc++-v3/include/c/ctime ++++ b/libstdc++-v3/include/c/ctime +@@ -31,6 +31,6 @@ + + #pragma GCC system_header + +-#include_next ++#include + + #endif +diff --git a/libstdc++-v3/include/c/cuchar b/libstdc++-v3/include/c/cuchar +index e63b55ae12c..c79708fba6a 100644 +--- a/libstdc++-v3/include/c/cuchar ++++ b/libstdc++-v3/include/c/cuchar +@@ -39,7 +39,7 @@ + #include + + #if _GLIBCXX_USE_C11_UCHAR_CXX11 +-# include_next ++# include + #endif + + #endif // C++11 +diff --git a/libstdc++-v3/include/c/cwchar b/libstdc++-v3/include/c/cwchar +index 05d4d70c6fc..0fc9a9a394a 100644 +--- a/libstdc++-v3/include/c/cwchar ++++ b/libstdc++-v3/include/c/cwchar +@@ -36,7 +36,7 @@ + #include + + #if _GLIBCXX_HAVE_WCHAR_H +-#include_next ++#include + #endif + + // Need to do a bit of trickery here with mbstate_t as char_traits +diff --git a/libstdc++-v3/include/c/cwctype b/libstdc++-v3/include/c/cwctype +index 0626765d6c8..4839b693e46 100644 +--- a/libstdc++-v3/include/c/cwctype ++++ b/libstdc++-v3/include/c/cwctype +@@ -34,7 +34,7 @@ + #include + + #if _GLIBCXX_HAVE_WCTYPE_H +-#include_next ++#include + #endif + + #endif +diff --git a/libstdc++-v3/include/c_global/cmath b/libstdc++-v3/include/c_global/cmath +index 39a6b036b8c..bfb6dcd4c88 100644 +--- a/libstdc++-v3/include/c_global/cmath ++++ b/libstdc++-v3/include/c_global/cmath +@@ -42,7 +42,7 @@ + #include + #include + #define _GLIBCXX_INCLUDE_NEXT_C_HEADERS +-#include_next ++#include + #undef _GLIBCXX_INCLUDE_NEXT_C_HEADERS + #include + +diff --git a/libstdc++-v3/include/c_global/cstdlib b/libstdc++-v3/include/c_global/cstdlib +index 47b954cf2fa..996a87b372c 100644 +--- a/libstdc++-v3/include/c_global/cstdlib ++++ b/libstdc++-v3/include/c_global/cstdlib +@@ -72,7 +72,7 @@ namespace std + // Need to ensure this finds the C library's not a libstdc++ + // wrapper that might already be installed later in the include search path. + #define _GLIBCXX_INCLUDE_NEXT_C_HEADERS +-#include_next ++#include + #undef _GLIBCXX_INCLUDE_NEXT_C_HEADERS + #include + +-- +2.31.1 + diff --git a/packages/picolibc/1.5.1/0001-libc-Remove-include-sys-select.h-from-sys-types.h.patch b/packages/picolibc/1.5.1/0001-libc-Remove-include-sys-select.h-from-sys-types.h.patch new file mode 100644 index 00000000..5536cd43 --- /dev/null +++ b/packages/picolibc/1.5.1/0001-libc-Remove-include-sys-select.h-from-sys-types.h.patch @@ -0,0 +1,30 @@ +From 9d0640874425e9f3f265c9baff7a47139b25ea7d Mon Sep 17 00:00:00 2001 +From: Keith Packard +Date: Thu, 14 Jan 2021 17:54:22 -0800 +Subject: [PATCH 1/2] libc: Remove #include from sys/types.h + +picolibc's sys/select.h is likely to be replaced by the underlying +operating system version (as it is on Zephyr). Don't include it from +sys/types.h as that version may depend on other definitions in +sys/types.h which haven't yet been defined. + +Signed-off-by: Keith Packard +--- + newlib/libc/include/sys/types.h | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/newlib/libc/include/sys/types.h b/newlib/libc/include/sys/types.h +index ea25222c2..1a0abcb83 100644 +--- a/newlib/libc/include/sys/types.h ++++ b/newlib/libc/include/sys/types.h +@@ -75,7 +75,6 @@ typedef __intptr_t register_t; + + #if __BSD_VISIBLE + #include +-#include + # define physadr physadr_t + # define quad quad_t + +-- +2.30.0 + diff --git a/packages/picolibc/1.5.1/0002-tinystdio-Fix-snprintf-buf-0-.-to-not-smash-buffer.patch b/packages/picolibc/1.5.1/0002-tinystdio-Fix-snprintf-buf-0-.-to-not-smash-buffer.patch new file mode 100644 index 00000000..754957e9 --- /dev/null +++ b/packages/picolibc/1.5.1/0002-tinystdio-Fix-snprintf-buf-0-.-to-not-smash-buffer.patch @@ -0,0 +1,77 @@ +From 9df2d784439720abbf67fa96c6515a5c4a9f230a Mon Sep 17 00:00:00 2001 +From: Keith Packard +Date: Thu, 14 Jan 2021 18:48:44 -0800 +Subject: [PATCH 2/2] tinystdio: Fix snprintf(buf, 0, ...) to not smash buffer + +snprintf(buf, 0) should not write anything to the destination, not +even a trailing '\0'. The tinystdio implementation had a signed +comparison bug where this case would cause a null to be placed in the +output buffer at the size of the data that would have been written. + +Add a test to make sure snprintf respects the 'len' parameter +correctly. + +Signed-off-by: Keith Packard +--- + newlib/libc/tinystdio/snprintf.c | 2 +- + test/printf_scanf.c | 31 +++++++++++++++++++++++++++++++ + 2 files changed, 32 insertions(+), 1 deletion(-) + +diff --git a/newlib/libc/tinystdio/snprintf.c b/newlib/libc/tinystdio/snprintf.c +index 52d2f84d3..1052c9338 100644 +--- a/newlib/libc/tinystdio/snprintf.c ++++ b/newlib/libc/tinystdio/snprintf.c +@@ -56,7 +56,7 @@ snprintf(char *s, size_t n, const char *fmt, ...) + i = vfprintf(&f.file, fmt, ap); + va_end(ap); + +- if (n >= 0 && i >= 0) ++ if ((int) n >= 0 && i >= 0) + s[i < n ? i : n] = 0; + + return i; +diff --git a/test/printf_scanf.c b/test/printf_scanf.c +index 2bc83e1d0..f89f46e4f 100644 +--- a/test/printf_scanf.c ++++ b/test/printf_scanf.c +@@ -96,6 +96,37 @@ main(int argc, char **argv) + fflush(stdout); + } + #endif ++ ++ /* ++ * test snprintf to make sure it doesn't overwrite the specified buffer ++ * length (even if that is zero) ++ */ ++ for (x = 0; x <= 6; x++) { ++ char tbuf[10] = "xxxxxxxxx"; ++ const char ref[10] = "xxxxxxxxx"; ++ int i = snprintf(tbuf, x, "%s", "123"); ++ int y = x <= 4 ? x : 4; ++ if (i != 3) { ++ printf("snprintf(tbuf, %d, \"%%s\", \"123\") return %d instead of %d\n", ++ x, i, 3); ++ errors++; ++ } ++ int l = strlen(tbuf); ++ if (y > 0 && l != y - 1) { ++ printf("returned buffer len want %d got %d\n", y - 1, l); ++ errors++; ++ } ++ if (y > 0 && strncmp(tbuf, "123", y - 1) != 0) { ++ strncpy(buf, "123", y - 1); ++ buf[y-1] = '\0'; ++ printf("returned buffer want %s got %s\n", buf, tbuf); ++ errors++; ++ } ++ if (memcmp(tbuf + y, ref + y, sizeof(tbuf) - y) != 0) { ++ printf("tail of buf mangled %s\n", tbuf + y); ++ errors++; ++ } ++ } + for (x = 0; x < 32; x++) { + unsigned int v = 0x12345678 >> x; + unsigned int r; +-- +2.30.0 + diff --git a/packages/picolibc/1.5.1/0003-libc-Expose-wchar-stdio-prototypes-even-for-TINY_STD.patch b/packages/picolibc/1.5.1/0003-libc-Expose-wchar-stdio-prototypes-even-for-TINY_STD.patch new file mode 100644 index 00000000..5e1c5a85 --- /dev/null +++ b/packages/picolibc/1.5.1/0003-libc-Expose-wchar-stdio-prototypes-even-for-TINY_STD.patch @@ -0,0 +1,108 @@ +From f0c62653bbcf68291a7dd621db367a9fef666183 Mon Sep 17 00:00:00 2001 +From: Keith Packard +Date: Sun, 24 Jan 2021 15:27:14 -0800 +Subject: [PATCH 3/3] libc: Expose wchar stdio prototypes even for TINY_STDIO + +This makes libstdc++ happy when wrapping these names, even though they +aren't actually available for appplications. + +Signed-off-by: Keith Packard +--- + newlib/libc/include/wchar.h | 39 +++++++++++++++++++------------------ + 1 file changed, 20 insertions(+), 19 deletions(-) + +diff --git a/newlib/libc/include/wchar.h b/newlib/libc/include/wchar.h +index 8a9c4b0fe..5dc3af93c 100644 +--- a/newlib/libc/include/wchar.h ++++ b/newlib/libc/include/wchar.h +@@ -217,8 +217,6 @@ float wcstof_l (const wchar_t *, wchar_t **, locale_t); + long double wcstold_l (const wchar_t *, wchar_t **, locale_t); + #endif + +-#ifndef TINY_STDIO +- + wint_t fgetwc (__FILE *); + wchar_t *fgetws (wchar_t *__restrict, int, __FILE *__restrict); + wint_t fputwc (wchar_t, __FILE *); +@@ -232,6 +230,8 @@ wint_t putwc (wchar_t, __FILE *); + wint_t putwchar (wchar_t); + wint_t ungetwc (wint_t wc, __FILE *); + ++#ifndef TINY_STDIO ++ + struct _reent; + + wint_t _fgetwc_r (struct _reent *, __FILE *); +@@ -253,6 +253,24 @@ wint_t _putwchar_r (struct _reent *, wchar_t); + wint_t _putwchar_unlocked_r (struct _reent *, wchar_t); + wint_t _ungetwc_r (struct _reent *, wint_t wc, __FILE *); + ++int _fwprintf_r (struct _reent *, __FILE *, const wchar_t *, ...); ++int _swprintf_r (struct _reent *, wchar_t *, size_t, const wchar_t *, ...); ++int _vfwprintf_r (struct _reent *, __FILE *, const wchar_t *, va_list); ++int _vswprintf_r (struct _reent *, wchar_t *, size_t, const wchar_t *, va_list); ++int _vwprintf_r (struct _reent *, const wchar_t *, va_list); ++int _wprintf_r (struct _reent *, const wchar_t *, ...); ++ ++int _fwscanf_r (struct _reent *, __FILE *, const wchar_t *, ...); ++int _swscanf_r (struct _reent *, const wchar_t *, const wchar_t *, ...); ++int _vfwscanf_r (struct _reent *, __FILE *, const wchar_t *, va_list); ++int _vswscanf_r (struct _reent *, const wchar_t *, const wchar_t *, va_list); ++int _vwscanf_r (struct _reent *, const wchar_t *, va_list); ++int _wscanf_r (struct _reent *, const wchar_t *, ...); ++ ++__FILE *_open_wmemstream_r (struct _reent *, wchar_t **, size_t *); ++ ++#endif ++ + #if __GNU_VISIBLE + wint_t fgetwc_unlocked (__FILE *); + wchar_t *fgetws_unlocked (wchar_t *__restrict, int, __FILE *__restrict); +@@ -267,7 +285,6 @@ wint_t putwchar_unlocked (wchar_t); + #if __POSIX_VISIBLE >= 200809 + __FILE *open_wmemstream (wchar_t **, size_t *); + #endif +-__FILE *_open_wmemstream_r (struct _reent *, wchar_t **, size_t *); + + #if __ISO_C_VISIBLE >= 1999 || __XSI_VISIBLE >= 500 + int fwprintf (__FILE *__restrict, const wchar_t *__restrict, ...); +@@ -281,13 +298,6 @@ int vwprintf (const wchar_t *__restrict, va_list); + int wprintf (const wchar_t *__restrict, ...); + #endif + +-int _fwprintf_r (struct _reent *, __FILE *, const wchar_t *, ...); +-int _swprintf_r (struct _reent *, wchar_t *, size_t, const wchar_t *, ...); +-int _vfwprintf_r (struct _reent *, __FILE *, const wchar_t *, va_list); +-int _vswprintf_r (struct _reent *, wchar_t *, size_t, const wchar_t *, va_list); +-int _vwprintf_r (struct _reent *, const wchar_t *, va_list); +-int _wprintf_r (struct _reent *, const wchar_t *, ...); +- + #if __ISO_C_VISIBLE >= 1999 || __XSI_VISIBLE >= 500 + int fwscanf (__FILE *__restrict, const wchar_t *__restrict, ...); + int swscanf (const wchar_t *__restrict, +@@ -300,13 +310,6 @@ int vwscanf (const wchar_t *__restrict, va_list); + int wscanf (const wchar_t *__restrict, ...); + #endif + +-int _fwscanf_r (struct _reent *, __FILE *, const wchar_t *, ...); +-int _swscanf_r (struct _reent *, const wchar_t *, const wchar_t *, ...); +-int _vfwscanf_r (struct _reent *, __FILE *, const wchar_t *, va_list); +-int _vswscanf_r (struct _reent *, const wchar_t *, const wchar_t *, va_list); +-int _vwscanf_r (struct _reent *, const wchar_t *, va_list); +-int _wscanf_r (struct _reent *, const wchar_t *, ...); +- + #define getwc(fp) fgetwc(fp) + #define putwc(wc,fp) fputwc((wc), (fp)) + #define getwchar() fgetwc(stdin) +@@ -319,8 +322,6 @@ int _wscanf_r (struct _reent *, const wchar_t *, ...); + #define putwchar_unlocked(wc) fputwc_unlocked((wc), stdout) + #endif + +-#endif /* !TINY_STDIO */ +- + _END_STD_C + + #if __SSP_FORTIFY_LEVEL > 0 +-- +2.30.0 + diff --git a/packages/picolibc/1.5.1/chksum b/packages/picolibc/1.5.1/chksum new file mode 100644 index 00000000..01fb1450 --- /dev/null +++ b/packages/picolibc/1.5.1/chksum @@ -0,0 +1,4 @@ +md5 picolibc-1.5.1.tar.xz e2221b038181ae0c9f7b0bd3b1353d9e +sha1 picolibc-1.5.1.tar.xz ad86b3f02fa7fc62563984f2c1a20ee8b4e566b9 +sha256 picolibc-1.5.1.tar.xz 06b34f34af4cef1be16e7d2e6de9f0c3aa9980dd7fd86c8b1b78331efbfa9db6 +sha512 picolibc-1.5.1.tar.xz 882ad8a20ab6dd8816a8b468834c3fcd66dd57f668f9fcb53e92b99c643377e15df2c37e80f6212c82d4ec63320575e0f7158c071edf5d8f66bb58aa4eecfd24 diff --git a/packages/picolibc/1.5/version.desc b/packages/picolibc/1.5.1/version.desc similarity index 100% rename from packages/picolibc/1.5/version.desc rename to packages/picolibc/1.5.1/version.desc diff --git a/packages/picolibc/1.5/chksum b/packages/picolibc/1.5/chksum deleted file mode 100644 index c5240fb0..00000000 --- a/packages/picolibc/1.5/chksum +++ /dev/null @@ -1,4 +0,0 @@ -md5 picolibc-1.5.tar.xz f883ccdb907f13bd79ccecb6b677cc99 -sha1 picolibc-1.5.tar.xz 549b03479feab74042c58ca5903f2a5fd63dca65 -sha256 picolibc-1.5.tar.xz 88bd1b6e050145e285cb61c8cf4ce75714a8eb5d80cf89d0d0edc4f3fa067db1 -sha512 picolibc-1.5.tar.xz 7f50bc4bc7d8dbfb6feba09eee896918f5ac8b57d27c2d8158f17dc7d6778b80798c87edee92cf20d27b1dd2b3d1bfb157cfd9084019fdb7a6173ef959f03a92 diff --git a/packages/picolibc/1.6.2/chksum b/packages/picolibc/1.6.2/chksum new file mode 100644 index 00000000..34fc8f37 --- /dev/null +++ b/packages/picolibc/1.6.2/chksum @@ -0,0 +1,4 @@ +md5 picolibc-1.6.2.tar.xz 12a90c1886fff1b3169e16e005396160 +sha1 picolibc-1.6.2.tar.xz 88e3aae511cbf86a7f095dfe387a0c5618fd697c +sha256 picolibc-1.6.2.tar.xz d2bd17409f11e7c3bf72c4c244244e70e2086c640e700a7800c7fa3513cd9c4d +sha512 picolibc-1.6.2.tar.xz 64ca47814c60e873989adc6ec33bfd94877ed78537a858f15f5795b0a5896a80fd900a2d54d6ad3241ef3da56b423181dc56fe4fa105951196ec71d0e0c6ece2 diff --git a/packages/picolibc/1.6.2/version.desc b/packages/picolibc/1.6.2/version.desc new file mode 100644 index 00000000..e69de29b diff --git a/packages/picolibc/package.desc b/packages/picolibc/package.desc index 00b3ee0a..63d89c98 100644 --- a/packages/picolibc/package.desc +++ b/packages/picolibc/package.desc @@ -1,6 +1,6 @@ origin='keithp.com' repository='git https://github.com/picolibc/picolibc.git' -milestones='1.4.7' +milestones='1.4 1.5 1.6' relevantpattern='*.*|.*. *.*|.' archive_formats='.tar.xz' mirrors='https://github.com/picolibc/picolibc/releases/download/${CT_PICOLIBC_VERSION}'