From a2ef08027fbc268cde2d6985ab724e38af450cae Mon Sep 17 00:00:00 2001 From: Chris Packham Date: Fri, 6 Jun 2025 10:07:22 +1200 Subject: gcc: Add GCC 13.4.0 https://gcc.gnu.org/pipermail/gcc-announce/2025/000187.html Signed-off-by: Chris Packham --- .../0000-libtool-leave-framework-alone.patch | 18 -- ...001-gcc-plugin-POSIX-include-sys-select-h.patch | 14 - .../gcc/13.3.0/0002-arm-softfloat-libgcc.patch | 31 -- ...0003-libgcc-disable-split-stack-nothreads.patch | 17 - ...Remove-use-of-include_next-from-c-headers.patch | 304 ------------------ ...default-libc-to-be-specified-to-configure.patch | 138 -------- ...nd-getenv-function-to-allow-default-value.patch | 99 ------ ...and-picolibc-as-default-C-library-choices.patch | 39 --- .../gcc/13.3.0/0008-Support-picolibc-targets.patch | 35 --- ...-gcc-Allow-g-to-work-differently-from-gcc.patch | 65 ---- ...010-RISC-V-fix-build-issue-with-gcc-4.9.x.patch | 43 --- ...011-Remove-crypt-and-crypt_r-interceptors.patch | 138 -------- .../0012-libgcc-m68k-Fixes-for-soft-float.patch | 349 --------------------- ...cc-Exclude-UCLIBC-from-GLIBC-thread-check.patch | 32 -- ...se-lib-instead-of-lib64-as-the-library-se.patch | 77 ----- packages/gcc/13.3.0/chksum | 8 - ...d-custom-spec-file-fragments-for-using-pi.patch | 127 -------- packages/gcc/13.3.0/version.desc | 0 .../0000-libtool-leave-framework-alone.patch | 18 ++ ...001-gcc-plugin-POSIX-include-sys-select-h.patch | 14 + .../gcc/13.4.0/0002-arm-softfloat-libgcc.patch | 31 ++ ...0003-libgcc-disable-split-stack-nothreads.patch | 17 + ...Remove-use-of-include_next-from-c-headers.patch | 304 ++++++++++++++++++ ...default-libc-to-be-specified-to-configure.patch | 138 ++++++++ ...nd-getenv-function-to-allow-default-value.patch | 99 ++++++ ...and-picolibc-as-default-C-library-choices.patch | 39 +++ .../gcc/13.4.0/0008-Support-picolibc-targets.patch | 35 +++ ...-gcc-Allow-g-to-work-differently-from-gcc.patch | 65 ++++ ...010-RISC-V-fix-build-issue-with-gcc-4.9.x.patch | 43 +++ ...011-Remove-crypt-and-crypt_r-interceptors.patch | 138 ++++++++ .../0012-libgcc-m68k-Fixes-for-soft-float.patch | 349 +++++++++++++++++++++ ...cc-Exclude-UCLIBC-from-GLIBC-thread-check.patch | 32 ++ ...se-lib-instead-of-lib64-as-the-library-se.patch | 77 +++++ packages/gcc/13.4.0/chksum | 8 + ...d-custom-spec-file-fragments-for-using-pi.patch | 127 ++++++++ packages/gcc/13.4.0/version.desc | 0 36 files changed, 1534 insertions(+), 1534 deletions(-) delete mode 100644 packages/gcc/13.3.0/0000-libtool-leave-framework-alone.patch delete mode 100644 packages/gcc/13.3.0/0001-gcc-plugin-POSIX-include-sys-select-h.patch delete mode 100644 packages/gcc/13.3.0/0002-arm-softfloat-libgcc.patch delete mode 100644 packages/gcc/13.3.0/0003-libgcc-disable-split-stack-nothreads.patch delete mode 100644 packages/gcc/13.3.0/0004-Remove-use-of-include_next-from-c-headers.patch delete mode 100644 packages/gcc/13.3.0/0005-Allow-default-libc-to-be-specified-to-configure.patch delete mode 100644 packages/gcc/13.3.0/0006-driver-Extend-getenv-function-to-allow-default-value.patch delete mode 100644 packages/gcc/13.3.0/0007-Add-newlib-and-picolibc-as-default-C-library-choices.patch delete mode 100644 packages/gcc/13.3.0/0008-Support-picolibc-targets.patch delete mode 100644 packages/gcc/13.3.0/0009-gcc-Allow-g-to-work-differently-from-gcc.patch delete mode 100644 packages/gcc/13.3.0/0010-RISC-V-fix-build-issue-with-gcc-4.9.x.patch delete mode 100644 packages/gcc/13.3.0/0011-Remove-crypt-and-crypt_r-interceptors.patch delete mode 100644 packages/gcc/13.3.0/0012-libgcc-m68k-Fixes-for-soft-float.patch delete mode 100644 packages/gcc/13.3.0/0013-libgcc-Exclude-UCLIBC-from-GLIBC-thread-check.patch delete mode 100644 packages/gcc/13.3.0/0014-LoongArch-Use-lib-instead-of-lib64-as-the-library-se.patch delete mode 100644 packages/gcc/13.3.0/chksum delete mode 100644 packages/gcc/13.3.0/experimental/0001-picolibc-Add-custom-spec-file-fragments-for-using-pi.patch delete mode 100644 packages/gcc/13.3.0/version.desc create mode 100644 packages/gcc/13.4.0/0000-libtool-leave-framework-alone.patch create mode 100644 packages/gcc/13.4.0/0001-gcc-plugin-POSIX-include-sys-select-h.patch create mode 100644 packages/gcc/13.4.0/0002-arm-softfloat-libgcc.patch create mode 100644 packages/gcc/13.4.0/0003-libgcc-disable-split-stack-nothreads.patch create mode 100644 packages/gcc/13.4.0/0004-Remove-use-of-include_next-from-c-headers.patch create mode 100644 packages/gcc/13.4.0/0005-Allow-default-libc-to-be-specified-to-configure.patch create mode 100644 packages/gcc/13.4.0/0006-driver-Extend-getenv-function-to-allow-default-value.patch create mode 100644 packages/gcc/13.4.0/0007-Add-newlib-and-picolibc-as-default-C-library-choices.patch create mode 100644 packages/gcc/13.4.0/0008-Support-picolibc-targets.patch create mode 100644 packages/gcc/13.4.0/0009-gcc-Allow-g-to-work-differently-from-gcc.patch create mode 100644 packages/gcc/13.4.0/0010-RISC-V-fix-build-issue-with-gcc-4.9.x.patch create mode 100644 packages/gcc/13.4.0/0011-Remove-crypt-and-crypt_r-interceptors.patch create mode 100644 packages/gcc/13.4.0/0012-libgcc-m68k-Fixes-for-soft-float.patch create mode 100644 packages/gcc/13.4.0/0013-libgcc-Exclude-UCLIBC-from-GLIBC-thread-check.patch create mode 100644 packages/gcc/13.4.0/0014-LoongArch-Use-lib-instead-of-lib64-as-the-library-se.patch create mode 100644 packages/gcc/13.4.0/chksum create mode 100644 packages/gcc/13.4.0/experimental/0001-picolibc-Add-custom-spec-file-fragments-for-using-pi.patch create mode 100644 packages/gcc/13.4.0/version.desc (limited to 'packages/gcc') diff --git a/packages/gcc/13.3.0/0000-libtool-leave-framework-alone.patch b/packages/gcc/13.3.0/0000-libtool-leave-framework-alone.patch deleted file mode 100644 index 1a86e415..00000000 --- a/packages/gcc/13.3.0/0000-libtool-leave-framework-alone.patch +++ /dev/null @@ -1,18 +0,0 @@ ---- - libtool-ldflags | 5 +++++ - 1 file changed, 5 insertions(+) - ---- a/libtool-ldflags -+++ b/libtool-ldflags -@@ -36,6 +36,11 @@ - for arg - do - case $arg in -+ -framework) -+ # libtool handles this option. It should not be prefixed with -+ # -Xcompiler, as that would split it from the argument that -+ # follows. -+ ;; - -f*|--*|-static-lib*|-shared-lib*|-B*) - # Libtool does not ascribe any special meaning options - # that begin with -f or with a double-dash. So, it will diff --git a/packages/gcc/13.3.0/0001-gcc-plugin-POSIX-include-sys-select-h.patch b/packages/gcc/13.3.0/0001-gcc-plugin-POSIX-include-sys-select-h.patch deleted file mode 100644 index 5f9a07a2..00000000 --- a/packages/gcc/13.3.0/0001-gcc-plugin-POSIX-include-sys-select-h.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- - libcc1/connection.cc | 1 + - 1 file changed, 1 insertion(+) - ---- a/libcc1/connection.cc -+++ b/libcc1/connection.cc -@@ -21,6 +21,7 @@ - #include - #include - #include -+#include - #include - #include - #include "marshall.hh" diff --git a/packages/gcc/13.3.0/0002-arm-softfloat-libgcc.patch b/packages/gcc/13.3.0/0002-arm-softfloat-libgcc.patch deleted file mode 100644 index d9800365..00000000 --- a/packages/gcc/13.3.0/0002-arm-softfloat-libgcc.patch +++ /dev/null @@ -1,31 +0,0 @@ ---- - gcc/config/arm/linux-elf.h | 2 +- - libgcc/config/arm/t-linux | 7 ++++++- - 2 files changed, 7 insertions(+), 2 deletions(-) - ---- a/gcc/config/arm/linux-elf.h -+++ b/gcc/config/arm/linux-elf.h -@@ -58,7 +58,7 @@ - %{shared:-lc} \ - %{!shared:%{profile:-lc_p}%{!profile:-lc}}" - --#define LIBGCC_SPEC "%{mfloat-abi=soft*:-lfloat} -lgcc" -+#define LIBGCC_SPEC "-lgcc" - - #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2" - ---- a/libgcc/config/arm/t-linux -+++ b/libgcc/config/arm/t-linux -@@ -1,6 +1,11 @@ - LIB1ASMSRC = arm/lib1funcs.S - LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx _clzsi2 _clzdi2 \ -- _ctzsi2 _arm_addsubdf3 _arm_addsubsf3 -+ _ctzsi2 _arm_addsubdf3 _arm_addsubsf3 \ -+ _arm_addsubdf3 _arm_addsubsf3 \ -+ _arm_negdf2 _arm_muldivdf3 _arm_cmpdf2 _arm_unorddf2 \ -+ _arm_fixdfsi _arm_fixunsdfsi _arm_truncdfsf2 \ -+ _arm_negsf2 _arm_muldivsf3 _arm_cmpsf2 _arm_unordsf2 \ -+ _arm_fixsfsi _arm_fixunssfsi - - # Just for these, we omit the frame pointer since it makes such a big - # difference. diff --git a/packages/gcc/13.3.0/0003-libgcc-disable-split-stack-nothreads.patch b/packages/gcc/13.3.0/0003-libgcc-disable-split-stack-nothreads.patch deleted file mode 100644 index df91a9ff..00000000 --- a/packages/gcc/13.3.0/0003-libgcc-disable-split-stack-nothreads.patch +++ /dev/null @@ -1,17 +0,0 @@ -disable split-stack for non-thread builds - -Signed-off-by: Waldemar Brodkorb - ---- - libgcc/config/t-stack | 2 ++ - 1 file changed, 2 insertions(+) - ---- a/libgcc/config/t-stack -+++ b/libgcc/config/t-stack -@@ -1,4 +1,6 @@ - # Makefile fragment to provide generic support for -fsplit-stack. - # This should be used in config.host for any host which supports - # -fsplit-stack. -+ifeq ($(enable_threads),yes) - LIB2ADD_ST += $(srcdir)/generic-morestack.c $(srcdir)/generic-morestack-thread.c -+endif diff --git a/packages/gcc/13.3.0/0004-Remove-use-of-include_next-from-c-headers.patch b/packages/gcc/13.3.0/0004-Remove-use-of-include_next-from-c-headers.patch deleted file mode 100644 index e079849a..00000000 --- a/packages/gcc/13.3.0/0004-Remove-use-of-include_next-from-c-headers.patch +++ /dev/null @@ -1,304 +0,0 @@ -From 6c7efd415ef2fa5d9f2d8bcd5b30e9faf696d5ca 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 c70c8e4edcfc..6a0d5307408a 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 abe013725b24..1df12c0af820 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 234008e328d3..3e259fbc75e9 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 39eb9bbe5d50..e2c2e67356f3 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 6d431e8b73ac..176b66b143c3 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 f58d3305dbdc..bd18e7a3b046 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 e498a711b8df..05ce7cec0e72 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 261c5cbafdba..3c536f5a0d56 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 1fd0c71eb722..2df49096ea23 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 ec8b4b5eef34..f5f04720d2a0 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 41752d96e552..f69f27e51fdc 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 c30a34d57d7b..2209bd6b7354 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 28032a2ec9fb..e94a5678bc71 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 473ae22f8840..c8bee71de315 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 4edc7d9bfdc7..5e8d79fcf189 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 2d478fe9beba..58a55bc18adc 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 0ef94430b6f1..a91c7a68ca8a 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 8ccc117792bb..6111ad108a79 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 07c02e562b02..63b76873532e 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 992713b70da6..165d87f65f7f 100644 ---- a/libstdc++-v3/include/c_global/cmath -+++ b/libstdc++-v3/include/c_global/cmath -@@ -44,7 +44,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 aeb961ad69df..a2c661acd243 100644 ---- a/libstdc++-v3/include/c_global/cstdlib -+++ b/libstdc++-v3/include/c_global/cstdlib -@@ -76,7 +76,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 - diff --git a/packages/gcc/13.3.0/0005-Allow-default-libc-to-be-specified-to-configure.patch b/packages/gcc/13.3.0/0005-Allow-default-libc-to-be-specified-to-configure.patch deleted file mode 100644 index a56f02ad..00000000 --- a/packages/gcc/13.3.0/0005-Allow-default-libc-to-be-specified-to-configure.patch +++ /dev/null @@ -1,138 +0,0 @@ -From bba1f4101084e296e5bfcc9a2f9e91242928ad10 Mon Sep 17 00:00:00 2001 -From: Keith Packard -Date: Fri, 2 Sep 2022 23:07:05 -0700 -Subject: [PATCH] Allow default libc to be specified to configure - -The default C library is normally computed based on the target -triplet. However, for embedded systems, it can be useful to leave the -triplet alone while changing which C library is used by default. Other -C libraries may still be available on the system so the compiler and -can be used by specifying suitable include and library paths at build -time. - -If an unknown --with-default-libc= value is provided, emit an error -and stop. - -Signed-off-by: Keith Packard ---- - gcc/config.gcc | 48 ++++++++++++++++++++++++++++++++++++++++-------- - gcc/configure.ac | 4 ++++ - 2 files changed, 44 insertions(+), 8 deletions(-) - -diff --git a/gcc/config.gcc b/gcc/config.gcc -index c3b73d05eb72..0672d94535b9 100644 ---- a/gcc/config.gcc -+++ b/gcc/config.gcc -@@ -664,6 +664,8 @@ esac - # Common C libraries. - tm_defines="$tm_defines LIBC_GLIBC=1 LIBC_UCLIBC=2 LIBC_BIONIC=3 LIBC_MUSL=4" - -+default_libc="" -+ - # 32-bit x86 processors supported by --with-arch=. Each processor - # MUST be separated by exactly one space. - x86_archs="athlon athlon-4 athlon-fx athlon-mp athlon-tbird \ -@@ -870,16 +872,16 @@ case ${target} in - esac - case $target in - *-*-*android*) -- tm_defines="$tm_defines DEFAULT_LIBC=LIBC_BIONIC" -+ default_libc=LIBC_BIONIC - ;; - *-*-*uclibc* | *-*-uclinuxfdpiceabi) -- tm_defines="$tm_defines DEFAULT_LIBC=LIBC_UCLIBC" -+ default_libc=LIBC_UCLIBC - ;; - *-*-*musl*) -- tm_defines="$tm_defines DEFAULT_LIBC=LIBC_MUSL" -+ default_libc=LIBC_MUSL - ;; - *) -- tm_defines="$tm_defines DEFAULT_LIBC=LIBC_GLIBC" -+ default_libc=LIBC_GLIBC - ;; - esac - # Assume that glibc or uClibc or Bionic are being used and so __cxa_atexit -@@ -988,7 +990,8 @@ case ${target} in - case ${enable_threads} in - "" | yes | posix) thread_file='posix' ;; - esac -- tm_defines="$tm_defines DEFAULT_LIBC=LIBC_UCLIBC SINGLE_LIBC" -+ tm_defines="$tm_defines SINGLE_LIBC" -+ default_libc=LIBC_UCLIBC - ;; - *-*-rdos*) - use_gcc_stdint=wrap -@@ -1653,13 +1656,13 @@ csky-*-*) - - case ${target} in - csky-*-linux-gnu*) -- tm_defines="$tm_defines DEFAULT_LIBC=LIBC_GLIBC" -+ default_libc=LIBC_GLIBC - # Force .init_array support. The configure script cannot always - # automatically detect that GAS supports it, yet we require it. - gcc_cv_initfini_array=yes - ;; - csky-*-linux-uclibc*) -- tm_defines="$tm_defines DEFAULT_LIBC=LIBC_UCLIBC" -+ default_libc=LIBC_UCLIBC - default_use_cxa_atexit=no - ;; - *) -@@ -3039,7 +3042,7 @@ powerpc*-wrs-vxworks7r*) - tmake_file="${tmake_file} t-linux rs6000/t-linux64 rs6000/t-fprules rs6000/t-ppccomm" - tmake_file="${tmake_file} rs6000/t-vxworks" - -- tm_defines="$tm_defines DEFAULT_LIBC=LIBC_GLIBC" -+ default_libc=LIBC_GLIBC - extra_objs="$extra_objs linux.o rs6000-linux.o" - ;; - powerpc-wrs-vxworks*) -@@ -5880,3 +5883,32 @@ i[34567]86-*-* | x86_64-*-*) - fi - ;; - esac -+ -+case "${with_default_libc}" in -+glibc) -+ default_libc=LIBC_GLIBC -+ ;; -+uclibc) -+ default_libc=LIBC_UCLIBC -+ ;; -+bionic) -+ default_libc=LIBC_BIONIC -+ ;; -+musl) -+ default_libc=LIBC_MUSL -+ ;; -+"") -+ ;; -+*) -+ echo "Unknown libc in --with-default-libc=$with_default_libc" 1>&2 -+ exit 1 -+ ;; -+esac -+ -+case "$default_libc" in -+"") -+ ;; -+*) -+ tm_defines="$tm_defines DEFAULT_LIBC=$default_libc" -+ ;; -+esac -diff --git a/gcc/configure.ac b/gcc/configure.ac -index bf8ff4d63906..b1c2944775d1 100644 ---- a/gcc/configure.ac -+++ b/gcc/configure.ac -@@ -2541,6 +2541,10 @@ if { { test x$host != x$target && test "x$with_sysroot" = x ; } || - fi - AC_SUBST(inhibit_libc) - -+AC_ARG_WITH(default-libc, -+ [AS_HELP_STRING([--with-default-libc], -+ [Use specified default C library])]) -+ - # When building gcc with a cross-compiler, we need to adjust things so - # that the generator programs are still built with the native compiler. - # Also, we cannot run fixincludes. diff --git a/packages/gcc/13.3.0/0006-driver-Extend-getenv-function-to-allow-default-value.patch b/packages/gcc/13.3.0/0006-driver-Extend-getenv-function-to-allow-default-value.patch deleted file mode 100644 index e7813e7b..00000000 --- a/packages/gcc/13.3.0/0006-driver-Extend-getenv-function-to-allow-default-value.patch +++ /dev/null @@ -1,99 +0,0 @@ -From ba5bf3a67e74c05231d85ee44c757b3a7391f292 Mon Sep 17 00:00:00 2001 -From: Keith Packard -Date: Fri, 26 Aug 2022 14:30:03 -0700 -Subject: [PATCH] driver: Extend 'getenv' function to allow default value - -Right now, a missing environment variable provided to the 'getenv' -function in a .specs file causes a fatal error. That makes writing a -spec file that uses the GCC_EXEC_PREFIX value difficult as that -variable is only set when the driver has been relocated, but not when -run from the defined location. This makes building a relocatable -toolchain difficult to extend to other ancilary pieces which use specs -files to locate header and library files adjacent to the toolchain. - -This patch adds an optional third argument to the getenv function that -can be used to fall back to the standard installation path when the -driver hasn't set GCC_EXEC_PREFIX in the environment. - -For example, if an alternate C library is installed in -${prefix}/extra, then this change allows the specs file to locate that -relative to the gcc directory, if gcc is located in the original -installation directory (which would leave GCC_EXEC_PREFIX unset), or -if the gcc tree has been moved to a different location (where gcc -would set GCC_EXEC_PREFIX itself): - -*cpp: --isystem %:getenv(GCC_EXEC_PREFIX ../../extra/include ${prefix}/extra/include) - -I considered changing the behavior of either the %R sequence so that -it had a defined behavior when there was no sysroot defined, or making -the driver always set the GCC_EXEC_PREFIX environment variable and -decided that the approach of adding functionality to getenv where it -was previously invalid would cause the least potential for affecting -existing usage. - -Signed-off-by: Keith Packard ---- - gcc/doc/invoke.texi | 18 +++++++++++------- - gcc/gcc.cc | 10 +++++++++- - 2 files changed, 20 insertions(+), 8 deletions(-) - -diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi -index 792ce283bb98..21b89c86acf9 100644 ---- a/gcc/doc/invoke.texi -+++ b/gcc/doc/invoke.texi -@@ -34866,17 +34866,21 @@ The following built-in spec functions are provided: - - @table @code - @item @code{getenv} --The @code{getenv} spec function takes two arguments: an environment --variable name and a string. If the environment variable is not --defined, a fatal error is issued. Otherwise, the return value is the --value of the environment variable concatenated with the string. For --example, if @env{TOPDIR} is defined as @file{/path/to/top}, then: -+ -+The @code{getenv} spec function takes two or three arguments: an -+environment variable name, a string and an optional default value. If -+the environment variable is not defined and a default value is -+provided, that is used as the return value; otherwise a fatal error is -+issued. Otherwise, the return value is the value of the environment -+variable concatenated with the string. For example, if @env{TOPDIR} -+is defined as @file{/path/to/top}, then: - - @smallexample --%:getenv(TOPDIR /include) -+%:getenv(TOPDIR /include /path/to/default/include) - @end smallexample - --expands to @file{/path/to/top/include}. -+expands to @file{/path/to/top/include}. If @env{TOPDIR} is not -+defined, then this expands to @file{/path/to/default/include}. - - @item @code{if-exists} - The @code{if-exists} spec function takes one argument, an absolute -diff --git a/gcc/gcc.cc b/gcc/gcc.cc -index 16bb07f2cdc5..a94da302b85b 100644 ---- a/gcc/gcc.cc -+++ b/gcc/gcc.cc -@@ -10155,12 +10155,20 @@ getenv_spec_function (int argc, const char **argv) - char *ptr; - size_t len; - -- if (argc != 2) -+ if (argc != 2 && argc != 3) - return NULL; - - varname = argv[0]; - value = env.get (varname); - -+ if (!value && argc == 3) -+ { -+ value = argv[2]; -+ result = XNEWVAR(char, strlen(value) + 1); -+ strcpy(result, value); -+ return result; -+ } -+ - /* If the variable isn't defined and this is allowed, craft our expected - return value. Assume variable names used in specs strings don't contain - any active spec character so don't need escaping. */ diff --git a/packages/gcc/13.3.0/0007-Add-newlib-and-picolibc-as-default-C-library-choices.patch b/packages/gcc/13.3.0/0007-Add-newlib-and-picolibc-as-default-C-library-choices.patch deleted file mode 100644 index fadbdac2..00000000 --- a/packages/gcc/13.3.0/0007-Add-newlib-and-picolibc-as-default-C-library-choices.patch +++ /dev/null @@ -1,39 +0,0 @@ -From f4b206863407055fc58956be171e2066e941328f Mon Sep 17 00:00:00 2001 -From: Keith Packard -Date: Tue, 23 Aug 2022 22:12:06 -0700 -Subject: [PATCH] Add newlib and picolibc as default C library choices - -Signed-off-by: Keith Packard ---- - gcc/config.gcc | 11 ++++++++++- - 1 file changed, 10 insertions(+), 1 deletion(-) - -diff --git a/gcc/config.gcc b/gcc/config.gcc -index 0672d94535b9..b02bd46c231e 100644 ---- a/gcc/config.gcc -+++ b/gcc/config.gcc -@@ -662,7 +662,7 @@ case ${target} in - esac - - # Common C libraries. --tm_defines="$tm_defines LIBC_GLIBC=1 LIBC_UCLIBC=2 LIBC_BIONIC=3 LIBC_MUSL=4" -+tm_defines="$tm_defines LIBC_GLIBC=1 LIBC_UCLIBC=2 LIBC_BIONIC=3 LIBC_MUSL=4 LIBC_NEWLIB=5 LIBC_PICOLIBC=6" - - default_libc="" - -@@ -5897,6 +5897,15 @@ bionic) - musl) - default_libc=LIBC_MUSL - ;; -+newlib) -+ # Newlib configurations don't set the DEFAULT_LIBC variable, so -+ # avoid changing those by allowing --with-default-libc=newlib but -+ # not actually setting the DEFAULT_LIBC variable. -+ default_libc= -+ ;; -+picolibc) -+ default_libc=LIBC_PICOLIBC -+ ;; - "") - ;; - *) diff --git a/packages/gcc/13.3.0/0008-Support-picolibc-targets.patch b/packages/gcc/13.3.0/0008-Support-picolibc-targets.patch deleted file mode 100644 index 754bd576..00000000 --- a/packages/gcc/13.3.0/0008-Support-picolibc-targets.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 1d1d77a6b0272cc3ee0ec18f0e7adc909d4572db Mon Sep 17 00:00:00 2001 -From: Keith Packard -Date: Sun, 12 Feb 2023 14:23:32 -0800 -Subject: [PATCH] Support picolibc targets - -Match *-picolibc-* and select picolibc as the default C library, plus continuing to use -the newlib-based logic for other configuration items. - -Signed-off-by: Keith Packard ---- - gcc/config.gcc | 11 +++++++++++ - 1 file changed, 11 insertions(+) - -diff --git a/gcc/config.gcc b/gcc/config.gcc -index b02bd46c231e..4f3bcd24edfa 100644 ---- a/gcc/config.gcc -+++ b/gcc/config.gcc -@@ -1116,6 +1116,17 @@ case ${target} in - ;; - esac - ;; -+*-picolibc-*) -+ # __cxa_atexit is provided. -+ default_use_cxa_atexit=yes -+ use_gcc_stdint=wrap -+ default_libc=LIBC_PICOLIBC -+ case "${with_newlib}-${with_headers}" in -+ no-no) use_gcc_stdint=provide ;; -+ *) ;; -+ esac -+ ;; -+ - *-*-elf|arc*-*-elf*) - # Assume that newlib is being used and so __cxa_atexit is provided. - default_use_cxa_atexit=yes diff --git a/packages/gcc/13.3.0/0009-gcc-Allow-g-to-work-differently-from-gcc.patch b/packages/gcc/13.3.0/0009-gcc-Allow-g-to-work-differently-from-gcc.patch deleted file mode 100644 index 9cded7c2..00000000 --- a/packages/gcc/13.3.0/0009-gcc-Allow-g-to-work-differently-from-gcc.patch +++ /dev/null @@ -1,65 +0,0 @@ -From a89f0a31d778fb8c82fd75f6e0578b2702e6f473 Mon Sep 17 00:00:00 2001 -From: Keith Packard -Date: Sat, 11 Feb 2023 23:07:08 -0800 -Subject: [PATCH] gcc: Allow g++ to work differently from gcc - -Compile gcc.cc with -DIN_GPP defined when building g++ so that the -code can respond appropriately for the default target language. This -allows the driver to customize the specs used, selecting different -linker scripts, adjusting the use of crtbegin.o/crtend.o etc. - -By default, this change has no effect; targets need to explicitly -check for IN_GPP to have alternate behavior. - -Signed-off-by: Keith Packard ---- - gcc/cp/Make-lang.in | 7 ++++++- - gcc/gpp.cc | 21 +++++++++++++++++++++ - 2 files changed, 27 insertions(+), 1 deletion(-) - create mode 100644 gcc/gpp.cc - -diff --git a/gcc/cp/Make-lang.in b/gcc/cp/Make-lang.in -index 4ee26fad93d6..e707fe512013 100644 ---- a/gcc/cp/Make-lang.in -+++ b/gcc/cp/Make-lang.in -@@ -77,7 +77,12 @@ CFLAGS-cp/module.o += -DMODULE_VERSION='$(shell cat s-cp-module-version)' - endif - - # Create the compiler driver for g++. --GXX_OBJS = $(GCC_OBJS) cp/g++spec.o -+GXX_OBJS = $(GCC_OBJS:gcc.o=gpp.o) cp/g++spec.o -+ -+CFLAGS-gpp.o = $(CFLAGS-gcc.o) -+gpp.o: $(BASEVER) -+gpp.o: gcc.o -+ - xg++$(exeext): $(GXX_OBJS) $(EXTRA_GCC_OBJS) libcommon-target.a $(LIBDEPS) - +$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ \ - $(GXX_OBJS) $(EXTRA_GCC_OBJS) libcommon-target.a \ -diff --git a/gcc/gpp.cc b/gcc/gpp.cc -new file mode 100644 -index 000000000000..3cd7b45e8086 ---- /dev/null -+++ b/gcc/gpp.cc -@@ -0,0 +1,21 @@ -+/* Compiler driver program that can handle many languages. -+ Copyright (C) 1987-2022 Free Software Foundation, Inc. -+ -+This file is part of GCC. -+ -+GCC is free software; you can redistribute it and/or modify it under -+the terms of the GNU General Public License as published by the Free -+Software Foundation; either version 3, or (at your option) any later -+version. -+ -+GCC is distributed in the hope that it will be useful, but WITHOUT ANY -+WARRANTY; without even the implied warranty of MERCHANTABILITY or -+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -+for more details. -+ -+You should have received a copy of the GNU General Public License -+along with GCC; see the file COPYING3. If not see -+. */ -+ -+#define IN_GPP -+#include "gcc.cc" diff --git a/packages/gcc/13.3.0/0010-RISC-V-fix-build-issue-with-gcc-4.9.x.patch b/packages/gcc/13.3.0/0010-RISC-V-fix-build-issue-with-gcc-4.9.x.patch deleted file mode 100644 index 86d86b14..00000000 --- a/packages/gcc/13.3.0/0010-RISC-V-fix-build-issue-with-gcc-4.9.x.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 9d6bdc5cc6f02eebc02bfd5d5da0669b42e1087c Mon Sep 17 00:00:00 2001 -From: Romain Naour -Date: Tue, 2 May 2023 14:21:55 +0200 -Subject: [PATCH] RISC-V: fix build issue with gcc 4.9.x - -GCC should still build with GCC 4.8.3 or newer [1] -using C++03 by default. But a recent change in -RISC-V port introduced a C++11 feature "std::log2" [2]. - -Use log2 from the C header, without the namespace [3]. - -[1] https://gcc.gnu.org/install/prerequisites.html -[2] https://gcc.gnu.org/git/?p=gcc.git;a=patch;h=7caa1ae5e451e780fbc4746a54e3f19d4f4304dc -[3] https://stackoverflow.com/questions/26733413/error-log2-is-not-a-member-of-std - -Fixes: -https://gitlab.com/buildroot.org/toolchains-builder/-/jobs/4202276589 - -gcc/ChangeLog: - * config/riscv/genrvv-type-indexer.cc: Use log2 from the C header, without - the namespace. - -Signed-off-by: Romain Naour ---- - gcc/config/riscv/genrvv-type-indexer.cc | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/gcc/config/riscv/genrvv-type-indexer.cc b/gcc/config/riscv/genrvv-type-indexer.cc -index e677b55290c6..eebe382d1c34 100644 ---- a/gcc/config/riscv/genrvv-type-indexer.cc -+++ b/gcc/config/riscv/genrvv-type-indexer.cc -@@ -115,9 +115,9 @@ same_ratio_eew_type (unsigned sew, int lmul_log2, unsigned eew, bool unsigned_p, - if (sew == eew) - elmul_log2 = lmul_log2; - else if (sew > eew) -- elmul_log2 = lmul_log2 - std::log2 (sew / eew); -+ elmul_log2 = lmul_log2 - log2 (sew / eew); - else /* sew < eew */ -- elmul_log2 = lmul_log2 + std::log2 (eew / sew); -+ elmul_log2 = lmul_log2 + log2 (eew / sew); - - if (float_p) - return floattype (eew, elmul_log2); diff --git a/packages/gcc/13.3.0/0011-Remove-crypt-and-crypt_r-interceptors.patch b/packages/gcc/13.3.0/0011-Remove-crypt-and-crypt_r-interceptors.patch deleted file mode 100644 index 4cc71959..00000000 --- a/packages/gcc/13.3.0/0011-Remove-crypt-and-crypt_r-interceptors.patch +++ /dev/null @@ -1,138 +0,0 @@ -From 4fa14369544f73508d97eacfda458f47ab59c595 Mon Sep 17 00:00:00 2001 -From: Fangrui Song -Date: Fri, 28 Apr 2023 09:59:17 -0700 -Subject: [PATCH] Remove crypt and crypt_r interceptors - -From Florian Weimer's D144073 - -> On GNU/Linux (glibc), the crypt and crypt_r functions are not part of the main shared object (libc.so.6), but libcrypt (with multiple possible sonames). The sanitizer libraries do not depend on libcrypt, so it can happen that during sanitizer library initialization, no real implementation will be found because the crypt, crypt_r functions are not present in the process image (yet). If its interceptors are called nevertheless, this results in a call through a null pointer when the sanitizer library attempts to forward the call to the real implementation. -> -> Many distributions have already switched to libxcrypt, a library that is separate from glibc and that can be build with sanitizers directly (avoiding the need for interceptors). This patch disables building the interceptor for glibc targets. - -Let's remove crypt and crypt_r interceptors (D68431) to fix issues with -newer glibc. - -For older glibc, msan will not know that an uninstrumented crypt_r call -initializes `data`, so there is a risk for false positives. However, with some -codebase survey, I think crypt_r uses are very few and the call sites typically -have a `memset(&data, 0, sizeof(data));` anyway. - -Fix https://github.com/google/sanitizers/issues/1365 -Related: https://bugzilla.redhat.com/show_bug.cgi?id=2169432 - -Reviewed By: #sanitizers, fweimer, thesamesam, vitalybuka - -Differential Revision: https://reviews.llvm.org/D149403 ---- - .../sanitizer_common_interceptors.inc | 37 ------------------- - .../sanitizer_platform_interceptors.h | 2 - - .../sanitizer_platform_limits_posix.cpp | 8 ---- - .../sanitizer_platform_limits_posix.h | 1 - - 4 files changed, 48 deletions(-) - -diff --git a/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc b/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc -index ba4b80081f0f..662c41997422 100644 ---- a/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc -+++ b/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc -@@ -10187,41 +10187,6 @@ INTERCEPTOR(SSIZE_T, getrandom, void *buf, SIZE_T buflen, unsigned int flags) { - #define INIT_GETRANDOM - #endif - --#if SANITIZER_INTERCEPT_CRYPT --INTERCEPTOR(char *, crypt, char *key, char *salt) { -- void *ctx; -- COMMON_INTERCEPTOR_ENTER(ctx, crypt, key, salt); -- COMMON_INTERCEPTOR_READ_RANGE(ctx, key, internal_strlen(key) + 1); -- COMMON_INTERCEPTOR_READ_RANGE(ctx, salt, internal_strlen(salt) + 1); -- char *res = REAL(crypt)(key, salt); -- if (res != nullptr) -- COMMON_INTERCEPTOR_INITIALIZE_RANGE(res, internal_strlen(res) + 1); -- return res; --} --#define INIT_CRYPT COMMON_INTERCEPT_FUNCTION(crypt); --#else --#define INIT_CRYPT --#endif -- --#if SANITIZER_INTERCEPT_CRYPT_R --INTERCEPTOR(char *, crypt_r, char *key, char *salt, void *data) { -- void *ctx; -- COMMON_INTERCEPTOR_ENTER(ctx, crypt_r, key, salt, data); -- COMMON_INTERCEPTOR_READ_RANGE(ctx, key, internal_strlen(key) + 1); -- COMMON_INTERCEPTOR_READ_RANGE(ctx, salt, internal_strlen(salt) + 1); -- char *res = REAL(crypt_r)(key, salt, data); -- if (res != nullptr) { -- COMMON_INTERCEPTOR_WRITE_RANGE(ctx, data, -- __sanitizer::struct_crypt_data_sz); -- COMMON_INTERCEPTOR_INITIALIZE_RANGE(res, internal_strlen(res) + 1); -- } -- return res; --} --#define INIT_CRYPT_R COMMON_INTERCEPT_FUNCTION(crypt_r); --#else --#define INIT_CRYPT_R --#endif -- - #if SANITIZER_INTERCEPT_GETENTROPY - INTERCEPTOR(int, getentropy, void *buf, SIZE_T buflen) { - void *ctx; -@@ -10772,8 +10737,6 @@ static void InitializeCommonInterceptors() { - INIT_GETUSERSHELL; - INIT_SL_INIT; - INIT_GETRANDOM; -- INIT_CRYPT; -- INIT_CRYPT_R; - INIT_GETENTROPY; - INIT_QSORT; - INIT_QSORT_R; -diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_interceptors.h b/libsanitizer/sanitizer_common/sanitizer_platform_interceptors.h -index 8307b1ec28bf..d50166ee6ce0 100644 ---- a/libsanitizer/sanitizer_common/sanitizer_platform_interceptors.h -+++ b/libsanitizer/sanitizer_common/sanitizer_platform_interceptors.h -@@ -571,8 +571,6 @@ - #define SANITIZER_INTERCEPT_FDEVNAME SI_FREEBSD - #define SANITIZER_INTERCEPT_GETUSERSHELL (SI_POSIX && !SI_ANDROID) - #define SANITIZER_INTERCEPT_SL_INIT (SI_FREEBSD || SI_NETBSD) --#define SANITIZER_INTERCEPT_CRYPT (SI_POSIX && !SI_ANDROID) --#define SANITIZER_INTERCEPT_CRYPT_R (SI_LINUX && !SI_ANDROID) - - #define SANITIZER_INTERCEPT_GETRANDOM \ - ((SI_LINUX && __GLIBC_PREREQ(2, 25)) || SI_FREEBSD) -diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp -index c85cf1626a75..bcbd143d19de 100644 ---- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp -+++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp -@@ -176,10 +176,6 @@ typedef struct user_fpregs elf_fpregset_t; - # include "sanitizer_platform_interceptors.h" - # include "sanitizer_platform_limits_posix.h" - --#if SANITIZER_INTERCEPT_CRYPT_R --#include --#endif -- - namespace __sanitizer { - unsigned struct_utsname_sz = sizeof(struct utsname); - unsigned struct_stat_sz = sizeof(struct stat); -@@ -283,10 +279,6 @@ namespace __sanitizer { - unsigned struct_statvfs64_sz = sizeof(struct statvfs64); - #endif // SANITIZER_LINUX && !SANITIZER_ANDROID - --#if SANITIZER_INTERCEPT_CRYPT_R -- unsigned struct_crypt_data_sz = sizeof(struct crypt_data); --#endif -- - #if SANITIZER_LINUX && !SANITIZER_ANDROID - unsigned struct_timex_sz = sizeof(struct timex); - unsigned struct_msqid_ds_sz = sizeof(struct msqid_ds); -diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h -index 44dd3d9e22d1..29ebb304a9ba 100644 ---- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h -+++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h -@@ -319,7 +319,6 @@ extern unsigned struct_msqid_ds_sz; - extern unsigned struct_mq_attr_sz; - extern unsigned struct_timex_sz; - extern unsigned struct_statvfs_sz; --extern unsigned struct_crypt_data_sz; - #endif // SANITIZER_LINUX && !SANITIZER_ANDROID - - struct __sanitizer_iovec { diff --git a/packages/gcc/13.3.0/0012-libgcc-m68k-Fixes-for-soft-float.patch b/packages/gcc/13.3.0/0012-libgcc-m68k-Fixes-for-soft-float.patch deleted file mode 100644 index caa6664a..00000000 --- a/packages/gcc/13.3.0/0012-libgcc-m68k-Fixes-for-soft-float.patch +++ /dev/null @@ -1,349 +0,0 @@ -From 51345476fc2f83c77736fab8e29ff4ac358d0f2e Mon Sep 17 00:00:00 2001 -From: Keith Packard -Date: Tue, 22 Aug 2023 12:28:53 -0700 -Subject: [PATCH] libgcc/m68k: Fixes for soft float - -Check for non-zero denorm in __adddf3. Need to check both the upper and -lower 32-bit chunks of a 64-bit float for a non-zero value when -checking to see if the value is -0. - -Fix __addsf3 when the sum exponent is exactly 0xff to ensure that -produces infinity and not nan. - -Handle converting NaN/inf values between formats. - -Handle underflow and overflow when truncating. - -Write a replacement for __fixxfsi so that it does not raise extra -exceptions during an extra conversion from long double to double. - -Return correctly signed zero on float and double divide underflow - -Return positive qNaN instead of negative. - -Signed-off-by: Keith Packard ---- - libgcc/config/m68k/fpgnulib.c | 170 +++++++++++++++++++++++++++------- - libgcc/config/m68k/lb1sf68.S | 20 ++-- - 2 files changed, 147 insertions(+), 43 deletions(-) - -diff --git a/libgcc/config/m68k/fpgnulib.c b/libgcc/config/m68k/fpgnulib.c -index fe41edf26aa0..eaa7858493c9 100644 ---- a/libgcc/config/m68k/fpgnulib.c -+++ b/libgcc/config/m68k/fpgnulib.c -@@ -54,6 +54,7 @@ - #define SIGNBIT 0x80000000L - #define HIDDEN (1L << 23L) - #define SIGN(fp) ((fp) & SIGNBIT) -+#define EXPMASK 0xFFL - #define EXP(fp) (((fp) >> 23L) & 0xFF) - #define MANT(fp) (((fp) & 0x7FFFFFL) | HIDDEN) - #define PACK(s,e,m) ((s) | ((e) << 23L) | (m)) -@@ -262,6 +263,9 @@ __extendsfdf2 (float a1) - mant &= ~HIDDEN; - } - exp = exp - EXCESS + EXCESSD; -+ /* Handle inf and NaN */ -+ if (exp == EXPMASK - EXCESS + EXCESSD) -+ exp = EXPDMASK; - dl.l.upper |= exp << 20; - dl.l.upper |= mant >> 3; - dl.l.lower = mant << 29; -@@ -295,40 +299,52 @@ __truncdfsf2 (double a1) - /* shift double mantissa 6 bits so we can round */ - sticky |= mant & ((1 << 6) - 1); - mant >>= 6; -- -- /* Check for underflow and denormals. */ -- if (exp <= 0) -+ if (exp == EXPDMASK - EXCESSD + EXCESS) - { -- if (exp < -24) -+ exp = EXPMASK; -+ mant = mant >> 1 | (mant & 1) | !!sticky; -+ } -+ else -+ { -+ /* Check for underflow and denormals. */ -+ if (exp <= 0) - { -- sticky |= mant; -+ if (exp < -24) -+ { -+ sticky |= mant; -+ mant = 0; -+ } -+ else -+ { -+ sticky |= mant & ((1 << (1 - exp)) - 1); -+ mant >>= 1 - exp; -+ } -+ exp = 0; -+ } -+ -+ /* now round */ -+ shift = 1; -+ if ((mant & 1) && (sticky || (mant & 2))) -+ { -+ int rounding = exp ? 2 : 1; -+ -+ mant += 1; -+ -+ /* did the round overflow? */ -+ if (mant >= (HIDDEN << rounding)) -+ { -+ exp++; -+ shift = rounding; -+ } -+ } -+ /* shift down */ -+ mant >>= shift; -+ if (exp >= EXPMASK) -+ { -+ exp = EXPMASK; - mant = 0; - } -- else -- { -- sticky |= mant & ((1 << (1 - exp)) - 1); -- mant >>= 1 - exp; -- } -- exp = 0; - } -- -- /* now round */ -- shift = 1; -- if ((mant & 1) && (sticky || (mant & 2))) -- { -- int rounding = exp ? 2 : 1; -- -- mant += 1; -- -- /* did the round overflow? */ -- if (mant >= (HIDDEN << rounding)) -- { -- exp++; -- shift = rounding; -- } -- } -- /* shift down */ -- mant >>= shift; - - mant &= ~HIDDEN; - -@@ -432,8 +448,31 @@ __extenddfxf2 (double d) - } - - exp = EXPD (dl) - EXCESSD + EXCESSX; -- ldl.l.upper |= exp << 16; -+ dl.l.upper &= MANTDMASK; - ldl.l.middle = HIDDENX; -+ -+ /* Recover from a denorm. */ -+ if (exp == -EXCESSD + EXCESSX) -+ { -+ exp++; -+ while ((dl.l.upper & HIDDEND) == 0) -+ { -+ exp--; -+ dl.l.upper = (dl.l.upper << 1) | (dl.l.lower >> 31); -+ dl.l.lower = dl.l.lower << 1; -+ } -+ } -+ -+ /* Handle inf and NaN */ -+ else if (exp == EXPDMASK - EXCESSD + EXCESSX) -+ { -+ exp = EXPXMASK; -+ /* No hidden one bit for INF */ -+ if (dl.l.upper == 0 && dl.l.lower == 0) -+ ldl.l.middle = 0; -+ } -+ -+ ldl.l.upper |= exp << 16; - /* 31-20: # mantissa bits in ldl.l.middle - # mantissa bits in dl.l.upper */ - ldl.l.middle |= (dl.l.upper & MANTDMASK) << (31 - 20); - /* 1+20: explicit-integer-bit + # mantissa bits in dl.l.upper */ -@@ -464,9 +503,38 @@ __truncxfdf2 (long double ld) - } - - exp = EXPX (ldl) - EXCESSX + EXCESSD; -- /* ??? quick and dirty: keep `exp' sane */ -- if (exp >= EXPDMASK) -- exp = EXPDMASK - 1; -+ /* Check for underflow and denormals. */ -+ if (exp <= 0) -+ { -+ if (exp < -53) -+ { -+ ldl.l.middle = 0; -+ ldl.l.lower = 0; -+ } -+ else if (exp < -30) -+ { -+ ldl.l.lower = (ldl.l.middle & MANTXMASK) >> ((1 - exp) - 32); -+ ldl.l.middle &= ~MANTXMASK; -+ } -+ else -+ { -+ ldl.l.lower >>= 1 - exp; -+ ldl.l.lower |= (ldl.l.middle & MANTXMASK) << (32 - (1 - exp)); -+ ldl.l.middle = (ldl.l.middle & ~MANTXMASK) | (ldl.l.middle & MANTXMASK >> (1 - exp)); -+ } -+ exp = 0; -+ } -+ else if (exp == EXPXMASK - EXCESSX + EXCESSD) -+ { -+ exp = EXPDMASK; -+ ldl.l.middle |= ldl.l.lower; -+ } -+ else if (exp >= EXPDMASK) -+ { -+ exp = EXPDMASK; -+ ldl.l.middle = 0; -+ ldl.l.lower = 0; -+ } - dl.l.upper |= exp << (32 - (EXPDBITS + 1)); - /* +1-1: add one for sign bit, but take one off for explicit-integer-bit */ - dl.l.upper |= (ldl.l.middle & MANTXMASK) >> (EXPDBITS + 1 - 1); -@@ -511,10 +579,40 @@ __floatunsixf (unsigned long l) - - /* convert a long double to an int */ - long --__fixxfsi (long double ld) -+__fixxfsi (long double a) - { -- long foo = __fixdfsi ((double) ld); -- return foo; -+ union long_double_long ldl; -+ long exp; -+ long l; -+ -+ ldl.ld = a; -+ -+ exp = EXPX(ldl); -+ if (exp == 0 && ldl.l.middle == 0 && ldl.l.lower == 0) -+ return 0; -+ -+ exp = exp - EXCESSX - 64; -+ -+ if (exp > 0) -+ { -+ /* Return largest integer. */ -+ return SIGNX (ldl) ? 0x80000000L : 0x7fffffffL; -+ } -+ -+ if (exp <= -64) -+ return 0; -+ -+ if (exp <= -32) -+ { -+ ldl.l.lower = ldl.l.middle >> (-exp - 32); -+ } -+ else if (exp < 0) -+ { -+ ldl.l.lower = ldl.l.lower >> -exp; -+ ldl.l.lower |= ldl.l.middle << (32 + exp); -+ } -+ -+ return SIGNX(ldl) ? -ldl.l.lower : ldl.l.lower; - } - - /* The remaining provide crude math support by working in double precision. */ -diff --git a/libgcc/config/m68k/lb1sf68.S b/libgcc/config/m68k/lb1sf68.S -index 8ba85c53656d..e12888bd7f89 100644 ---- a/libgcc/config/m68k/lb1sf68.S -+++ b/libgcc/config/m68k/lb1sf68.S -@@ -635,7 +635,7 @@ SYM (__modsi3): - .globl SYM (_fpCCR) - .globl $_exception_handler - --QUIET_NaN = 0xffffffff -+QUIET_NaN = 0x7fffffff - - D_MAX_EXP = 0x07ff - D_BIAS = 1022 -@@ -700,9 +700,10 @@ Ld$overflow: - PICJUMP $_exception_handler - - Ld$underflow: --| Return 0 and set the exception flags -+| Return a properly signed 0 and set the exception flags - movel IMM (0),d0 - movel d0,d1 -+ orl d7,d0 - movew IMM (INEXACT_RESULT+UNDERFLOW),d7 - moveq IMM (DOUBLE_FLOAT),d6 - PICJUMP $_exception_handler -@@ -711,6 +712,7 @@ Ld$inop: - | Return a quiet NaN and set the exception flags - movel IMM (QUIET_NaN),d0 - movel d0,d1 -+ bset IMM (31),d1 - movew IMM (INEXACT_RESULT+INVALID_OPERATION),d7 - moveq IMM (DOUBLE_FLOAT),d6 - PICJUMP $_exception_handler -@@ -1383,6 +1385,8 @@ Ladddf$a: - bge 2f | - movel d0,d0 | check for zero, since we don't ' - bne Ladddf$ret | want to return -0 by mistake -+ movel d1,d1 | -+ bne Ladddf$ret | - bclr IMM (31),d7 | - bra Ladddf$ret | - 2: -@@ -2080,6 +2084,7 @@ Ldivdf$b$nf: - | If d2 == 0x7ff00000 we have to check d3. - tstl d3 | - bne Ld$inop | if d3 <> 0, b is NaN -+ movel a0,d7 | put a's sign - bra Ld$underflow | else b is +/-INFINITY, so signal underflow - - Ldivdf$a$nf: -@@ -2090,8 +2095,7 @@ Ldivdf$a$nf: - | If a is INFINITY we have to check b - cmpl d7,d2 | compare b with INFINITY - bge Ld$inop | if b is NaN or INFINITY return NaN -- tstl d3 | -- bne Ld$inop | -+ movl a0,d7 | restore sign bit to d7 - bra Ld$overflow | else return overflow - - | If a number is denormalized we put an exponent of 1 but do not put the -@@ -2186,6 +2190,7 @@ Lround$exit: - #endif - beq 2f | if not loop back - bra 1b | -+ movel a0,d7 - bra Ld$underflow | safety check, shouldn't execute ' - 2: orl d6,d2 | this is a trick so we don't lose ' - orl d7,d3 | the bits which were flushed right -@@ -2548,7 +2553,7 @@ Lround$to$minus: - .globl SYM (_fpCCR) - .globl $_exception_handler - --QUIET_NaN = 0xffffffff -+QUIET_NaN = 0x7fffffff - SIGNL_NaN = 0x7f800001 - INFINITY = 0x7f800000 - -@@ -2614,8 +2619,9 @@ Lf$overflow: - PICJUMP $_exception_handler - - Lf$underflow: --| Return 0 and set the exception flags -+| Return a properly signed 0 and set the exception flags - moveq IMM (0),d0 -+ orl d7,d0 - moveq IMM (INEXACT_RESULT+UNDERFLOW),d7 - moveq IMM (SINGLE_FLOAT),d6 - PICJUMP $_exception_handler -@@ -2936,7 +2942,7 @@ Laddsf$4: - #else - cmpl IMM (0xff),d2 - #endif -- bhi 1f -+ bge 1f - bclr IMM (FLT_MANT_DIG-1),d0 - #ifndef __mcoldfire__ - lslw IMM (7),d2 diff --git a/packages/gcc/13.3.0/0013-libgcc-Exclude-UCLIBC-from-GLIBC-thread-check.patch b/packages/gcc/13.3.0/0013-libgcc-Exclude-UCLIBC-from-GLIBC-thread-check.patch deleted file mode 100644 index b600262f..00000000 --- a/packages/gcc/13.3.0/0013-libgcc-Exclude-UCLIBC-from-GLIBC-thread-check.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 4931e2e89fd5edb3fb222132519e0ed731d644ef Mon Sep 17 00:00:00 2001 -From: Chris Packham -Date: Thu, 7 Sep 2023 19:26:49 +1200 -Subject: [PATCH] libgcc: Exclude UCLIBC from GLIBC thread check - -UBLIBC defines __GLIBC__ but also marks __pthread_key_create() as -protected. Leading to link errors with newer binutils such as: - - ld.bfd: isl_test_cpp17.o: non-canonical reference to canonical protected function `__pthread_key_create' in x86_64-multilib-linux-uclibc/sysroot/lib64/libc.so.1 - ld.bfd: failed to set dynamic section sizes: bad value - -Add a condition on !__UCLIBC__ when selecting a symbol to detect pthread -usage so it picks the intended pthread_cancel(). - -Signed-off-by: Chris Packham ---- - libgcc/gthr-posix.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/libgcc/gthr-posix.h b/libgcc/gthr-posix.h -index aebcfdd9f4ca..087a631d308d 100644 ---- a/libgcc/gthr-posix.h -+++ b/libgcc/gthr-posix.h -@@ -233,7 +233,7 @@ __gthread_active_p (void) - library does not provide pthread_cancel, so we do use pthread_create - there (and interceptor libraries lose). */ - --#ifdef __GLIBC__ -+#if defined(__GLIBC__) && !defined(__UCLIBC__) - __gthrw2(__gthrw_(__pthread_key_create), - __pthread_key_create, - pthread_key_create) diff --git a/packages/gcc/13.3.0/0014-LoongArch-Use-lib-instead-of-lib64-as-the-library-se.patch b/packages/gcc/13.3.0/0014-LoongArch-Use-lib-instead-of-lib64-as-the-library-se.patch deleted file mode 100644 index 74c785df..00000000 --- a/packages/gcc/13.3.0/0014-LoongArch-Use-lib-instead-of-lib64-as-the-library-se.patch +++ /dev/null @@ -1,77 +0,0 @@ -From af5628a1c34dfd6e065ee0bad581564744c8c812 Mon Sep 17 00:00:00 2001 -From: Yang Yujie -Date: Wed, 6 Mar 2024 09:19:59 +0800 -Subject: [PATCH] LoongArch: Use /lib instead of /lib64 as the library search - path for MUSL. - -gcc/ChangeLog: - - * config.gcc: Add a case for loongarch*-*-linux-musl*. - * config/loongarch/linux.h: Disable the multilib-compatible - treatment for *musl* targets. - * config/loongarch/musl.h: New file. ---- - gcc/config.gcc | 3 +++ - gcc/config/loongarch/linux.h | 4 +++- - gcc/config/loongarch/musl.h | 23 +++++++++++++++++++++++ - 3 files changed, 29 insertions(+), 1 deletion(-) - create mode 100644 gcc/config/loongarch/musl.h - -diff --git a/gcc/config.gcc b/gcc/config.gcc -index 4f3bcd24edfa..ebf9aca7b09f 100644 ---- a/gcc/config.gcc -+++ b/gcc/config.gcc -@@ -2493,6 +2493,9 @@ riscv*-*-freebsd*) - - loongarch*-*-linux*) - tm_file="elfos.h gnu-user.h linux.h linux-android.h glibc-stdint.h ${tm_file}" -+ case ${target} in -+ *-linux-musl*) tm_file="${tm_file} loongarch/musl.h" -+ esac - tm_file="${tm_file} loongarch/gnu-user.h loongarch/linux.h" - extra_options="${extra_options} linux-android.opt" - tmake_file="${tmake_file} loongarch/t-linux" -diff --git a/gcc/config/loongarch/linux.h b/gcc/config/loongarch/linux.h -index 9059d244190a..f01d6f750616 100644 ---- a/gcc/config/loongarch/linux.h -+++ b/gcc/config/loongarch/linux.h -@@ -21,7 +21,9 @@ along with GCC; see the file COPYING3. If not see - * This ensures that a compiler configured with --disable-multilib - * can work in a multilib environment. */ - --#if defined(LA_DISABLE_MULTILIB) && defined(LA_DISABLE_MULTIARCH) -+#if !defined(LA_DEFAULT_TARGET_MUSL) \ -+ && defined(LA_DISABLE_MULTILIB) \ -+ && defined(LA_DISABLE_MULTIARCH) - - #if DEFAULT_ABI_BASE == ABI_BASE_LP64D - #define ABI_LIBDIR "lib64" -diff --git a/gcc/config/loongarch/musl.h b/gcc/config/loongarch/musl.h -new file mode 100644 -index 000000000000..fa43bc866064 ---- /dev/null -+++ b/gcc/config/loongarch/musl.h -@@ -0,0 +1,23 @@ -+/* Definitions for MUSL C library support. -+ Copyright (C) 2024 Free Software Foundation, Inc. -+ -+This file is part of GCC. -+ -+GCC is free software; you can redistribute it and/or modify -+it under the terms of the GNU General Public License as published by -+the Free Software Foundation; either version 3, or (at your option) -+any later version. -+ -+GCC is distributed in the hope that it will be useful, -+but WITHOUT ANY WARRANTY; without even the implied warranty of -+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+GNU General Public License for more details. -+ -+You should have received a copy of the GNU General Public License -+along with GCC; see the file COPYING3. If not see -+. */ -+ -+ -+#ifndef LA_DEFAULT_TARGET_MUSL -+#define LA_DEFAULT_TARGET_MUSL -+#endif diff --git a/packages/gcc/13.3.0/chksum b/packages/gcc/13.3.0/chksum deleted file mode 100644 index edfec5ca..00000000 --- a/packages/gcc/13.3.0/chksum +++ /dev/null @@ -1,8 +0,0 @@ -md5 gcc-13.3.0.tar.xz 726726a73eaaacad4259fe5d7e978020 -sha1 gcc-13.3.0.tar.xz 6501872415823c95d48be28853ce3ebd6c1040c4 -sha256 gcc-13.3.0.tar.xz 0845e9621c9543a13f484e94584a49ffc0129970e9914624235fc1d061a0c083 -sha512 gcc-13.3.0.tar.xz ed5f2f4c6ed2c796fcf2c93707159e9dbd3ddb1ba063d549804dd68cdabbb6d550985ae1c8465ae9a336cfe29274a6eb0f42e21924360574ebd8e5d5c7c9a801 -md5 gcc-13.3.0.tar.gz f6e5402827861cd5397b3947bc7b8ff2 -sha1 gcc-13.3.0.tar.gz 19ae2771e6bc4b803576cc0250d214a67cc7617d -sha256 gcc-13.3.0.tar.gz 3a2b10cab86e32358fdac871546d57e2700e9bdb5875ef33fff5b601265b9e32 -sha512 gcc-13.3.0.tar.gz a2973a57b028ae20920f00402c15a36e7a37f86c8d26f8ba1947fe2fb6ed06c474dea06cccb178a2b9144103ca213e32b5f263735139f5c67e27254959e76bdb diff --git a/packages/gcc/13.3.0/experimental/0001-picolibc-Add-custom-spec-file-fragments-for-using-pi.patch b/packages/gcc/13.3.0/experimental/0001-picolibc-Add-custom-spec-file-fragments-for-using-pi.patch deleted file mode 100644 index 487a28c3..00000000 --- a/packages/gcc/13.3.0/experimental/0001-picolibc-Add-custom-spec-file-fragments-for-using-pi.patch +++ /dev/null @@ -1,127 +0,0 @@ -From b0f9ac365f91952f6f920c8e6aa4ddb819f47cc8 Mon Sep 17 00:00:00 2001 -From: Keith Packard -Date: Tue, 23 Aug 2022 22:13:08 -0700 -Subject: [PATCH] picolibc: Add custom spec file fragments for using - picolibc - -The '--oslib=' option allows targets to insert an OS library after the -C library in the LIB_PATH spec file fragment. This library maps a few -POSIX APIs used by picolibc to underlying system capabilities. - -The '--crt0=' option allows targets to use an alternate crt0 in place -of the usual one as provided by Picolibc. - -For example, picolibc provides 'libsemihost' and 'crt0-semihost.o' on -various targets which maps some POSIX APIs to semihosting capabilities -and signals the semihosting environment when 'main' returns. These -would be used by specifying --oslib=semihost --crt0=semihost. - -This patch also takes advantage of the IN_GPP conditional when -building g++ to elide exception handling contents from the executable -when not linking with the g++ driver. - -Signed-off-by: Keith Packard ---- - gcc/config.gcc | 7 +++++++ - gcc/config/picolibc.h | 44 ++++++++++++++++++++++++++++++++++++++++++++ - gcc/config/picolibc.opt | 33 +++++++++++++++++++++++++++++++++ - 3 files changed, 84 insertions(+) - create mode 100644 gcc/config/picolibc.h - create mode 100644 gcc/config/picolibc.opt - ---- a/gcc/config.gcc -+++ b/gcc/config.gcc -@@ -5931,3 +5931,10 @@ - tm_defines="$tm_defines DEFAULT_LIBC=$default_libc" - ;; - esac -+ -+case "$default_libc" in -+ LIBC_PICOLIBC) -+ extra_options="${extra_options} picolibc.opt" -+ tm_file="${tm_file} picolibc.h" -+ ;; -+esac ---- /dev/null -+++ b/gcc/config/picolibc.h -@@ -0,0 +1,44 @@ -+/* Configuration common to all targets running Picolibc. -+ Copyright (C) 2023 Free Software Foundation, Inc. -+ -+ This file is part of GCC. -+ -+ GCC is free software; you can redistribute it and/or modify it -+ under the terms of the GNU General Public License as published -+ by the Free Software Foundation; either version 3, or (at your -+ option) any later version. -+ -+ GCC is distributed in the hope that it will be useful, but WITHOUT -+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public -+ License for more details. -+ -+ Under Section 7 of GPL version 3, you are granted additional -+ permissions described in the GCC Runtime Library Exception, version -+ 3.1, as published by the Free Software Foundation. -+ -+ You should have received a copy of the GNU General Public License and -+ a copy of the GCC Runtime Library Exception along with this program; -+ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -+ . */ -+ -+#ifdef IN_GPP -+#define PICOLIBC_LD "picolibcpp.ld" -+#define PICOLIBC_BEGIN " crtbegin%O%s" -+#define PICOLIBC_END "crtend%O%s" -+#else -+#define PICOLIBC_LD "picolibc.ld" -+#define PICOLIBC_BEGIN "" -+#define PICOLIBC_END "" -+#endif -+ -+#undef LIB_SPEC -+#define LIB_SPEC "%{!T:-T" PICOLIBC_LD "} --start-group -lc %{-oslib=*:-l%*} %(libgcc) --end-group" -+ -+#undef STARTFILE_SPEC -+#define STARTFILE_SPEC "%{-crt0=*:crt0-%*%O%s; :crt0%O%s}" PICOLIBC_BEGIN -+ -+#undef ENDFILE_SPEC -+#define ENDFILE_SPEC PICOLIBC_END -+ -+#define EH_TABLES_CAN_BE_READ_ONLY 1 ---- /dev/null -+++ b/gcc/config/picolibc.opt -@@ -0,0 +1,33 @@ -+; Processor-independent options for picolibc. -+; -+; Copyright (C) 2022 Free Software Foundation, Inc. -+; -+; This file is part of GCC. -+; -+; GCC is free software; you can redistribute it and/or modify it under -+; the terms of the GNU General Public License as published by the Free -+; Software Foundation; either version 3, or (at your option) any later -+; version. -+; -+; GCC is distributed in the hope that it will be useful, but WITHOUT ANY -+; WARRANTY; without even the implied warranty of MERCHANTABILITY or -+; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -+; for more details. -+; -+; You should have received a copy of the GNU General Public License -+; along with GCC; see the file COPYING3. If not see -+; . -+ -+-oslib -+Driver Separate Alias(-oslib=) -+ -+-oslib= -+Driver Joined -+Specify an OS support library to load after libc. -+ -+-crt0 -+Driver Separate Alias(-crt0=) -+ -+-crt0= -+Driver Joined -+Specify an alternate startup file. diff --git a/packages/gcc/13.3.0/version.desc b/packages/gcc/13.3.0/version.desc deleted file mode 100644 index e69de29b..00000000 diff --git a/packages/gcc/13.4.0/0000-libtool-leave-framework-alone.patch b/packages/gcc/13.4.0/0000-libtool-leave-framework-alone.patch new file mode 100644 index 00000000..1a86e415 --- /dev/null +++ b/packages/gcc/13.4.0/0000-libtool-leave-framework-alone.patch @@ -0,0 +1,18 @@ +--- + libtool-ldflags | 5 +++++ + 1 file changed, 5 insertions(+) + +--- a/libtool-ldflags ++++ b/libtool-ldflags +@@ -36,6 +36,11 @@ + for arg + do + case $arg in ++ -framework) ++ # libtool handles this option. It should not be prefixed with ++ # -Xcompiler, as that would split it from the argument that ++ # follows. ++ ;; + -f*|--*|-static-lib*|-shared-lib*|-B*) + # Libtool does not ascribe any special meaning options + # that begin with -f or with a double-dash. So, it will diff --git a/packages/gcc/13.4.0/0001-gcc-plugin-POSIX-include-sys-select-h.patch b/packages/gcc/13.4.0/0001-gcc-plugin-POSIX-include-sys-select-h.patch new file mode 100644 index 00000000..5f9a07a2 --- /dev/null +++ b/packages/gcc/13.4.0/0001-gcc-plugin-POSIX-include-sys-select-h.patch @@ -0,0 +1,14 @@ +--- + libcc1/connection.cc | 1 + + 1 file changed, 1 insertion(+) + +--- a/libcc1/connection.cc ++++ b/libcc1/connection.cc +@@ -21,6 +21,7 @@ + #include + #include + #include ++#include + #include + #include + #include "marshall.hh" diff --git a/packages/gcc/13.4.0/0002-arm-softfloat-libgcc.patch b/packages/gcc/13.4.0/0002-arm-softfloat-libgcc.patch new file mode 100644 index 00000000..d9800365 --- /dev/null +++ b/packages/gcc/13.4.0/0002-arm-softfloat-libgcc.patch @@ -0,0 +1,31 @@ +--- + gcc/config/arm/linux-elf.h | 2 +- + libgcc/config/arm/t-linux | 7 ++++++- + 2 files changed, 7 insertions(+), 2 deletions(-) + +--- a/gcc/config/arm/linux-elf.h ++++ b/gcc/config/arm/linux-elf.h +@@ -58,7 +58,7 @@ + %{shared:-lc} \ + %{!shared:%{profile:-lc_p}%{!profile:-lc}}" + +-#define LIBGCC_SPEC "%{mfloat-abi=soft*:-lfloat} -lgcc" ++#define LIBGCC_SPEC "-lgcc" + + #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2" + +--- a/libgcc/config/arm/t-linux ++++ b/libgcc/config/arm/t-linux +@@ -1,6 +1,11 @@ + LIB1ASMSRC = arm/lib1funcs.S + LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx _clzsi2 _clzdi2 \ +- _ctzsi2 _arm_addsubdf3 _arm_addsubsf3 ++ _ctzsi2 _arm_addsubdf3 _arm_addsubsf3 \ ++ _arm_addsubdf3 _arm_addsubsf3 \ ++ _arm_negdf2 _arm_muldivdf3 _arm_cmpdf2 _arm_unorddf2 \ ++ _arm_fixdfsi _arm_fixunsdfsi _arm_truncdfsf2 \ ++ _arm_negsf2 _arm_muldivsf3 _arm_cmpsf2 _arm_unordsf2 \ ++ _arm_fixsfsi _arm_fixunssfsi + + # Just for these, we omit the frame pointer since it makes such a big + # difference. diff --git a/packages/gcc/13.4.0/0003-libgcc-disable-split-stack-nothreads.patch b/packages/gcc/13.4.0/0003-libgcc-disable-split-stack-nothreads.patch new file mode 100644 index 00000000..df91a9ff --- /dev/null +++ b/packages/gcc/13.4.0/0003-libgcc-disable-split-stack-nothreads.patch @@ -0,0 +1,17 @@ +disable split-stack for non-thread builds + +Signed-off-by: Waldemar Brodkorb + +--- + libgcc/config/t-stack | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/libgcc/config/t-stack ++++ b/libgcc/config/t-stack +@@ -1,4 +1,6 @@ + # Makefile fragment to provide generic support for -fsplit-stack. + # This should be used in config.host for any host which supports + # -fsplit-stack. ++ifeq ($(enable_threads),yes) + LIB2ADD_ST += $(srcdir)/generic-morestack.c $(srcdir)/generic-morestack-thread.c ++endif diff --git a/packages/gcc/13.4.0/0004-Remove-use-of-include_next-from-c-headers.patch b/packages/gcc/13.4.0/0004-Remove-use-of-include_next-from-c-headers.patch new file mode 100644 index 00000000..e079849a --- /dev/null +++ b/packages/gcc/13.4.0/0004-Remove-use-of-include_next-from-c-headers.patch @@ -0,0 +1,304 @@ +From 6c7efd415ef2fa5d9f2d8bcd5b30e9faf696d5ca 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 c70c8e4edcfc..6a0d5307408a 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 abe013725b24..1df12c0af820 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 234008e328d3..3e259fbc75e9 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 39eb9bbe5d50..e2c2e67356f3 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 6d431e8b73ac..176b66b143c3 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 f58d3305dbdc..bd18e7a3b046 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 e498a711b8df..05ce7cec0e72 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 261c5cbafdba..3c536f5a0d56 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 1fd0c71eb722..2df49096ea23 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 ec8b4b5eef34..f5f04720d2a0 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 41752d96e552..f69f27e51fdc 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 c30a34d57d7b..2209bd6b7354 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 28032a2ec9fb..e94a5678bc71 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 473ae22f8840..c8bee71de315 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 4edc7d9bfdc7..5e8d79fcf189 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 2d478fe9beba..58a55bc18adc 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 0ef94430b6f1..a91c7a68ca8a 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 8ccc117792bb..6111ad108a79 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 07c02e562b02..63b76873532e 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 992713b70da6..165d87f65f7f 100644 +--- a/libstdc++-v3/include/c_global/cmath ++++ b/libstdc++-v3/include/c_global/cmath +@@ -44,7 +44,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 aeb961ad69df..a2c661acd243 100644 +--- a/libstdc++-v3/include/c_global/cstdlib ++++ b/libstdc++-v3/include/c_global/cstdlib +@@ -76,7 +76,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 + diff --git a/packages/gcc/13.4.0/0005-Allow-default-libc-to-be-specified-to-configure.patch b/packages/gcc/13.4.0/0005-Allow-default-libc-to-be-specified-to-configure.patch new file mode 100644 index 00000000..a56f02ad --- /dev/null +++ b/packages/gcc/13.4.0/0005-Allow-default-libc-to-be-specified-to-configure.patch @@ -0,0 +1,138 @@ +From bba1f4101084e296e5bfcc9a2f9e91242928ad10 Mon Sep 17 00:00:00 2001 +From: Keith Packard +Date: Fri, 2 Sep 2022 23:07:05 -0700 +Subject: [PATCH] Allow default libc to be specified to configure + +The default C library is normally computed based on the target +triplet. However, for embedded systems, it can be useful to leave the +triplet alone while changing which C library is used by default. Other +C libraries may still be available on the system so the compiler and +can be used by specifying suitable include and library paths at build +time. + +If an unknown --with-default-libc= value is provided, emit an error +and stop. + +Signed-off-by: Keith Packard +--- + gcc/config.gcc | 48 ++++++++++++++++++++++++++++++++++++++++-------- + gcc/configure.ac | 4 ++++ + 2 files changed, 44 insertions(+), 8 deletions(-) + +diff --git a/gcc/config.gcc b/gcc/config.gcc +index c3b73d05eb72..0672d94535b9 100644 +--- a/gcc/config.gcc ++++ b/gcc/config.gcc +@@ -664,6 +664,8 @@ esac + # Common C libraries. + tm_defines="$tm_defines LIBC_GLIBC=1 LIBC_UCLIBC=2 LIBC_BIONIC=3 LIBC_MUSL=4" + ++default_libc="" ++ + # 32-bit x86 processors supported by --with-arch=. Each processor + # MUST be separated by exactly one space. + x86_archs="athlon athlon-4 athlon-fx athlon-mp athlon-tbird \ +@@ -870,16 +872,16 @@ case ${target} in + esac + case $target in + *-*-*android*) +- tm_defines="$tm_defines DEFAULT_LIBC=LIBC_BIONIC" ++ default_libc=LIBC_BIONIC + ;; + *-*-*uclibc* | *-*-uclinuxfdpiceabi) +- tm_defines="$tm_defines DEFAULT_LIBC=LIBC_UCLIBC" ++ default_libc=LIBC_UCLIBC + ;; + *-*-*musl*) +- tm_defines="$tm_defines DEFAULT_LIBC=LIBC_MUSL" ++ default_libc=LIBC_MUSL + ;; + *) +- tm_defines="$tm_defines DEFAULT_LIBC=LIBC_GLIBC" ++ default_libc=LIBC_GLIBC + ;; + esac + # Assume that glibc or uClibc or Bionic are being used and so __cxa_atexit +@@ -988,7 +990,8 @@ case ${target} in + case ${enable_threads} in + "" | yes | posix) thread_file='posix' ;; + esac +- tm_defines="$tm_defines DEFAULT_LIBC=LIBC_UCLIBC SINGLE_LIBC" ++ tm_defines="$tm_defines SINGLE_LIBC" ++ default_libc=LIBC_UCLIBC + ;; + *-*-rdos*) + use_gcc_stdint=wrap +@@ -1653,13 +1656,13 @@ csky-*-*) + + case ${target} in + csky-*-linux-gnu*) +- tm_defines="$tm_defines DEFAULT_LIBC=LIBC_GLIBC" ++ default_libc=LIBC_GLIBC + # Force .init_array support. The configure script cannot always + # automatically detect that GAS supports it, yet we require it. + gcc_cv_initfini_array=yes + ;; + csky-*-linux-uclibc*) +- tm_defines="$tm_defines DEFAULT_LIBC=LIBC_UCLIBC" ++ default_libc=LIBC_UCLIBC + default_use_cxa_atexit=no + ;; + *) +@@ -3039,7 +3042,7 @@ powerpc*-wrs-vxworks7r*) + tmake_file="${tmake_file} t-linux rs6000/t-linux64 rs6000/t-fprules rs6000/t-ppccomm" + tmake_file="${tmake_file} rs6000/t-vxworks" + +- tm_defines="$tm_defines DEFAULT_LIBC=LIBC_GLIBC" ++ default_libc=LIBC_GLIBC + extra_objs="$extra_objs linux.o rs6000-linux.o" + ;; + powerpc-wrs-vxworks*) +@@ -5880,3 +5883,32 @@ i[34567]86-*-* | x86_64-*-*) + fi + ;; + esac ++ ++case "${with_default_libc}" in ++glibc) ++ default_libc=LIBC_GLIBC ++ ;; ++uclibc) ++ default_libc=LIBC_UCLIBC ++ ;; ++bionic) ++ default_libc=LIBC_BIONIC ++ ;; ++musl) ++ default_libc=LIBC_MUSL ++ ;; ++"") ++ ;; ++*) ++ echo "Unknown libc in --with-default-libc=$with_default_libc" 1>&2 ++ exit 1 ++ ;; ++esac ++ ++case "$default_libc" in ++"") ++ ;; ++*) ++ tm_defines="$tm_defines DEFAULT_LIBC=$default_libc" ++ ;; ++esac +diff --git a/gcc/configure.ac b/gcc/configure.ac +index bf8ff4d63906..b1c2944775d1 100644 +--- a/gcc/configure.ac ++++ b/gcc/configure.ac +@@ -2541,6 +2541,10 @@ if { { test x$host != x$target && test "x$with_sysroot" = x ; } || + fi + AC_SUBST(inhibit_libc) + ++AC_ARG_WITH(default-libc, ++ [AS_HELP_STRING([--with-default-libc], ++ [Use specified default C library])]) ++ + # When building gcc with a cross-compiler, we need to adjust things so + # that the generator programs are still built with the native compiler. + # Also, we cannot run fixincludes. diff --git a/packages/gcc/13.4.0/0006-driver-Extend-getenv-function-to-allow-default-value.patch b/packages/gcc/13.4.0/0006-driver-Extend-getenv-function-to-allow-default-value.patch new file mode 100644 index 00000000..e7813e7b --- /dev/null +++ b/packages/gcc/13.4.0/0006-driver-Extend-getenv-function-to-allow-default-value.patch @@ -0,0 +1,99 @@ +From ba5bf3a67e74c05231d85ee44c757b3a7391f292 Mon Sep 17 00:00:00 2001 +From: Keith Packard +Date: Fri, 26 Aug 2022 14:30:03 -0700 +Subject: [PATCH] driver: Extend 'getenv' function to allow default value + +Right now, a missing environment variable provided to the 'getenv' +function in a .specs file causes a fatal error. That makes writing a +spec file that uses the GCC_EXEC_PREFIX value difficult as that +variable is only set when the driver has been relocated, but not when +run from the defined location. This makes building a relocatable +toolchain difficult to extend to other ancilary pieces which use specs +files to locate header and library files adjacent to the toolchain. + +This patch adds an optional third argument to the getenv function that +can be used to fall back to the standard installation path when the +driver hasn't set GCC_EXEC_PREFIX in the environment. + +For example, if an alternate C library is installed in +${prefix}/extra, then this change allows the specs file to locate that +relative to the gcc directory, if gcc is located in the original +installation directory (which would leave GCC_EXEC_PREFIX unset), or +if the gcc tree has been moved to a different location (where gcc +would set GCC_EXEC_PREFIX itself): + +*cpp: +-isystem %:getenv(GCC_EXEC_PREFIX ../../extra/include ${prefix}/extra/include) + +I considered changing the behavior of either the %R sequence so that +it had a defined behavior when there was no sysroot defined, or making +the driver always set the GCC_EXEC_PREFIX environment variable and +decided that the approach of adding functionality to getenv where it +was previously invalid would cause the least potential for affecting +existing usage. + +Signed-off-by: Keith Packard +--- + gcc/doc/invoke.texi | 18 +++++++++++------- + gcc/gcc.cc | 10 +++++++++- + 2 files changed, 20 insertions(+), 8 deletions(-) + +diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi +index 792ce283bb98..21b89c86acf9 100644 +--- a/gcc/doc/invoke.texi ++++ b/gcc/doc/invoke.texi +@@ -34866,17 +34866,21 @@ The following built-in spec functions are provided: + + @table @code + @item @code{getenv} +-The @code{getenv} spec function takes two arguments: an environment +-variable name and a string. If the environment variable is not +-defined, a fatal error is issued. Otherwise, the return value is the +-value of the environment variable concatenated with the string. For +-example, if @env{TOPDIR} is defined as @file{/path/to/top}, then: ++ ++The @code{getenv} spec function takes two or three arguments: an ++environment variable name, a string and an optional default value. If ++the environment variable is not defined and a default value is ++provided, that is used as the return value; otherwise a fatal error is ++issued. Otherwise, the return value is the value of the environment ++variable concatenated with the string. For example, if @env{TOPDIR} ++is defined as @file{/path/to/top}, then: + + @smallexample +-%:getenv(TOPDIR /include) ++%:getenv(TOPDIR /include /path/to/default/include) + @end smallexample + +-expands to @file{/path/to/top/include}. ++expands to @file{/path/to/top/include}. If @env{TOPDIR} is not ++defined, then this expands to @file{/path/to/default/include}. + + @item @code{if-exists} + The @code{if-exists} spec function takes one argument, an absolute +diff --git a/gcc/gcc.cc b/gcc/gcc.cc +index 16bb07f2cdc5..a94da302b85b 100644 +--- a/gcc/gcc.cc ++++ b/gcc/gcc.cc +@@ -10155,12 +10155,20 @@ getenv_spec_function (int argc, const char **argv) + char *ptr; + size_t len; + +- if (argc != 2) ++ if (argc != 2 && argc != 3) + return NULL; + + varname = argv[0]; + value = env.get (varname); + ++ if (!value && argc == 3) ++ { ++ value = argv[2]; ++ result = XNEWVAR(char, strlen(value) + 1); ++ strcpy(result, value); ++ return result; ++ } ++ + /* If the variable isn't defined and this is allowed, craft our expected + return value. Assume variable names used in specs strings don't contain + any active spec character so don't need escaping. */ diff --git a/packages/gcc/13.4.0/0007-Add-newlib-and-picolibc-as-default-C-library-choices.patch b/packages/gcc/13.4.0/0007-Add-newlib-and-picolibc-as-default-C-library-choices.patch new file mode 100644 index 00000000..fadbdac2 --- /dev/null +++ b/packages/gcc/13.4.0/0007-Add-newlib-and-picolibc-as-default-C-library-choices.patch @@ -0,0 +1,39 @@ +From f4b206863407055fc58956be171e2066e941328f Mon Sep 17 00:00:00 2001 +From: Keith Packard +Date: Tue, 23 Aug 2022 22:12:06 -0700 +Subject: [PATCH] Add newlib and picolibc as default C library choices + +Signed-off-by: Keith Packard +--- + gcc/config.gcc | 11 ++++++++++- + 1 file changed, 10 insertions(+), 1 deletion(-) + +diff --git a/gcc/config.gcc b/gcc/config.gcc +index 0672d94535b9..b02bd46c231e 100644 +--- a/gcc/config.gcc ++++ b/gcc/config.gcc +@@ -662,7 +662,7 @@ case ${target} in + esac + + # Common C libraries. +-tm_defines="$tm_defines LIBC_GLIBC=1 LIBC_UCLIBC=2 LIBC_BIONIC=3 LIBC_MUSL=4" ++tm_defines="$tm_defines LIBC_GLIBC=1 LIBC_UCLIBC=2 LIBC_BIONIC=3 LIBC_MUSL=4 LIBC_NEWLIB=5 LIBC_PICOLIBC=6" + + default_libc="" + +@@ -5897,6 +5897,15 @@ bionic) + musl) + default_libc=LIBC_MUSL + ;; ++newlib) ++ # Newlib configurations don't set the DEFAULT_LIBC variable, so ++ # avoid changing those by allowing --with-default-libc=newlib but ++ # not actually setting the DEFAULT_LIBC variable. ++ default_libc= ++ ;; ++picolibc) ++ default_libc=LIBC_PICOLIBC ++ ;; + "") + ;; + *) diff --git a/packages/gcc/13.4.0/0008-Support-picolibc-targets.patch b/packages/gcc/13.4.0/0008-Support-picolibc-targets.patch new file mode 100644 index 00000000..754bd576 --- /dev/null +++ b/packages/gcc/13.4.0/0008-Support-picolibc-targets.patch @@ -0,0 +1,35 @@ +From 1d1d77a6b0272cc3ee0ec18f0e7adc909d4572db Mon Sep 17 00:00:00 2001 +From: Keith Packard +Date: Sun, 12 Feb 2023 14:23:32 -0800 +Subject: [PATCH] Support picolibc targets + +Match *-picolibc-* and select picolibc as the default C library, plus continuing to use +the newlib-based logic for other configuration items. + +Signed-off-by: Keith Packard +--- + gcc/config.gcc | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/gcc/config.gcc b/gcc/config.gcc +index b02bd46c231e..4f3bcd24edfa 100644 +--- a/gcc/config.gcc ++++ b/gcc/config.gcc +@@ -1116,6 +1116,17 @@ case ${target} in + ;; + esac + ;; ++*-picolibc-*) ++ # __cxa_atexit is provided. ++ default_use_cxa_atexit=yes ++ use_gcc_stdint=wrap ++ default_libc=LIBC_PICOLIBC ++ case "${with_newlib}-${with_headers}" in ++ no-no) use_gcc_stdint=provide ;; ++ *) ;; ++ esac ++ ;; ++ + *-*-elf|arc*-*-elf*) + # Assume that newlib is being used and so __cxa_atexit is provided. + default_use_cxa_atexit=yes diff --git a/packages/gcc/13.4.0/0009-gcc-Allow-g-to-work-differently-from-gcc.patch b/packages/gcc/13.4.0/0009-gcc-Allow-g-to-work-differently-from-gcc.patch new file mode 100644 index 00000000..9cded7c2 --- /dev/null +++ b/packages/gcc/13.4.0/0009-gcc-Allow-g-to-work-differently-from-gcc.patch @@ -0,0 +1,65 @@ +From a89f0a31d778fb8c82fd75f6e0578b2702e6f473 Mon Sep 17 00:00:00 2001 +From: Keith Packard +Date: Sat, 11 Feb 2023 23:07:08 -0800 +Subject: [PATCH] gcc: Allow g++ to work differently from gcc + +Compile gcc.cc with -DIN_GPP defined when building g++ so that the +code can respond appropriately for the default target language. This +allows the driver to customize the specs used, selecting different +linker scripts, adjusting the use of crtbegin.o/crtend.o etc. + +By default, this change has no effect; targets need to explicitly +check for IN_GPP to have alternate behavior. + +Signed-off-by: Keith Packard +--- + gcc/cp/Make-lang.in | 7 ++++++- + gcc/gpp.cc | 21 +++++++++++++++++++++ + 2 files changed, 27 insertions(+), 1 deletion(-) + create mode 100644 gcc/gpp.cc + +diff --git a/gcc/cp/Make-lang.in b/gcc/cp/Make-lang.in +index 4ee26fad93d6..e707fe512013 100644 +--- a/gcc/cp/Make-lang.in ++++ b/gcc/cp/Make-lang.in +@@ -77,7 +77,12 @@ CFLAGS-cp/module.o += -DMODULE_VERSION='$(shell cat s-cp-module-version)' + endif + + # Create the compiler driver for g++. +-GXX_OBJS = $(GCC_OBJS) cp/g++spec.o ++GXX_OBJS = $(GCC_OBJS:gcc.o=gpp.o) cp/g++spec.o ++ ++CFLAGS-gpp.o = $(CFLAGS-gcc.o) ++gpp.o: $(BASEVER) ++gpp.o: gcc.o ++ + xg++$(exeext): $(GXX_OBJS) $(EXTRA_GCC_OBJS) libcommon-target.a $(LIBDEPS) + +$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ \ + $(GXX_OBJS) $(EXTRA_GCC_OBJS) libcommon-target.a \ +diff --git a/gcc/gpp.cc b/gcc/gpp.cc +new file mode 100644 +index 000000000000..3cd7b45e8086 +--- /dev/null ++++ b/gcc/gpp.cc +@@ -0,0 +1,21 @@ ++/* Compiler driver program that can handle many languages. ++ Copyright (C) 1987-2022 Free Software Foundation, Inc. ++ ++This file is part of GCC. ++ ++GCC is free software; you can redistribute it and/or modify it under ++the terms of the GNU General Public License as published by the Free ++Software Foundation; either version 3, or (at your option) any later ++version. ++ ++GCC is distributed in the hope that it will be useful, but WITHOUT ANY ++WARRANTY; without even the implied warranty of MERCHANTABILITY or ++FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ++for more details. ++ ++You should have received a copy of the GNU General Public License ++along with GCC; see the file COPYING3. If not see ++. */ ++ ++#define IN_GPP ++#include "gcc.cc" diff --git a/packages/gcc/13.4.0/0010-RISC-V-fix-build-issue-with-gcc-4.9.x.patch b/packages/gcc/13.4.0/0010-RISC-V-fix-build-issue-with-gcc-4.9.x.patch new file mode 100644 index 00000000..86d86b14 --- /dev/null +++ b/packages/gcc/13.4.0/0010-RISC-V-fix-build-issue-with-gcc-4.9.x.patch @@ -0,0 +1,43 @@ +From 9d6bdc5cc6f02eebc02bfd5d5da0669b42e1087c Mon Sep 17 00:00:00 2001 +From: Romain Naour +Date: Tue, 2 May 2023 14:21:55 +0200 +Subject: [PATCH] RISC-V: fix build issue with gcc 4.9.x + +GCC should still build with GCC 4.8.3 or newer [1] +using C++03 by default. But a recent change in +RISC-V port introduced a C++11 feature "std::log2" [2]. + +Use log2 from the C header, without the namespace [3]. + +[1] https://gcc.gnu.org/install/prerequisites.html +[2] https://gcc.gnu.org/git/?p=gcc.git;a=patch;h=7caa1ae5e451e780fbc4746a54e3f19d4f4304dc +[3] https://stackoverflow.com/questions/26733413/error-log2-is-not-a-member-of-std + +Fixes: +https://gitlab.com/buildroot.org/toolchains-builder/-/jobs/4202276589 + +gcc/ChangeLog: + * config/riscv/genrvv-type-indexer.cc: Use log2 from the C header, without + the namespace. + +Signed-off-by: Romain Naour +--- + gcc/config/riscv/genrvv-type-indexer.cc | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/gcc/config/riscv/genrvv-type-indexer.cc b/gcc/config/riscv/genrvv-type-indexer.cc +index e677b55290c6..eebe382d1c34 100644 +--- a/gcc/config/riscv/genrvv-type-indexer.cc ++++ b/gcc/config/riscv/genrvv-type-indexer.cc +@@ -115,9 +115,9 @@ same_ratio_eew_type (unsigned sew, int lmul_log2, unsigned eew, bool unsigned_p, + if (sew == eew) + elmul_log2 = lmul_log2; + else if (sew > eew) +- elmul_log2 = lmul_log2 - std::log2 (sew / eew); ++ elmul_log2 = lmul_log2 - log2 (sew / eew); + else /* sew < eew */ +- elmul_log2 = lmul_log2 + std::log2 (eew / sew); ++ elmul_log2 = lmul_log2 + log2 (eew / sew); + + if (float_p) + return floattype (eew, elmul_log2); diff --git a/packages/gcc/13.4.0/0011-Remove-crypt-and-crypt_r-interceptors.patch b/packages/gcc/13.4.0/0011-Remove-crypt-and-crypt_r-interceptors.patch new file mode 100644 index 00000000..4cc71959 --- /dev/null +++ b/packages/gcc/13.4.0/0011-Remove-crypt-and-crypt_r-interceptors.patch @@ -0,0 +1,138 @@ +From 4fa14369544f73508d97eacfda458f47ab59c595 Mon Sep 17 00:00:00 2001 +From: Fangrui Song +Date: Fri, 28 Apr 2023 09:59:17 -0700 +Subject: [PATCH] Remove crypt and crypt_r interceptors + +From Florian Weimer's D144073 + +> On GNU/Linux (glibc), the crypt and crypt_r functions are not part of the main shared object (libc.so.6), but libcrypt (with multiple possible sonames). The sanitizer libraries do not depend on libcrypt, so it can happen that during sanitizer library initialization, no real implementation will be found because the crypt, crypt_r functions are not present in the process image (yet). If its interceptors are called nevertheless, this results in a call through a null pointer when the sanitizer library attempts to forward the call to the real implementation. +> +> Many distributions have already switched to libxcrypt, a library that is separate from glibc and that can be build with sanitizers directly (avoiding the need for interceptors). This patch disables building the interceptor for glibc targets. + +Let's remove crypt and crypt_r interceptors (D68431) to fix issues with +newer glibc. + +For older glibc, msan will not know that an uninstrumented crypt_r call +initializes `data`, so there is a risk for false positives. However, with some +codebase survey, I think crypt_r uses are very few and the call sites typically +have a `memset(&data, 0, sizeof(data));` anyway. + +Fix https://github.com/google/sanitizers/issues/1365 +Related: https://bugzilla.redhat.com/show_bug.cgi?id=2169432 + +Reviewed By: #sanitizers, fweimer, thesamesam, vitalybuka + +Differential Revision: https://reviews.llvm.org/D149403 +--- + .../sanitizer_common_interceptors.inc | 37 ------------------- + .../sanitizer_platform_interceptors.h | 2 - + .../sanitizer_platform_limits_posix.cpp | 8 ---- + .../sanitizer_platform_limits_posix.h | 1 - + 4 files changed, 48 deletions(-) + +diff --git a/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc b/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc +index ba4b80081f0f..662c41997422 100644 +--- a/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc ++++ b/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc +@@ -10187,41 +10187,6 @@ INTERCEPTOR(SSIZE_T, getrandom, void *buf, SIZE_T buflen, unsigned int flags) { + #define INIT_GETRANDOM + #endif + +-#if SANITIZER_INTERCEPT_CRYPT +-INTERCEPTOR(char *, crypt, char *key, char *salt) { +- void *ctx; +- COMMON_INTERCEPTOR_ENTER(ctx, crypt, key, salt); +- COMMON_INTERCEPTOR_READ_RANGE(ctx, key, internal_strlen(key) + 1); +- COMMON_INTERCEPTOR_READ_RANGE(ctx, salt, internal_strlen(salt) + 1); +- char *res = REAL(crypt)(key, salt); +- if (res != nullptr) +- COMMON_INTERCEPTOR_INITIALIZE_RANGE(res, internal_strlen(res) + 1); +- return res; +-} +-#define INIT_CRYPT COMMON_INTERCEPT_FUNCTION(crypt); +-#else +-#define INIT_CRYPT +-#endif +- +-#if SANITIZER_INTERCEPT_CRYPT_R +-INTERCEPTOR(char *, crypt_r, char *key, char *salt, void *data) { +- void *ctx; +- COMMON_INTERCEPTOR_ENTER(ctx, crypt_r, key, salt, data); +- COMMON_INTERCEPTOR_READ_RANGE(ctx, key, internal_strlen(key) + 1); +- COMMON_INTERCEPTOR_READ_RANGE(ctx, salt, internal_strlen(salt) + 1); +- char *res = REAL(crypt_r)(key, salt, data); +- if (res != nullptr) { +- COMMON_INTERCEPTOR_WRITE_RANGE(ctx, data, +- __sanitizer::struct_crypt_data_sz); +- COMMON_INTERCEPTOR_INITIALIZE_RANGE(res, internal_strlen(res) + 1); +- } +- return res; +-} +-#define INIT_CRYPT_R COMMON_INTERCEPT_FUNCTION(crypt_r); +-#else +-#define INIT_CRYPT_R +-#endif +- + #if SANITIZER_INTERCEPT_GETENTROPY + INTERCEPTOR(int, getentropy, void *buf, SIZE_T buflen) { + void *ctx; +@@ -10772,8 +10737,6 @@ static void InitializeCommonInterceptors() { + INIT_GETUSERSHELL; + INIT_SL_INIT; + INIT_GETRANDOM; +- INIT_CRYPT; +- INIT_CRYPT_R; + INIT_GETENTROPY; + INIT_QSORT; + INIT_QSORT_R; +diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_interceptors.h b/libsanitizer/sanitizer_common/sanitizer_platform_interceptors.h +index 8307b1ec28bf..d50166ee6ce0 100644 +--- a/libsanitizer/sanitizer_common/sanitizer_platform_interceptors.h ++++ b/libsanitizer/sanitizer_common/sanitizer_platform_interceptors.h +@@ -571,8 +571,6 @@ + #define SANITIZER_INTERCEPT_FDEVNAME SI_FREEBSD + #define SANITIZER_INTERCEPT_GETUSERSHELL (SI_POSIX && !SI_ANDROID) + #define SANITIZER_INTERCEPT_SL_INIT (SI_FREEBSD || SI_NETBSD) +-#define SANITIZER_INTERCEPT_CRYPT (SI_POSIX && !SI_ANDROID) +-#define SANITIZER_INTERCEPT_CRYPT_R (SI_LINUX && !SI_ANDROID) + + #define SANITIZER_INTERCEPT_GETRANDOM \ + ((SI_LINUX && __GLIBC_PREREQ(2, 25)) || SI_FREEBSD) +diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp +index c85cf1626a75..bcbd143d19de 100644 +--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp ++++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp +@@ -176,10 +176,6 @@ typedef struct user_fpregs elf_fpregset_t; + # include "sanitizer_platform_interceptors.h" + # include "sanitizer_platform_limits_posix.h" + +-#if SANITIZER_INTERCEPT_CRYPT_R +-#include +-#endif +- + namespace __sanitizer { + unsigned struct_utsname_sz = sizeof(struct utsname); + unsigned struct_stat_sz = sizeof(struct stat); +@@ -283,10 +279,6 @@ namespace __sanitizer { + unsigned struct_statvfs64_sz = sizeof(struct statvfs64); + #endif // SANITIZER_LINUX && !SANITIZER_ANDROID + +-#if SANITIZER_INTERCEPT_CRYPT_R +- unsigned struct_crypt_data_sz = sizeof(struct crypt_data); +-#endif +- + #if SANITIZER_LINUX && !SANITIZER_ANDROID + unsigned struct_timex_sz = sizeof(struct timex); + unsigned struct_msqid_ds_sz = sizeof(struct msqid_ds); +diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h +index 44dd3d9e22d1..29ebb304a9ba 100644 +--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h ++++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h +@@ -319,7 +319,6 @@ extern unsigned struct_msqid_ds_sz; + extern unsigned struct_mq_attr_sz; + extern unsigned struct_timex_sz; + extern unsigned struct_statvfs_sz; +-extern unsigned struct_crypt_data_sz; + #endif // SANITIZER_LINUX && !SANITIZER_ANDROID + + struct __sanitizer_iovec { diff --git a/packages/gcc/13.4.0/0012-libgcc-m68k-Fixes-for-soft-float.patch b/packages/gcc/13.4.0/0012-libgcc-m68k-Fixes-for-soft-float.patch new file mode 100644 index 00000000..caa6664a --- /dev/null +++ b/packages/gcc/13.4.0/0012-libgcc-m68k-Fixes-for-soft-float.patch @@ -0,0 +1,349 @@ +From 51345476fc2f83c77736fab8e29ff4ac358d0f2e Mon Sep 17 00:00:00 2001 +From: Keith Packard +Date: Tue, 22 Aug 2023 12:28:53 -0700 +Subject: [PATCH] libgcc/m68k: Fixes for soft float + +Check for non-zero denorm in __adddf3. Need to check both the upper and +lower 32-bit chunks of a 64-bit float for a non-zero value when +checking to see if the value is -0. + +Fix __addsf3 when the sum exponent is exactly 0xff to ensure that +produces infinity and not nan. + +Handle converting NaN/inf values between formats. + +Handle underflow and overflow when truncating. + +Write a replacement for __fixxfsi so that it does not raise extra +exceptions during an extra conversion from long double to double. + +Return correctly signed zero on float and double divide underflow + +Return positive qNaN instead of negative. + +Signed-off-by: Keith Packard +--- + libgcc/config/m68k/fpgnulib.c | 170 +++++++++++++++++++++++++++------- + libgcc/config/m68k/lb1sf68.S | 20 ++-- + 2 files changed, 147 insertions(+), 43 deletions(-) + +diff --git a/libgcc/config/m68k/fpgnulib.c b/libgcc/config/m68k/fpgnulib.c +index fe41edf26aa0..eaa7858493c9 100644 +--- a/libgcc/config/m68k/fpgnulib.c ++++ b/libgcc/config/m68k/fpgnulib.c +@@ -54,6 +54,7 @@ + #define SIGNBIT 0x80000000L + #define HIDDEN (1L << 23L) + #define SIGN(fp) ((fp) & SIGNBIT) ++#define EXPMASK 0xFFL + #define EXP(fp) (((fp) >> 23L) & 0xFF) + #define MANT(fp) (((fp) & 0x7FFFFFL) | HIDDEN) + #define PACK(s,e,m) ((s) | ((e) << 23L) | (m)) +@@ -262,6 +263,9 @@ __extendsfdf2 (float a1) + mant &= ~HIDDEN; + } + exp = exp - EXCESS + EXCESSD; ++ /* Handle inf and NaN */ ++ if (exp == EXPMASK - EXCESS + EXCESSD) ++ exp = EXPDMASK; + dl.l.upper |= exp << 20; + dl.l.upper |= mant >> 3; + dl.l.lower = mant << 29; +@@ -295,40 +299,52 @@ __truncdfsf2 (double a1) + /* shift double mantissa 6 bits so we can round */ + sticky |= mant & ((1 << 6) - 1); + mant >>= 6; +- +- /* Check for underflow and denormals. */ +- if (exp <= 0) ++ if (exp == EXPDMASK - EXCESSD + EXCESS) + { +- if (exp < -24) ++ exp = EXPMASK; ++ mant = mant >> 1 | (mant & 1) | !!sticky; ++ } ++ else ++ { ++ /* Check for underflow and denormals. */ ++ if (exp <= 0) + { +- sticky |= mant; ++ if (exp < -24) ++ { ++ sticky |= mant; ++ mant = 0; ++ } ++ else ++ { ++ sticky |= mant & ((1 << (1 - exp)) - 1); ++ mant >>= 1 - exp; ++ } ++ exp = 0; ++ } ++ ++ /* now round */ ++ shift = 1; ++ if ((mant & 1) && (sticky || (mant & 2))) ++ { ++ int rounding = exp ? 2 : 1; ++ ++ mant += 1; ++ ++ /* did the round overflow? */ ++ if (mant >= (HIDDEN << rounding)) ++ { ++ exp++; ++ shift = rounding; ++ } ++ } ++ /* shift down */ ++ mant >>= shift; ++ if (exp >= EXPMASK) ++ { ++ exp = EXPMASK; + mant = 0; + } +- else +- { +- sticky |= mant & ((1 << (1 - exp)) - 1); +- mant >>= 1 - exp; +- } +- exp = 0; + } +- +- /* now round */ +- shift = 1; +- if ((mant & 1) && (sticky || (mant & 2))) +- { +- int rounding = exp ? 2 : 1; +- +- mant += 1; +- +- /* did the round overflow? */ +- if (mant >= (HIDDEN << rounding)) +- { +- exp++; +- shift = rounding; +- } +- } +- /* shift down */ +- mant >>= shift; + + mant &= ~HIDDEN; + +@@ -432,8 +448,31 @@ __extenddfxf2 (double d) + } + + exp = EXPD (dl) - EXCESSD + EXCESSX; +- ldl.l.upper |= exp << 16; ++ dl.l.upper &= MANTDMASK; + ldl.l.middle = HIDDENX; ++ ++ /* Recover from a denorm. */ ++ if (exp == -EXCESSD + EXCESSX) ++ { ++ exp++; ++ while ((dl.l.upper & HIDDEND) == 0) ++ { ++ exp--; ++ dl.l.upper = (dl.l.upper << 1) | (dl.l.lower >> 31); ++ dl.l.lower = dl.l.lower << 1; ++ } ++ } ++ ++ /* Handle inf and NaN */ ++ else if (exp == EXPDMASK - EXCESSD + EXCESSX) ++ { ++ exp = EXPXMASK; ++ /* No hidden one bit for INF */ ++ if (dl.l.upper == 0 && dl.l.lower == 0) ++ ldl.l.middle = 0; ++ } ++ ++ ldl.l.upper |= exp << 16; + /* 31-20: # mantissa bits in ldl.l.middle - # mantissa bits in dl.l.upper */ + ldl.l.middle |= (dl.l.upper & MANTDMASK) << (31 - 20); + /* 1+20: explicit-integer-bit + # mantissa bits in dl.l.upper */ +@@ -464,9 +503,38 @@ __truncxfdf2 (long double ld) + } + + exp = EXPX (ldl) - EXCESSX + EXCESSD; +- /* ??? quick and dirty: keep `exp' sane */ +- if (exp >= EXPDMASK) +- exp = EXPDMASK - 1; ++ /* Check for underflow and denormals. */ ++ if (exp <= 0) ++ { ++ if (exp < -53) ++ { ++ ldl.l.middle = 0; ++ ldl.l.lower = 0; ++ } ++ else if (exp < -30) ++ { ++ ldl.l.lower = (ldl.l.middle & MANTXMASK) >> ((1 - exp) - 32); ++ ldl.l.middle &= ~MANTXMASK; ++ } ++ else ++ { ++ ldl.l.lower >>= 1 - exp; ++ ldl.l.lower |= (ldl.l.middle & MANTXMASK) << (32 - (1 - exp)); ++ ldl.l.middle = (ldl.l.middle & ~MANTXMASK) | (ldl.l.middle & MANTXMASK >> (1 - exp)); ++ } ++ exp = 0; ++ } ++ else if (exp == EXPXMASK - EXCESSX + EXCESSD) ++ { ++ exp = EXPDMASK; ++ ldl.l.middle |= ldl.l.lower; ++ } ++ else if (exp >= EXPDMASK) ++ { ++ exp = EXPDMASK; ++ ldl.l.middle = 0; ++ ldl.l.lower = 0; ++ } + dl.l.upper |= exp << (32 - (EXPDBITS + 1)); + /* +1-1: add one for sign bit, but take one off for explicit-integer-bit */ + dl.l.upper |= (ldl.l.middle & MANTXMASK) >> (EXPDBITS + 1 - 1); +@@ -511,10 +579,40 @@ __floatunsixf (unsigned long l) + + /* convert a long double to an int */ + long +-__fixxfsi (long double ld) ++__fixxfsi (long double a) + { +- long foo = __fixdfsi ((double) ld); +- return foo; ++ union long_double_long ldl; ++ long exp; ++ long l; ++ ++ ldl.ld = a; ++ ++ exp = EXPX(ldl); ++ if (exp == 0 && ldl.l.middle == 0 && ldl.l.lower == 0) ++ return 0; ++ ++ exp = exp - EXCESSX - 64; ++ ++ if (exp > 0) ++ { ++ /* Return largest integer. */ ++ return SIGNX (ldl) ? 0x80000000L : 0x7fffffffL; ++ } ++ ++ if (exp <= -64) ++ return 0; ++ ++ if (exp <= -32) ++ { ++ ldl.l.lower = ldl.l.middle >> (-exp - 32); ++ } ++ else if (exp < 0) ++ { ++ ldl.l.lower = ldl.l.lower >> -exp; ++ ldl.l.lower |= ldl.l.middle << (32 + exp); ++ } ++ ++ return SIGNX(ldl) ? -ldl.l.lower : ldl.l.lower; + } + + /* The remaining provide crude math support by working in double precision. */ +diff --git a/libgcc/config/m68k/lb1sf68.S b/libgcc/config/m68k/lb1sf68.S +index 8ba85c53656d..e12888bd7f89 100644 +--- a/libgcc/config/m68k/lb1sf68.S ++++ b/libgcc/config/m68k/lb1sf68.S +@@ -635,7 +635,7 @@ SYM (__modsi3): + .globl SYM (_fpCCR) + .globl $_exception_handler + +-QUIET_NaN = 0xffffffff ++QUIET_NaN = 0x7fffffff + + D_MAX_EXP = 0x07ff + D_BIAS = 1022 +@@ -700,9 +700,10 @@ Ld$overflow: + PICJUMP $_exception_handler + + Ld$underflow: +-| Return 0 and set the exception flags ++| Return a properly signed 0 and set the exception flags + movel IMM (0),d0 + movel d0,d1 ++ orl d7,d0 + movew IMM (INEXACT_RESULT+UNDERFLOW),d7 + moveq IMM (DOUBLE_FLOAT),d6 + PICJUMP $_exception_handler +@@ -711,6 +712,7 @@ Ld$inop: + | Return a quiet NaN and set the exception flags + movel IMM (QUIET_NaN),d0 + movel d0,d1 ++ bset IMM (31),d1 + movew IMM (INEXACT_RESULT+INVALID_OPERATION),d7 + moveq IMM (DOUBLE_FLOAT),d6 + PICJUMP $_exception_handler +@@ -1383,6 +1385,8 @@ Ladddf$a: + bge 2f | + movel d0,d0 | check for zero, since we don't ' + bne Ladddf$ret | want to return -0 by mistake ++ movel d1,d1 | ++ bne Ladddf$ret | + bclr IMM (31),d7 | + bra Ladddf$ret | + 2: +@@ -2080,6 +2084,7 @@ Ldivdf$b$nf: + | If d2 == 0x7ff00000 we have to check d3. + tstl d3 | + bne Ld$inop | if d3 <> 0, b is NaN ++ movel a0,d7 | put a's sign + bra Ld$underflow | else b is +/-INFINITY, so signal underflow + + Ldivdf$a$nf: +@@ -2090,8 +2095,7 @@ Ldivdf$a$nf: + | If a is INFINITY we have to check b + cmpl d7,d2 | compare b with INFINITY + bge Ld$inop | if b is NaN or INFINITY return NaN +- tstl d3 | +- bne Ld$inop | ++ movl a0,d7 | restore sign bit to d7 + bra Ld$overflow | else return overflow + + | If a number is denormalized we put an exponent of 1 but do not put the +@@ -2186,6 +2190,7 @@ Lround$exit: + #endif + beq 2f | if not loop back + bra 1b | ++ movel a0,d7 + bra Ld$underflow | safety check, shouldn't execute ' + 2: orl d6,d2 | this is a trick so we don't lose ' + orl d7,d3 | the bits which were flushed right +@@ -2548,7 +2553,7 @@ Lround$to$minus: + .globl SYM (_fpCCR) + .globl $_exception_handler + +-QUIET_NaN = 0xffffffff ++QUIET_NaN = 0x7fffffff + SIGNL_NaN = 0x7f800001 + INFINITY = 0x7f800000 + +@@ -2614,8 +2619,9 @@ Lf$overflow: + PICJUMP $_exception_handler + + Lf$underflow: +-| Return 0 and set the exception flags ++| Return a properly signed 0 and set the exception flags + moveq IMM (0),d0 ++ orl d7,d0 + moveq IMM (INEXACT_RESULT+UNDERFLOW),d7 + moveq IMM (SINGLE_FLOAT),d6 + PICJUMP $_exception_handler +@@ -2936,7 +2942,7 @@ Laddsf$4: + #else + cmpl IMM (0xff),d2 + #endif +- bhi 1f ++ bge 1f + bclr IMM (FLT_MANT_DIG-1),d0 + #ifndef __mcoldfire__ + lslw IMM (7),d2 diff --git a/packages/gcc/13.4.0/0013-libgcc-Exclude-UCLIBC-from-GLIBC-thread-check.patch b/packages/gcc/13.4.0/0013-libgcc-Exclude-UCLIBC-from-GLIBC-thread-check.patch new file mode 100644 index 00000000..b600262f --- /dev/null +++ b/packages/gcc/13.4.0/0013-libgcc-Exclude-UCLIBC-from-GLIBC-thread-check.patch @@ -0,0 +1,32 @@ +From 4931e2e89fd5edb3fb222132519e0ed731d644ef Mon Sep 17 00:00:00 2001 +From: Chris Packham +Date: Thu, 7 Sep 2023 19:26:49 +1200 +Subject: [PATCH] libgcc: Exclude UCLIBC from GLIBC thread check + +UBLIBC defines __GLIBC__ but also marks __pthread_key_create() as +protected. Leading to link errors with newer binutils such as: + + ld.bfd: isl_test_cpp17.o: non-canonical reference to canonical protected function `__pthread_key_create' in x86_64-multilib-linux-uclibc/sysroot/lib64/libc.so.1 + ld.bfd: failed to set dynamic section sizes: bad value + +Add a condition on !__UCLIBC__ when selecting a symbol to detect pthread +usage so it picks the intended pthread_cancel(). + +Signed-off-by: Chris Packham +--- + libgcc/gthr-posix.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libgcc/gthr-posix.h b/libgcc/gthr-posix.h +index aebcfdd9f4ca..087a631d308d 100644 +--- a/libgcc/gthr-posix.h ++++ b/libgcc/gthr-posix.h +@@ -233,7 +233,7 @@ __gthread_active_p (void) + library does not provide pthread_cancel, so we do use pthread_create + there (and interceptor libraries lose). */ + +-#ifdef __GLIBC__ ++#if defined(__GLIBC__) && !defined(__UCLIBC__) + __gthrw2(__gthrw_(__pthread_key_create), + __pthread_key_create, + pthread_key_create) diff --git a/packages/gcc/13.4.0/0014-LoongArch-Use-lib-instead-of-lib64-as-the-library-se.patch b/packages/gcc/13.4.0/0014-LoongArch-Use-lib-instead-of-lib64-as-the-library-se.patch new file mode 100644 index 00000000..74c785df --- /dev/null +++ b/packages/gcc/13.4.0/0014-LoongArch-Use-lib-instead-of-lib64-as-the-library-se.patch @@ -0,0 +1,77 @@ +From af5628a1c34dfd6e065ee0bad581564744c8c812 Mon Sep 17 00:00:00 2001 +From: Yang Yujie +Date: Wed, 6 Mar 2024 09:19:59 +0800 +Subject: [PATCH] LoongArch: Use /lib instead of /lib64 as the library search + path for MUSL. + +gcc/ChangeLog: + + * config.gcc: Add a case for loongarch*-*-linux-musl*. + * config/loongarch/linux.h: Disable the multilib-compatible + treatment for *musl* targets. + * config/loongarch/musl.h: New file. +--- + gcc/config.gcc | 3 +++ + gcc/config/loongarch/linux.h | 4 +++- + gcc/config/loongarch/musl.h | 23 +++++++++++++++++++++++ + 3 files changed, 29 insertions(+), 1 deletion(-) + create mode 100644 gcc/config/loongarch/musl.h + +diff --git a/gcc/config.gcc b/gcc/config.gcc +index 4f3bcd24edfa..ebf9aca7b09f 100644 +--- a/gcc/config.gcc ++++ b/gcc/config.gcc +@@ -2493,6 +2493,9 @@ riscv*-*-freebsd*) + + loongarch*-*-linux*) + tm_file="elfos.h gnu-user.h linux.h linux-android.h glibc-stdint.h ${tm_file}" ++ case ${target} in ++ *-linux-musl*) tm_file="${tm_file} loongarch/musl.h" ++ esac + tm_file="${tm_file} loongarch/gnu-user.h loongarch/linux.h" + extra_options="${extra_options} linux-android.opt" + tmake_file="${tmake_file} loongarch/t-linux" +diff --git a/gcc/config/loongarch/linux.h b/gcc/config/loongarch/linux.h +index 9059d244190a..f01d6f750616 100644 +--- a/gcc/config/loongarch/linux.h ++++ b/gcc/config/loongarch/linux.h +@@ -21,7 +21,9 @@ along with GCC; see the file COPYING3. If not see + * This ensures that a compiler configured with --disable-multilib + * can work in a multilib environment. */ + +-#if defined(LA_DISABLE_MULTILIB) && defined(LA_DISABLE_MULTIARCH) ++#if !defined(LA_DEFAULT_TARGET_MUSL) \ ++ && defined(LA_DISABLE_MULTILIB) \ ++ && defined(LA_DISABLE_MULTIARCH) + + #if DEFAULT_ABI_BASE == ABI_BASE_LP64D + #define ABI_LIBDIR "lib64" +diff --git a/gcc/config/loongarch/musl.h b/gcc/config/loongarch/musl.h +new file mode 100644 +index 000000000000..fa43bc866064 +--- /dev/null ++++ b/gcc/config/loongarch/musl.h +@@ -0,0 +1,23 @@ ++/* Definitions for MUSL C library support. ++ Copyright (C) 2024 Free Software Foundation, Inc. ++ ++This file is part of GCC. ++ ++GCC is free software; you can redistribute it and/or modify ++it under the terms of the GNU General Public License as published by ++the Free Software Foundation; either version 3, or (at your option) ++any later version. ++ ++GCC is distributed in the hope that it will be useful, ++but WITHOUT ANY WARRANTY; without even the implied warranty of ++MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++GNU General Public License for more details. ++ ++You should have received a copy of the GNU General Public License ++along with GCC; see the file COPYING3. If not see ++. */ ++ ++ ++#ifndef LA_DEFAULT_TARGET_MUSL ++#define LA_DEFAULT_TARGET_MUSL ++#endif diff --git a/packages/gcc/13.4.0/chksum b/packages/gcc/13.4.0/chksum new file mode 100644 index 00000000..32b23f25 --- /dev/null +++ b/packages/gcc/13.4.0/chksum @@ -0,0 +1,8 @@ +md5 gcc-13.4.0.tar.xz 260096adee8b1cf3dde6e61c11cccca6 +sha1 gcc-13.4.0.tar.xz 419c4f1a4b58134a34c00afa7327c6848a58050a +sha256 gcc-13.4.0.tar.xz 9c4ce6dbb040568fdc545588ac03c5cbc95a8dbf0c7aa490170843afb59ca8f5 +sha512 gcc-13.4.0.tar.xz 9b4b83ecf51ef355b868608b8d257b2fa435c06d2719cb86657a7c2c2a0828ff4ce04e9bac1055bbcad8ed5b4da524cafaef654785e23a50233d95d89201e35f +md5 gcc-13.4.0.tar.gz b5109687acfc3fc61c891b9a0dfe71b2 +sha1 gcc-13.4.0.tar.gz 36712b3b575715b8dc555113403e2082138ce9d1 +sha256 gcc-13.4.0.tar.gz bf0baf3e570c9c74c17c8201f0196c6924b4bd98c90e69d6b2ac0cd823f33bbc +sha512 gcc-13.4.0.tar.gz c4c1ab3c65690c4d872988113db0c402206fd250110ed3cd6c4df47a5030ce95865869bb3638873f123f75d5983bcb8c8c99a6e7f8978efd9f3cbb66faa9a8fb diff --git a/packages/gcc/13.4.0/experimental/0001-picolibc-Add-custom-spec-file-fragments-for-using-pi.patch b/packages/gcc/13.4.0/experimental/0001-picolibc-Add-custom-spec-file-fragments-for-using-pi.patch new file mode 100644 index 00000000..487a28c3 --- /dev/null +++ b/packages/gcc/13.4.0/experimental/0001-picolibc-Add-custom-spec-file-fragments-for-using-pi.patch @@ -0,0 +1,127 @@ +From b0f9ac365f91952f6f920c8e6aa4ddb819f47cc8 Mon Sep 17 00:00:00 2001 +From: Keith Packard +Date: Tue, 23 Aug 2022 22:13:08 -0700 +Subject: [PATCH] picolibc: Add custom spec file fragments for using + picolibc + +The '--oslib=' option allows targets to insert an OS library after the +C library in the LIB_PATH spec file fragment. This library maps a few +POSIX APIs used by picolibc to underlying system capabilities. + +The '--crt0=' option allows targets to use an alternate crt0 in place +of the usual one as provided by Picolibc. + +For example, picolibc provides 'libsemihost' and 'crt0-semihost.o' on +various targets which maps some POSIX APIs to semihosting capabilities +and signals the semihosting environment when 'main' returns. These +would be used by specifying --oslib=semihost --crt0=semihost. + +This patch also takes advantage of the IN_GPP conditional when +building g++ to elide exception handling contents from the executable +when not linking with the g++ driver. + +Signed-off-by: Keith Packard +--- + gcc/config.gcc | 7 +++++++ + gcc/config/picolibc.h | 44 ++++++++++++++++++++++++++++++++++++++++++++ + gcc/config/picolibc.opt | 33 +++++++++++++++++++++++++++++++++ + 3 files changed, 84 insertions(+) + create mode 100644 gcc/config/picolibc.h + create mode 100644 gcc/config/picolibc.opt + +--- a/gcc/config.gcc ++++ b/gcc/config.gcc +@@ -5931,3 +5931,10 @@ + tm_defines="$tm_defines DEFAULT_LIBC=$default_libc" + ;; + esac ++ ++case "$default_libc" in ++ LIBC_PICOLIBC) ++ extra_options="${extra_options} picolibc.opt" ++ tm_file="${tm_file} picolibc.h" ++ ;; ++esac +--- /dev/null ++++ b/gcc/config/picolibc.h +@@ -0,0 +1,44 @@ ++/* Configuration common to all targets running Picolibc. ++ Copyright (C) 2023 Free Software Foundation, Inc. ++ ++ This file is part of GCC. ++ ++ GCC is free software; you can redistribute it and/or modify it ++ under the terms of the GNU General Public License as published ++ by the Free Software Foundation; either version 3, or (at your ++ option) any later version. ++ ++ GCC is distributed in the hope that it will be useful, but WITHOUT ++ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ++ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public ++ License for more details. ++ ++ Under Section 7 of GPL version 3, you are granted additional ++ permissions described in the GCC Runtime Library Exception, version ++ 3.1, as published by the Free Software Foundation. ++ ++ You should have received a copy of the GNU General Public License and ++ a copy of the GCC Runtime Library Exception along with this program; ++ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see ++ . */ ++ ++#ifdef IN_GPP ++#define PICOLIBC_LD "picolibcpp.ld" ++#define PICOLIBC_BEGIN " crtbegin%O%s" ++#define PICOLIBC_END "crtend%O%s" ++#else ++#define PICOLIBC_LD "picolibc.ld" ++#define PICOLIBC_BEGIN "" ++#define PICOLIBC_END "" ++#endif ++ ++#undef LIB_SPEC ++#define LIB_SPEC "%{!T:-T" PICOLIBC_LD "} --start-group -lc %{-oslib=*:-l%*} %(libgcc) --end-group" ++ ++#undef STARTFILE_SPEC ++#define STARTFILE_SPEC "%{-crt0=*:crt0-%*%O%s; :crt0%O%s}" PICOLIBC_BEGIN ++ ++#undef ENDFILE_SPEC ++#define ENDFILE_SPEC PICOLIBC_END ++ ++#define EH_TABLES_CAN_BE_READ_ONLY 1 +--- /dev/null ++++ b/gcc/config/picolibc.opt +@@ -0,0 +1,33 @@ ++; Processor-independent options for picolibc. ++; ++; Copyright (C) 2022 Free Software Foundation, Inc. ++; ++; This file is part of GCC. ++; ++; GCC is free software; you can redistribute it and/or modify it under ++; the terms of the GNU General Public License as published by the Free ++; Software Foundation; either version 3, or (at your option) any later ++; version. ++; ++; GCC is distributed in the hope that it will be useful, but WITHOUT ANY ++; WARRANTY; without even the implied warranty of MERCHANTABILITY or ++; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ++; for more details. ++; ++; You should have received a copy of the GNU General Public License ++; along with GCC; see the file COPYING3. If not see ++; . ++ ++-oslib ++Driver Separate Alias(-oslib=) ++ ++-oslib= ++Driver Joined ++Specify an OS support library to load after libc. ++ ++-crt0 ++Driver Separate Alias(-crt0=) ++ ++-crt0= ++Driver Joined ++Specify an alternate startup file. diff --git a/packages/gcc/13.4.0/version.desc b/packages/gcc/13.4.0/version.desc new file mode 100644 index 00000000..e69de29b -- cgit v1.2.3