diff options
Diffstat (limited to 'packages/gcc')
63 files changed, 2550 insertions, 886 deletions
diff --git a/packages/gcc/12.4.0/0011-always-define-win32-lean-and-mean-before-windows-h.patch b/packages/gcc/12.4.0/0011-always-define-win32-lean-and-mean-before-windows-h.patch new file mode 100644 index 00000000..688ad8fe --- /dev/null +++ b/packages/gcc/12.4.0/0011-always-define-win32-lean-and-mean-before-windows-h.patch @@ -0,0 +1,379 @@ +Original patch for GCC 13 by LIU Hao <lh_mouse@126.com> + +Recently, mingw-w64 has got updated <msxml.h> from Wine which is included +indirectly by <windows.h> if `WIN32_LEAN_AND_MEAN` is not defined. The +`IXMLDOMDocument` class has a member function named `abort()`, which gets +affected by our `abort()` macro in "system.h". + +`WIN32_LEAN_AND_MEAN` should, nevertheless, always be defined. This +can exclude 'APIs such as Cryptography, DDE, RPC, Shell, and Windows +Sockets' [1], and speed up compilation of these files a bit. + +[1] https://learn.microsoft.com/en-us/windows/win32/winprog/using-the-windows-headers + +--- a/gcc/ada/adaint.c ++++ b/gcc/ada/adaint.c +@@ -227,6 +227,7 @@ UINT __gnat_current_ccs_encoding; + + #elif defined (_WIN32) + ++#define WIN32_LEAN_AND_MEAN + #include <windows.h> + #include <accctrl.h> + #include <aclapi.h> +--- a/gcc/ada/cio.c ++++ b/gcc/ada/cio.c +@@ -67,6 +67,7 @@ extern "C" { + #endif + + #ifdef RTX ++#define WIN32_LEAN_AND_MEAN + #include <windows.h> + #include <Rtapi.h> + #endif +--- a/gcc/ada/ctrl_c.c ++++ b/gcc/ada/ctrl_c.c +@@ -126,6 +126,7 @@ __gnat_uninstall_int_handler (void) + + #elif defined (__MINGW32__) + ++#define WIN32_LEAN_AND_MEAN + #include "mingw32.h" + #include <windows.h> + +--- a/gcc/ada/expect.c ++++ b/gcc/ada/expect.c +@@ -71,6 +71,7 @@ + + #ifdef _WIN32 + ++#define WIN32_LEAN_AND_MEAN + #include <windows.h> + #include <process.h> + #include <signal.h> +--- a/gcc/ada/gsocket.h ++++ b/gcc/ada/gsocket.h +@@ -167,6 +167,7 @@ + + #endif + ++#define WIN32_LEAN_AND_MEAN + #include <windows.h> + + #elif defined(VMS) +--- a/gcc/ada/mingw32.h ++++ b/gcc/ada/mingw32.h +@@ -53,6 +53,7 @@ + #define _X86INTRIN_H_INCLUDED + #define _EMMINTRIN_H_INCLUDED + #endif ++#define WIN32_LEAN_AND_MEAN + #include <windows.h> + + /* After including this file it is possible to use the character t as prefix +--- a/gcc/ada/mkdir.c ++++ b/gcc/ada/mkdir.c +@@ -43,6 +43,7 @@ + #endif + + #ifdef __MINGW32__ ++#define WIN32_LEAN_AND_MEAN + #include "mingw32.h" + #include <windows.h> + #ifdef MAXPATHLEN +--- a/gcc/ada/rtfinal.c ++++ b/gcc/ada/rtfinal.c +@@ -46,6 +46,7 @@ extern int __gnat_rt_init_count; + /* see initialize.c */ + + #if defined (__MINGW32__) ++#define WIN32_LEAN_AND_MEAN + #include "mingw32.h" + #include <windows.h> + +--- a/gcc/ada/rtinit.c ++++ b/gcc/ada/rtinit.c +@@ -70,6 +70,7 @@ int __gnat_rt_init_count = 0; + and finalize properly the run-time. */ + + #if defined (__MINGW32__) ++#define WIN32_LEAN_AND_MEAN + #include "mingw32.h" + #include <windows.h> + +--- a/gcc/ada/seh_init.c ++++ b/gcc/ada/seh_init.c +@@ -34,6 +34,7 @@ + + #if defined (_WIN32) || (defined (__CYGWIN__) && defined (__SEH__)) + /* Include system headers, before system.h poisons malloc. */ ++#define WIN32_LEAN_AND_MEAN + #include <windows.h> + #include <excpt.h> + #endif +--- a/gcc/ada/sysdep.c ++++ b/gcc/ada/sysdep.c +@@ -217,6 +217,7 @@ __gnat_ttyname (int filedes) + #endif /* __CYGWIN__ */ + + #if defined (__CYGWIN__) || defined (__MINGW32__) ++#define WIN32_LEAN_AND_MEAN + #include <windows.h> + + int __gnat_is_windows_xp (void); +@@ -589,6 +590,7 @@ getc_immediate_common (FILE *stream, + Ada programs. */ + + #ifdef WINNT ++#define WIN32_LEAN_AND_MEAN + #include <windows.h> + + /* Provide functions to echo the values passed to WinMain (windows bindings +--- a/gcc/ada/terminals.c ++++ b/gcc/ada/terminals.c +@@ -151,6 +151,7 @@ __gnat_setup_winsize (void *desc ATTRIBUTE_UNUSED, + #include <stdio.h> + #include <stdlib.h> + ++#define WIN32_LEAN_AND_MEAN + #include <windows.h> + #include <winternl.h> + #include <io.h> +--- a/gcc/ada/tracebak.c ++++ b/gcc/ada/tracebak.c +@@ -93,6 +93,7 @@ extern void (*Unlock_Task) (void); + + #if defined (_WIN64) && defined (__SEH__) + ++#define WIN32_LEAN_AND_MEAN + #include <windows.h> + + #define IS_BAD_PTR(ptr) (IsBadCodePtr((FARPROC)ptr)) +@@ -455,6 +456,7 @@ struct layout + #elif defined (__i386__) || defined (__x86_64__) + + #if defined (__WIN32) ++#define WIN32_LEAN_AND_MEAN + #include <windows.h> + #define IS_BAD_PTR(ptr) (IsBadCodePtr((FARPROC)ptr)) + #elif defined (__sun__) +--- a/gcc/diagnostic-color.cc ++++ b/gcc/diagnostic-color.cc +@@ -22,6 +22,7 @@ + #include "diagnostic-url.h" + + #ifdef __MINGW32__ ++# define WIN32_LEAN_AND_MEAN + # include <windows.h> + #endif + +--- a/gcc/jit/jit-w32.h ++++ b/gcc/jit/jit-w32.h +@@ -20,6 +20,7 @@ along with GCC; see the file COPYING3. If not see + + #include "config.h" + ++#define WIN32_LEAN_AND_MEAN + #include <windows.h> + + namespace gcc { +--- a/gcc/plugin.cc ++++ b/gcc/plugin.cc +@@ -41,6 +41,7 @@ along with GCC; see the file COPYING3. If not see + #ifndef NOMINMAX + #define NOMINMAX + #endif ++#define WIN32_LEAN_AND_MEAN + #include <windows.h> + #endif + +--- a/gcc/prefix.cc ++++ b/gcc/prefix.cc +@@ -67,6 +67,7 @@ License along with GCC; see the file COPYING3. If not see + #include "system.h" + #include "coretypes.h" + #if defined(_WIN32) && defined(ENABLE_WIN32_REGISTRY) ++#define WIN32_LEAN_AND_MEAN + #include <windows.h> + #endif + #include "prefix.h" +--- a/libatomic/config/mingw/lock.c ++++ b/libatomic/config/mingw/lock.c +@@ -23,6 +23,7 @@ + <http://www.gnu.org/licenses/>. */ + + #define UWORD __shadow_UWORD ++#define WIN32_LEAN_AND_MEAN + #include <windows.h> + #undef UWORD + #include "libatomic_i.h" +--- a/libffi/src/aarch64/ffi.c ++++ b/libffi/src/aarch64/ffi.c +@@ -28,6 +28,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + #include <ffi_common.h> + #include "internal.h" + #ifdef _WIN32 ++#define WIN32_LEAN_AND_MEAN + #include <windows.h> /* FlushInstructionCache */ + #endif + #include <tramp.h> +--- a/libgcc/config/i386/enable-execute-stack-mingw32.c ++++ b/libgcc/config/i386/enable-execute-stack-mingw32.c +@@ -22,6 +22,7 @@ + see the files COPYING3 and COPYING.RUNTIME respectively. If not, see + <http://www.gnu.org/licenses/>. */ + ++#define WIN32_LEAN_AND_MEAN + #include <windows.h> + + extern void __enable_execute_stack (void *); +--- a/libgcc/libgcc2.c ++++ b/libgcc/libgcc2.c +@@ -2273,6 +2273,7 @@ __clear_cache (void *beg __attribute__((__unused__)), + /* Jump to a trampoline, loading the static chain address. */ + + #if defined(WINNT) && ! defined(__CYGWIN__) ++#define WIN32_LEAN_AND_MEAN + #include <windows.h> + int getpagesize (void); + int mprotect (char *,int, int); +--- a/libgcc/unwind-generic.h ++++ b/libgcc/unwind-generic.h +@@ -30,6 +30,7 @@ + + #if defined (__SEH__) && !defined (__USING_SJLJ_EXCEPTIONS__) + /* Only for _GCC_specific_handler. */ ++#define WIN32_LEAN_AND_MEAN + #include <windows.h> + #endif + +--- a/libgfortran/intrinsics/sleep.c ++++ b/libgfortran/intrinsics/sleep.c +@@ -30,6 +30,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see + #endif + + #ifdef __MINGW32__ ++# define WIN32_LEAN_AND_MEAN + # include <windows.h> + # undef sleep + # define sleep(x) Sleep(1000*(x)) +--- a/libgo/misc/cgo/test/callback_c.c ++++ b/libgo/misc/cgo/test/callback_c.c +@@ -32,6 +32,7 @@ IntoC(void) + } + + #ifdef WIN32 ++#define WIN32_LEAN_AND_MEAN + #include <windows.h> + long long + mysleep(int seconds) { +--- a/libgomp/config/mingw32/proc.c ++++ b/libgomp/config/mingw32/proc.c +@@ -30,6 +30,7 @@ + The following implementation uses win32 API routines. */ + + #include "libgomp.h" ++#define WIN32_LEAN_AND_MEAN + #include <windows.h> + + /* Count the CPU's currently available to this process. */ +--- a/libiberty/make-temp-file.c ++++ b/libiberty/make-temp-file.c +@@ -37,6 +37,7 @@ Boston, MA 02110-1301, USA. */ + #include <sys/file.h> /* May get R_OK, etc. on some systems. */ + #endif + #if defined(_WIN32) && !defined(__CYGWIN__) ++#define WIN32_LEAN_AND_MEAN + #include <windows.h> + #endif + #if HAVE_SYS_STAT_H +--- a/libiberty/pex-win32.c ++++ b/libiberty/pex-win32.c +@@ -20,6 +20,7 @@ Boston, MA 02110-1301, USA. */ + + #include "pex-common.h" + ++#define WIN32_LEAN_AND_MEAN + #include <windows.h> + + #ifdef HAVE_STDLIB_H +--- a/libssp/ssp.c ++++ b/libssp/ssp.c +@@ -55,6 +55,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see + /* Native win32 apps don't know about /dev/tty but can print directly + to the console using "CONOUT$" */ + #if defined (_WIN32) && !defined (__CYGWIN__) ++#define WIN32_LEAN_AND_MEAN + #include <windows.h> + #include <wincrypt.h> + # define _PATH_TTY "CONOUT$" +--- a/libstdc++-v3/src/c++11/system_error.cc ++++ b/libstdc++-v3/src/c++11/system_error.cc +@@ -33,6 +33,7 @@ + #undef __sso_string + + #if defined(_WIN32) && !defined(__CYGWIN__) ++#define WIN32_LEAN_AND_MEAN + #include <memory> + #include <windows.h> + #endif +--- a/libstdc++-v3/src/c++11/thread.cc ++++ b/libstdc++-v3/src/c++11/thread.cc +@@ -34,6 +34,7 @@ + # ifdef _GLIBCXX_HAVE_SLEEP + # include <unistd.h> + # elif defined(_GLIBCXX_HAVE_WIN32_SLEEP) ++# define WIN32_LEAN_AND_MEAN + # include <windows.h> + # elif defined _GLIBCXX_NO_SLEEP && defined _GLIBCXX_HAS_GTHREADS + // We expect to be able to sleep for targets that support multiple threads: +--- a/libstdc++-v3/src/c++17/fs_ops.cc ++++ b/libstdc++-v3/src/c++17/fs_ops.cc +@@ -54,6 +54,7 @@ + # include <utime.h> // utime + #endif + #ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS ++# define WIN32_LEAN_AND_MEAN + # include <windows.h> + #endif + +--- a/libstdc++-v3/src/filesystem/ops.cc ++++ b/libstdc++-v3/src/filesystem/ops.cc +@@ -55,6 +55,7 @@ + # include <utime.h> // utime + #endif + #ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS ++# define WIN32_LEAN_AND_MEAN + # include <windows.h> + #endif + +--- a/libvtv/vtv_malloc.cc ++++ b/libvtv/vtv_malloc.cc +@@ -33,6 +33,7 @@ + #include <stdlib.h> + #include <unistd.h> + #if defined (__CYGWIN__) || defined (__MINGW32__) ++#define WIN32_LEAN_AND_MEAN + #include <windows.h> + #else + #include <sys/mman.h> +--- a/libvtv/vtv_rts.cc ++++ b/libvtv/vtv_rts.cc +@@ -121,6 +121,7 @@ + #include <stdio.h> + #include <string.h> + #if defined (__CYGWIN__) || defined (__MINGW32__) ++#define WIN32_LEAN_AND_MEAN + #include <windows.h> + #include <winternl.h> + #include <psapi.h> +--- a/libvtv/vtv_utils.cc ++++ b/libvtv/vtv_utils.cc +@@ -33,6 +33,7 @@ + #include <stdlib.h> + #include <string.h> + #if defined (__CYGWIN__) || defined (__MINGW32__) ++#define WIN32_LEAN_AND_MEAN + #include <windows.h> + #else + #include <execinfo.h> 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/0000-libtool-leave-framework-alone.patch b/packages/gcc/13.4.0/0000-libtool-leave-framework-alone.patch index 1a86e415..1a86e415 100644 --- a/packages/gcc/13.3.0/0000-libtool-leave-framework-alone.patch +++ b/packages/gcc/13.4.0/0000-libtool-leave-framework-alone.patch diff --git a/packages/gcc/13.3.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 index 5f9a07a2..5f9a07a2 100644 --- a/packages/gcc/13.3.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 diff --git a/packages/gcc/13.3.0/0002-arm-softfloat-libgcc.patch b/packages/gcc/13.4.0/0002-arm-softfloat-libgcc.patch index d9800365..d9800365 100644 --- a/packages/gcc/13.3.0/0002-arm-softfloat-libgcc.patch +++ b/packages/gcc/13.4.0/0002-arm-softfloat-libgcc.patch diff --git a/packages/gcc/13.3.0/0003-libgcc-disable-split-stack-nothreads.patch b/packages/gcc/13.4.0/0003-libgcc-disable-split-stack-nothreads.patch index df91a9ff..df91a9ff 100644 --- a/packages/gcc/13.3.0/0003-libgcc-disable-split-stack-nothreads.patch +++ b/packages/gcc/13.4.0/0003-libgcc-disable-split-stack-nothreads.patch diff --git a/packages/gcc/13.3.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 index e079849a..e079849a 100644 --- a/packages/gcc/13.3.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 diff --git a/packages/gcc/13.3.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 index a56f02ad..a56f02ad 100644 --- a/packages/gcc/13.3.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 diff --git a/packages/gcc/13.3.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 index e7813e7b..e7813e7b 100644 --- a/packages/gcc/13.3.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 diff --git a/packages/gcc/13.3.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 index fadbdac2..fadbdac2 100644 --- a/packages/gcc/13.3.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 diff --git a/packages/gcc/13.3.0/0008-Support-picolibc-targets.patch b/packages/gcc/13.4.0/0008-Support-picolibc-targets.patch index 754bd576..754bd576 100644 --- a/packages/gcc/13.3.0/0008-Support-picolibc-targets.patch +++ b/packages/gcc/13.4.0/0008-Support-picolibc-targets.patch diff --git a/packages/gcc/13.3.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 index 9cded7c2..9cded7c2 100644 --- a/packages/gcc/13.3.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 diff --git a/packages/gcc/13.3.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 index 86d86b14..86d86b14 100644 --- a/packages/gcc/13.3.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 diff --git a/packages/gcc/13.3.0/0011-Remove-crypt-and-crypt_r-interceptors.patch b/packages/gcc/13.4.0/0011-Remove-crypt-and-crypt_r-interceptors.patch index 4cc71959..4cc71959 100644 --- a/packages/gcc/13.3.0/0011-Remove-crypt-and-crypt_r-interceptors.patch +++ b/packages/gcc/13.4.0/0011-Remove-crypt-and-crypt_r-interceptors.patch diff --git a/packages/gcc/13.3.0/0012-libgcc-m68k-Fixes-for-soft-float.patch b/packages/gcc/13.4.0/0012-libgcc-m68k-Fixes-for-soft-float.patch index caa6664a..caa6664a 100644 --- a/packages/gcc/13.3.0/0012-libgcc-m68k-Fixes-for-soft-float.patch +++ b/packages/gcc/13.4.0/0012-libgcc-m68k-Fixes-for-soft-float.patch diff --git a/packages/gcc/13.3.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 index b600262f..b600262f 100644 --- a/packages/gcc/13.3.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 diff --git a/packages/gcc/13.3.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 index 74c785df..74c785df 100644 --- a/packages/gcc/13.3.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 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.3.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 index 487a28c3..487a28c3 100644 --- a/packages/gcc/13.3.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 diff --git a/packages/gcc/13.3.0/version.desc b/packages/gcc/13.4.0/version.desc index e69de29b..e69de29b 100644 --- a/packages/gcc/13.3.0/version.desc +++ b/packages/gcc/13.4.0/version.desc diff --git a/packages/gcc/14.2.0/0011-aarch64-Fix-invalid-nested-subregs-PR115464.patch b/packages/gcc/14.2.0/0011-aarch64-Fix-invalid-nested-subregs-PR115464.patch deleted file mode 100644 index 2625c308..00000000 --- a/packages/gcc/14.2.0/0011-aarch64-Fix-invalid-nested-subregs-PR115464.patch +++ /dev/null @@ -1,139 +0,0 @@ -From cb547fed9177c2a28f376c881facfcf4b64e70a9 Mon Sep 17 00:00:00 2001 -From: Richard Sandiford <richard.sandiford@arm.com> -Date: Thu, 13 Jun 2024 12:48:21 +0100 -Subject: [PATCH 11/16] aarch64: Fix invalid nested subregs [PR115464] - -The testcase extracts one arm_neon.h vector from a pair (one subreg) -and then reinterprets the result as an SVE vector (another subreg). -Each subreg makes sense individually, but we can't fold them together -into a single subreg: it's 32 bytes -> 16 bytes -> 16*N bytes, -but the interpretation of 32 bytes -> 16*N bytes depends on -whether N==1 or N>1. - -Since the second subreg makes sense individually, simplify_subreg -should bail out rather than ICE on it. simplify_gen_subreg will -then do the same (because it already checks validate_subreg). -This leaves simplify_gen_subreg returning null, requiring the -caller to take appropriate action. - -I think this is relatively likely to occur elsewhere, so the patch -adds a helper for forcing a subreg, allowing a temporary pseudo to -be created where necessary. - -I'll follow up by using force_subreg in more places. This patch -is intended to be a minimal backportable fix for the PR. - -gcc/ - PR target/115464 - * simplify-rtx.cc (simplify_context::simplify_subreg): Don't try - to fold two subregs together if their relationship isn't known - at compile time. - * explow.h (force_subreg): Declare. - * explow.cc (force_subreg): New function. - * config/aarch64/aarch64-sve-builtins-base.cc - (svset_neonq_impl::expand): Use it instead of simplify_gen_subreg. - -gcc/testsuite/ - PR target/115464 - * gcc.target/aarch64/sve/acle/general/pr115464.c: New test. - -(cherry picked from commit 0970ff46ba6330fc80e8736fc05b2eaeeae0b6a0) ---- - gcc/config/aarch64/aarch64-sve-builtins-base.cc | 2 +- - gcc/explow.cc | 15 +++++++++++++++ - gcc/explow.h | 2 ++ - gcc/simplify-rtx.cc | 5 +++++ - .../aarch64/sve/acle/general/pr115464.c | 13 +++++++++++++ - 5 files changed, 36 insertions(+), 1 deletion(-) - create mode 100644 gcc/testsuite/gcc.target/aarch64/sve/acle/general/pr115464.c - -diff --git a/gcc/config/aarch64/aarch64-sve-builtins-base.cc b/gcc/config/aarch64/aarch64-sve-builtins-base.cc -index 0d2edf3f19e..c9182594bc1 100644 ---- a/gcc/config/aarch64/aarch64-sve-builtins-base.cc -+++ b/gcc/config/aarch64/aarch64-sve-builtins-base.cc -@@ -1174,7 +1174,7 @@ public: - Advanced SIMD argument as an SVE vector. */ - if (!BYTES_BIG_ENDIAN - && is_undef (CALL_EXPR_ARG (e.call_expr, 0))) -- return simplify_gen_subreg (mode, e.args[1], GET_MODE (e.args[1]), 0); -+ return force_subreg (mode, e.args[1], GET_MODE (e.args[1]), 0); - - rtx_vector_builder builder (VNx16BImode, 16, 2); - for (unsigned int i = 0; i < 16; i++) -diff --git a/gcc/explow.cc b/gcc/explow.cc -index 8e5f6b8e680..f6843398c4b 100644 ---- a/gcc/explow.cc -+++ b/gcc/explow.cc -@@ -745,6 +745,21 @@ force_reg (machine_mode mode, rtx x) - return temp; - } - -+/* Like simplify_gen_subreg, but force OP into a new register if the -+ subreg cannot be formed directly. */ -+ -+rtx -+force_subreg (machine_mode outermode, rtx op, -+ machine_mode innermode, poly_uint64 byte) -+{ -+ rtx x = simplify_gen_subreg (outermode, op, innermode, byte); -+ if (x) -+ return x; -+ -+ op = copy_to_mode_reg (innermode, op); -+ return simplify_gen_subreg (outermode, op, innermode, byte); -+} -+ - /* If X is a memory ref, copy its contents to a new temp reg and return - that reg. Otherwise, return X. */ - -diff --git a/gcc/explow.h b/gcc/explow.h -index 16aa02cfb68..cbd1fcb7eb3 100644 ---- a/gcc/explow.h -+++ b/gcc/explow.h -@@ -42,6 +42,8 @@ extern rtx copy_to_suggested_reg (rtx, rtx, machine_mode); - Args are mode (in case value is a constant) and the value. */ - extern rtx force_reg (machine_mode, rtx); - -+extern rtx force_subreg (machine_mode, rtx, machine_mode, poly_uint64); -+ - /* Return given rtx, copied into a new temp reg if it was in memory. */ - extern rtx force_not_mem (rtx); - -diff --git a/gcc/simplify-rtx.cc b/gcc/simplify-rtx.cc -index dceaa13333c..729d408aa55 100644 ---- a/gcc/simplify-rtx.cc -+++ b/gcc/simplify-rtx.cc -@@ -7612,6 +7612,11 @@ simplify_context::simplify_subreg (machine_mode outermode, rtx op, - poly_uint64 innermostsize = GET_MODE_SIZE (innermostmode); - rtx newx; - -+ /* Make sure that the relationship between the two subregs is -+ known at compile time. */ -+ if (!ordered_p (outersize, innermostsize)) -+ return NULL_RTX; -+ - if (outermode == innermostmode - && known_eq (byte, 0U) - && known_eq (SUBREG_BYTE (op), 0)) -diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general/pr115464.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general/pr115464.c -new file mode 100644 -index 00000000000..d728d1325ed ---- /dev/null -+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general/pr115464.c -@@ -0,0 +1,13 @@ -+/* { dg-options "-O2" } */ -+ -+#include <arm_neon.h> -+#include <arm_sve.h> -+#include <arm_neon_sve_bridge.h> -+ -+svuint16_t -+convolve4_4_x (uint16x8x2_t permute_tbl) -+{ -+ return svset_neonq_u16 (svundef_u16 (), permute_tbl.val[1]); -+} -+ -+/* { dg-final { scan-assembler {\tmov\tz0\.d, z1\.d\n} } } */ --- -2.44.2 - diff --git a/packages/gcc/14.2.0/0012-aarch64-Use-force_subreg-in-more-places.patch b/packages/gcc/14.2.0/0012-aarch64-Use-force_subreg-in-more-places.patch deleted file mode 100644 index bddf3977..00000000 --- a/packages/gcc/14.2.0/0012-aarch64-Use-force_subreg-in-more-places.patch +++ /dev/null @@ -1,114 +0,0 @@ -From 12d860b5b700b5218461a0b9e4a1a3ddb55eb211 Mon Sep 17 00:00:00 2001 -From: Richard Sandiford <richard.sandiford@arm.com> -Date: Tue, 18 Jun 2024 12:22:30 +0100 -Subject: [PATCH 12/16] aarch64: Use force_subreg in more places - -This patch makes the aarch64 code use force_subreg instead of -simplify_gen_subreg in more places. The criteria were: - -(1) The code is obviously specific to expand (where new pseudos - can be created). - -(2) The value is obviously an rvalue rather than an lvalue. - -(3) The offset wasn't a simple lowpart or highpart calculation; - a later patch will deal with those. - -gcc/ - * config/aarch64/aarch64-builtins.cc (aarch64_expand_fcmla_builtin): - Use force_subreg instead of simplify_gen_subreg. - * config/aarch64/aarch64-simd.md (ctz<mode>2): Likewise. - * config/aarch64/aarch64-sve-builtins-base.cc - (svget_impl::expand): Likewise. - (svget_neonq_impl::expand): Likewise. - * config/aarch64/aarch64-sve-builtins-functions.h - (multireg_permute::expand): Likewise. - -(cherry picked from commit 1474a8eead4ab390e59ee014befa8c40346679f4) ---- - gcc/config/aarch64/aarch64-builtins.cc | 4 ++-- - gcc/config/aarch64/aarch64-simd.md | 4 ++-- - gcc/config/aarch64/aarch64-sve-builtins-base.cc | 8 +++----- - gcc/config/aarch64/aarch64-sve-builtins-functions.h | 6 +++--- - 4 files changed, 10 insertions(+), 12 deletions(-) - -diff --git a/gcc/config/aarch64/aarch64-builtins.cc b/gcc/config/aarch64/aarch64-builtins.cc -index 75d21de1401..b2e46a073a8 100644 ---- a/gcc/config/aarch64/aarch64-builtins.cc -+++ b/gcc/config/aarch64/aarch64-builtins.cc -@@ -2510,12 +2510,12 @@ aarch64_expand_fcmla_builtin (tree exp, rtx target, int fcode) - rtx temp2 = gen_reg_rtx (DImode); - temp1 = simplify_gen_subreg (d->mode, op2, quadmode, - subreg_lowpart_offset (d->mode, quadmode)); -- temp1 = simplify_gen_subreg (V2DImode, temp1, d->mode, 0); -+ temp1 = force_subreg (V2DImode, temp1, d->mode, 0); - if (BYTES_BIG_ENDIAN) - emit_insn (gen_aarch64_get_lanev2di (temp2, temp1, const0_rtx)); - else - emit_insn (gen_aarch64_get_lanev2di (temp2, temp1, const1_rtx)); -- op2 = simplify_gen_subreg (d->mode, temp2, GET_MODE (temp2), 0); -+ op2 = force_subreg (d->mode, temp2, GET_MODE (temp2), 0); - - /* And recalculate the index. */ - lane -= nunits / 4; -diff --git a/gcc/config/aarch64/aarch64-simd.md b/gcc/config/aarch64/aarch64-simd.md -index 33ab0741e87..5b9efe0b165 100644 ---- a/gcc/config/aarch64/aarch64-simd.md -+++ b/gcc/config/aarch64/aarch64-simd.md -@@ -412,8 +412,8 @@ - "TARGET_SIMD" - { - emit_insn (gen_bswap<mode>2 (operands[0], operands[1])); -- rtx op0_castsi2qi = simplify_gen_subreg(<VS:VSI2QI>mode, operands[0], -- <MODE>mode, 0); -+ rtx op0_castsi2qi = force_subreg (<VS:VSI2QI>mode, operands[0], -+ <MODE>mode, 0); - emit_insn (gen_aarch64_rbit<VS:vsi2qi> (op0_castsi2qi, op0_castsi2qi)); - emit_insn (gen_clz<mode>2 (operands[0], operands[0])); - DONE; -diff --git a/gcc/config/aarch64/aarch64-sve-builtins-base.cc b/gcc/config/aarch64/aarch64-sve-builtins-base.cc -index c9182594bc1..2c95da79572 100644 ---- a/gcc/config/aarch64/aarch64-sve-builtins-base.cc -+++ b/gcc/config/aarch64/aarch64-sve-builtins-base.cc -@@ -1121,9 +1121,8 @@ public: - expand (function_expander &e) const override - { - /* Fold the access into a subreg rvalue. */ -- return simplify_gen_subreg (e.vector_mode (0), e.args[0], -- GET_MODE (e.args[0]), -- INTVAL (e.args[1]) * BYTES_PER_SVE_VECTOR); -+ return force_subreg (e.vector_mode (0), e.args[0], GET_MODE (e.args[0]), -+ INTVAL (e.args[1]) * BYTES_PER_SVE_VECTOR); - } - }; - -@@ -1157,8 +1156,7 @@ public: - e.add_fixed_operand (indices); - return e.generate_insn (icode); - } -- return simplify_gen_subreg (e.result_mode (), e.args[0], -- GET_MODE (e.args[0]), 0); -+ return force_subreg (e.result_mode (), e.args[0], GET_MODE (e.args[0]), 0); - } - }; - -diff --git a/gcc/config/aarch64/aarch64-sve-builtins-functions.h b/gcc/config/aarch64/aarch64-sve-builtins-functions.h -index 3b8e575e98e..7d06a57ff83 100644 ---- a/gcc/config/aarch64/aarch64-sve-builtins-functions.h -+++ b/gcc/config/aarch64/aarch64-sve-builtins-functions.h -@@ -639,9 +639,9 @@ public: - { - machine_mode elt_mode = e.vector_mode (0); - rtx arg = e.args[0]; -- e.args[0] = simplify_gen_subreg (elt_mode, arg, GET_MODE (arg), 0); -- e.args.safe_push (simplify_gen_subreg (elt_mode, arg, GET_MODE (arg), -- GET_MODE_SIZE (elt_mode))); -+ e.args[0] = force_subreg (elt_mode, arg, GET_MODE (arg), 0); -+ e.args.safe_push (force_subreg (elt_mode, arg, GET_MODE (arg), -+ GET_MODE_SIZE (elt_mode))); - } - return e.use_exact_insn (icode); - } --- -2.44.2 - diff --git a/packages/gcc/14.2.0/0013-aarch64-Add-some-uses-of-force_lowpart_subreg.patch b/packages/gcc/14.2.0/0013-aarch64-Add-some-uses-of-force_lowpart_subreg.patch deleted file mode 100644 index fd4d9847..00000000 --- a/packages/gcc/14.2.0/0013-aarch64-Add-some-uses-of-force_lowpart_subreg.patch +++ /dev/null @@ -1,167 +0,0 @@ -From eb49bbb886ef374eddb93e866c9c9f5f314c8014 Mon Sep 17 00:00:00 2001 -From: Richard Sandiford <richard.sandiford@arm.com> -Date: Tue, 18 Jun 2024 12:22:31 +0100 -Subject: [PATCH 13/16] aarch64: Add some uses of force_lowpart_subreg - -This patch makes more use of force_lowpart_subreg, similarly -to the recent patch for force_subreg. The criteria were: - -(1) The code is obviously specific to expand (where new pseudos - can be created). - -(2) The value is obviously an rvalue rather than an lvalue. - -gcc/ - PR target/115464 - * config/aarch64/aarch64-builtins.cc (aarch64_expand_fcmla_builtin) - (aarch64_expand_rwsr_builtin): Use force_lowpart_subreg instead of - simplify_gen_subreg and lowpart_subreg. - * config/aarch64/aarch64-sve-builtins-base.cc - (svset_neonq_impl::expand): Likewise. - * config/aarch64/aarch64-sve-builtins-sme.cc - (add_load_store_slice_operand): Likewise. - * config/aarch64/aarch64.cc (aarch64_sve_reinterpret): Likewise. - (aarch64_addti_scratch_regs, aarch64_subvti_scratch_regs): Likewise. - -gcc/testsuite/ - PR target/115464 - * gcc.target/aarch64/sve/acle/general/pr115464_2.c: New test. - -(cherry picked from commit 6bd4fbae45d11795a9a6f54b866308d4d7134def) ---- - gcc/config/aarch64/aarch64-builtins.cc | 11 +++++------ - gcc/config/aarch64/aarch64-sve-builtins-base.cc | 2 +- - gcc/config/aarch64/aarch64-sve-builtins-sme.cc | 2 +- - gcc/config/aarch64/aarch64.cc | 14 +++++--------- - .../aarch64/sve/acle/general/pr115464_2.c | 11 +++++++++++ - 5 files changed, 23 insertions(+), 17 deletions(-) - create mode 100644 gcc/testsuite/gcc.target/aarch64/sve/acle/general/pr115464_2.c - -diff --git a/gcc/config/aarch64/aarch64-builtins.cc b/gcc/config/aarch64/aarch64-builtins.cc -index b2e46a073a8..264b9560709 100644 ---- a/gcc/config/aarch64/aarch64-builtins.cc -+++ b/gcc/config/aarch64/aarch64-builtins.cc -@@ -2497,8 +2497,7 @@ aarch64_expand_fcmla_builtin (tree exp, rtx target, int fcode) - int lane = INTVAL (lane_idx); - - if (lane < nunits / 4) -- op2 = simplify_gen_subreg (d->mode, op2, quadmode, -- subreg_lowpart_offset (d->mode, quadmode)); -+ op2 = force_lowpart_subreg (d->mode, op2, quadmode); - else - { - /* Select the upper 64 bits, either a V2SF or V4HF, this however -@@ -2508,8 +2507,7 @@ aarch64_expand_fcmla_builtin (tree exp, rtx target, int fcode) - gen_highpart_mode generates code that isn't optimal. */ - rtx temp1 = gen_reg_rtx (d->mode); - rtx temp2 = gen_reg_rtx (DImode); -- temp1 = simplify_gen_subreg (d->mode, op2, quadmode, -- subreg_lowpart_offset (d->mode, quadmode)); -+ temp1 = force_lowpart_subreg (d->mode, op2, quadmode); - temp1 = force_subreg (V2DImode, temp1, d->mode, 0); - if (BYTES_BIG_ENDIAN) - emit_insn (gen_aarch64_get_lanev2di (temp2, temp1, const0_rtx)); -@@ -2754,7 +2752,7 @@ aarch64_expand_rwsr_builtin (tree exp, rtx target, int fcode) - case AARCH64_WSR64: - case AARCH64_WSRF64: - case AARCH64_WSR128: -- subreg = lowpart_subreg (sysreg_mode, input_val, mode); -+ subreg = force_lowpart_subreg (sysreg_mode, input_val, mode); - break; - case AARCH64_WSRF: - subreg = gen_lowpart_SUBREG (SImode, input_val); -@@ -2789,7 +2787,8 @@ aarch64_expand_rwsr_builtin (tree exp, rtx target, int fcode) - case AARCH64_RSR64: - case AARCH64_RSRF64: - case AARCH64_RSR128: -- return lowpart_subreg (TYPE_MODE (TREE_TYPE (exp)), target, sysreg_mode); -+ return force_lowpart_subreg (TYPE_MODE (TREE_TYPE (exp)), -+ target, sysreg_mode); - case AARCH64_RSRF: - subreg = gen_lowpart_SUBREG (SImode, target); - return gen_lowpart_SUBREG (SFmode, subreg); -diff --git a/gcc/config/aarch64/aarch64-sve-builtins-base.cc b/gcc/config/aarch64/aarch64-sve-builtins-base.cc -index 2c95da79572..3c970e9c5f8 100644 ---- a/gcc/config/aarch64/aarch64-sve-builtins-base.cc -+++ b/gcc/config/aarch64/aarch64-sve-builtins-base.cc -@@ -1183,7 +1183,7 @@ public: - if (BYTES_BIG_ENDIAN) - return e.use_exact_insn (code_for_aarch64_sve_set_neonq (mode)); - insn_code icode = code_for_vcond_mask (mode, mode); -- e.args[1] = lowpart_subreg (mode, e.args[1], GET_MODE (e.args[1])); -+ e.args[1] = force_lowpart_subreg (mode, e.args[1], GET_MODE (e.args[1])); - e.add_output_operand (icode); - e.add_input_operand (icode, e.args[1]); - e.add_input_operand (icode, e.args[0]); -diff --git a/gcc/config/aarch64/aarch64-sve-builtins-sme.cc b/gcc/config/aarch64/aarch64-sve-builtins-sme.cc -index f4c91bcbb95..b66b35ae60b 100644 ---- a/gcc/config/aarch64/aarch64-sve-builtins-sme.cc -+++ b/gcc/config/aarch64/aarch64-sve-builtins-sme.cc -@@ -112,7 +112,7 @@ add_load_store_slice_operand (function_expander &e, insn_code icode, - rtx base = e.args[argno]; - if (e.mode_suffix_id == MODE_vnum) - { -- rtx vnum = lowpart_subreg (SImode, e.args[vnum_argno], DImode); -+ rtx vnum = force_lowpart_subreg (SImode, e.args[vnum_argno], DImode); - base = simplify_gen_binary (PLUS, SImode, base, vnum); - } - e.add_input_operand (icode, base); -diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc -index 1beec94629d..a064aeecbc0 100644 ---- a/gcc/config/aarch64/aarch64.cc -+++ b/gcc/config/aarch64/aarch64.cc -@@ -3284,7 +3284,7 @@ aarch64_sve_reinterpret (machine_mode mode, rtx x) - /* can_change_mode_class must only return true if subregs and svreinterprets - have the same semantics. */ - if (targetm.can_change_mode_class (GET_MODE (x), mode, FP_REGS)) -- return lowpart_subreg (mode, x, GET_MODE (x)); -+ return force_lowpart_subreg (mode, x, GET_MODE (x)); - - rtx res = gen_reg_rtx (mode); - x = force_reg (GET_MODE (x), x); -@@ -26979,9 +26979,8 @@ aarch64_addti_scratch_regs (rtx op1, rtx op2, rtx *low_dest, - rtx *high_in2) - { - *low_dest = gen_reg_rtx (DImode); -- *low_in1 = gen_lowpart (DImode, op1); -- *low_in2 = simplify_gen_subreg (DImode, op2, TImode, -- subreg_lowpart_offset (DImode, TImode)); -+ *low_in1 = force_lowpart_subreg (DImode, op1, TImode); -+ *low_in2 = force_lowpart_subreg (DImode, op2, TImode); - *high_dest = gen_reg_rtx (DImode); - *high_in1 = gen_highpart (DImode, op1); - *high_in2 = simplify_gen_subreg (DImode, op2, TImode, -@@ -27013,11 +27012,8 @@ aarch64_subvti_scratch_regs (rtx op1, rtx op2, rtx *low_dest, - rtx *high_in2) - { - *low_dest = gen_reg_rtx (DImode); -- *low_in1 = simplify_gen_subreg (DImode, op1, TImode, -- subreg_lowpart_offset (DImode, TImode)); -- -- *low_in2 = simplify_gen_subreg (DImode, op2, TImode, -- subreg_lowpart_offset (DImode, TImode)); -+ *low_in1 = force_lowpart_subreg (DImode, op1, TImode); -+ *low_in2 = force_lowpart_subreg (DImode, op2, TImode); - *high_dest = gen_reg_rtx (DImode); - - *high_in1 = simplify_gen_subreg (DImode, op1, TImode, -diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general/pr115464_2.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general/pr115464_2.c -new file mode 100644 -index 00000000000..f561c34f732 ---- /dev/null -+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general/pr115464_2.c -@@ -0,0 +1,11 @@ -+/* { dg-options "-O2" } */ -+ -+#include <arm_neon.h> -+#include <arm_sve.h> -+#include <arm_neon_sve_bridge.h> -+ -+svuint16_t -+convolve4_4_x (uint16x8x2_t permute_tbl, svuint16_t a) -+{ -+ return svset_neonq_u16 (a, permute_tbl.val[1]); -+} --- -2.44.2 - diff --git a/packages/gcc/14.2.0/0014-Add-force_lowpart_subreg.patch b/packages/gcc/14.2.0/0014-Add-force_lowpart_subreg.patch deleted file mode 100644 index 17fc7b64..00000000 --- a/packages/gcc/14.2.0/0014-Add-force_lowpart_subreg.patch +++ /dev/null @@ -1,121 +0,0 @@ -From 2dcdf9d026ed2e881b0bd8b378ed072e410490fe Mon Sep 17 00:00:00 2001 -From: Richard Sandiford <richard.sandiford@arm.com> -Date: Tue, 18 Jun 2024 12:22:31 +0100 -Subject: [PATCH 14/16] Add force_lowpart_subreg - -optabs had a local function called lowpart_subreg_maybe_copy -that is very similar to the lowpart version of force_subreg. -This patch adds a force_lowpart_subreg wrapper around -force_subreg and uses it in optabs.cc. - -The only difference between the old and new functions is that -the old one asserted success while the new one doesn't. -It's common not to assert elsewhere when taking subregs; -normally a null result is enough. - -Later patches will make more use of the new function. - -gcc/ - * explow.h (force_lowpart_subreg): Declare. - * explow.cc (force_lowpart_subreg): New function. - * optabs.cc (lowpart_subreg_maybe_copy): Delete. - (expand_absneg_bit): Use force_lowpart_subreg instead of - lowpart_subreg_maybe_copy. - (expand_copysign_bit): Likewise. - -(cherry picked from commit 5f40d1c0cc6ce91ef28d326b8707b3f05e6f239c) ---- - gcc/explow.cc | 14 ++++++++++++++ - gcc/explow.h | 1 + - gcc/optabs.cc | 24 ++---------------------- - 3 files changed, 17 insertions(+), 22 deletions(-) - -diff --git a/gcc/explow.cc b/gcc/explow.cc -index f6843398c4b..5fdfa81f69b 100644 ---- a/gcc/explow.cc -+++ b/gcc/explow.cc -@@ -760,6 +760,20 @@ force_subreg (machine_mode outermode, rtx op, - return simplify_gen_subreg (outermode, op, innermode, byte); - } - -+/* Try to return an rvalue expression for the OUTERMODE lowpart of OP, -+ which has mode INNERMODE. Allow OP to be forced into a new register -+ if necessary. -+ -+ Return null on failure. */ -+ -+rtx -+force_lowpart_subreg (machine_mode outermode, rtx op, -+ machine_mode innermode) -+{ -+ auto byte = subreg_lowpart_offset (outermode, innermode); -+ return force_subreg (outermode, op, innermode, byte); -+} -+ - /* If X is a memory ref, copy its contents to a new temp reg and return - that reg. Otherwise, return X. */ - -diff --git a/gcc/explow.h b/gcc/explow.h -index cbd1fcb7eb3..dd654649b06 100644 ---- a/gcc/explow.h -+++ b/gcc/explow.h -@@ -43,6 +43,7 @@ extern rtx copy_to_suggested_reg (rtx, rtx, machine_mode); - extern rtx force_reg (machine_mode, rtx); - - extern rtx force_subreg (machine_mode, rtx, machine_mode, poly_uint64); -+extern rtx force_lowpart_subreg (machine_mode, rtx, machine_mode); - - /* Return given rtx, copied into a new temp reg if it was in memory. */ - extern rtx force_not_mem (rtx); -diff --git a/gcc/optabs.cc b/gcc/optabs.cc -index ce91f94ed43..804c0dc73ba 100644 ---- a/gcc/optabs.cc -+++ b/gcc/optabs.cc -@@ -3096,26 +3096,6 @@ expand_ffs (scalar_int_mode mode, rtx op0, rtx target) - return 0; - } - --/* Extract the OMODE lowpart from VAL, which has IMODE. Under certain -- conditions, VAL may already be a SUBREG against which we cannot generate -- a further SUBREG. In this case, we expect forcing the value into a -- register will work around the situation. */ -- --static rtx --lowpart_subreg_maybe_copy (machine_mode omode, rtx val, -- machine_mode imode) --{ -- rtx ret; -- ret = lowpart_subreg (omode, val, imode); -- if (ret == NULL) -- { -- val = force_reg (imode, val); -- ret = lowpart_subreg (omode, val, imode); -- gcc_assert (ret != NULL); -- } -- return ret; --} -- - /* Expand a floating point absolute value or negation operation via a - logical operation on the sign bit. */ - -@@ -3204,7 +3184,7 @@ expand_absneg_bit (enum rtx_code code, scalar_float_mode mode, - gen_lowpart (imode, op0), - immed_wide_int_const (mask, imode), - gen_lowpart (imode, target), 1, OPTAB_LIB_WIDEN); -- target = lowpart_subreg_maybe_copy (mode, temp, imode); -+ target = force_lowpart_subreg (mode, temp, imode); - - set_dst_reg_note (get_last_insn (), REG_EQUAL, - gen_rtx_fmt_e (code, mode, copy_rtx (op0)), -@@ -4043,7 +4023,7 @@ expand_copysign_bit (scalar_float_mode mode, rtx op0, rtx op1, rtx target, - - temp = expand_binop (imode, ior_optab, op0, op1, - gen_lowpart (imode, target), 1, OPTAB_LIB_WIDEN); -- target = lowpart_subreg_maybe_copy (mode, temp, imode); -+ target = force_lowpart_subreg (mode, temp, imode); - } - - return target; --- -2.44.2 - diff --git a/packages/gcc/14.2.0/0015-Make-more-use-of-force_subreg.patch b/packages/gcc/14.2.0/0015-Make-more-use-of-force_subreg.patch deleted file mode 100644 index 697c8760..00000000 --- a/packages/gcc/14.2.0/0015-Make-more-use-of-force_subreg.patch +++ /dev/null @@ -1,194 +0,0 @@ -From d02fe5a6bfdfcae086e5374db3f8fd076df9b1a5 Mon Sep 17 00:00:00 2001 -From: Richard Sandiford <richard.sandiford@arm.com> -Date: Tue, 18 Jun 2024 12:22:30 +0100 -Subject: [PATCH 15/16] Make more use of force_subreg - -This patch makes target-independent code use force_subreg instead -of simplify_gen_subreg in some places. The criteria were: - -(1) The code is obviously specific to expand (where new pseudos - can be created), or at least would be invalid to call when - !can_create_pseudo_p () and temporaries are needed. - -(2) The value is obviously an rvalue rather than an lvalue. - -(3) The offset wasn't a simple lowpart or highpart calculation; - a later patch will deal with those. - -Doing this should reduce the likelihood of bugs like PR115464 -occuring in other situations. - -gcc/ - * expmed.cc (store_bit_field_using_insv): Use force_subreg - instead of simplify_gen_subreg. - (store_bit_field_1): Likewise. - (extract_bit_field_as_subreg): Likewise. - (extract_integral_bit_field): Likewise. - (emit_store_flag_1): Likewise. - * expr.cc (convert_move): Likewise. - (convert_modes): Likewise. - (emit_group_load_1): Likewise. - (emit_group_store): Likewise. - (expand_assignment): Likewise. - -(cherry picked from commit d4047da6a070175aae7121c739d1cad6b08ff4b2) ---- - gcc/expmed.cc | 22 ++++++++-------------- - gcc/expr.cc | 27 ++++++++++++--------------- - 2 files changed, 20 insertions(+), 29 deletions(-) - -diff --git a/gcc/expmed.cc b/gcc/expmed.cc -index 19765311b95..bd190722de6 100644 ---- a/gcc/expmed.cc -+++ b/gcc/expmed.cc -@@ -695,13 +695,7 @@ store_bit_field_using_insv (const extraction_insn *insv, rtx op0, - if we must narrow it, be sure we do it correctly. */ - - if (GET_MODE_SIZE (value_mode) < GET_MODE_SIZE (op_mode)) -- { -- tmp = simplify_subreg (op_mode, value1, value_mode, 0); -- if (! tmp) -- tmp = simplify_gen_subreg (op_mode, -- force_reg (value_mode, value1), -- value_mode, 0); -- } -+ tmp = force_subreg (op_mode, value1, value_mode, 0); - else - { - tmp = gen_lowpart_if_possible (op_mode, value1); -@@ -800,7 +794,7 @@ store_bit_field_1 (rtx str_rtx, poly_uint64 bitsize, poly_uint64 bitnum, - if (known_eq (bitnum, 0U) - && known_eq (bitsize, GET_MODE_BITSIZE (GET_MODE (op0)))) - { -- sub = simplify_gen_subreg (GET_MODE (op0), value, fieldmode, 0); -+ sub = force_subreg (GET_MODE (op0), value, fieldmode, 0); - if (sub) - { - if (reverse) -@@ -1627,7 +1621,7 @@ extract_bit_field_as_subreg (machine_mode mode, rtx op0, - && known_eq (bitsize, GET_MODE_BITSIZE (mode)) - && lowpart_bit_field_p (bitnum, bitsize, op0_mode) - && TRULY_NOOP_TRUNCATION_MODES_P (mode, op0_mode)) -- return simplify_gen_subreg (mode, op0, op0_mode, bytenum); -+ return force_subreg (mode, op0, op0_mode, bytenum); - return NULL_RTX; - } - -@@ -1994,11 +1988,11 @@ extract_integral_bit_field (rtx op0, opt_scalar_int_mode op0_mode, - return convert_extracted_bit_field (target, mode, tmode, unsignedp); - } - /* If OP0 is a hard register, copy it to a pseudo before calling -- simplify_gen_subreg. */ -+ force_subreg. */ - if (REG_P (op0) && HARD_REGISTER_P (op0)) - op0 = copy_to_reg (op0); -- op0 = simplify_gen_subreg (word_mode, op0, op0_mode.require (), -- bitnum / BITS_PER_WORD * UNITS_PER_WORD); -+ op0 = force_subreg (word_mode, op0, op0_mode.require (), -+ bitnum / BITS_PER_WORD * UNITS_PER_WORD); - op0_mode = word_mode; - bitnum %= BITS_PER_WORD; - } -@@ -5759,8 +5753,8 @@ emit_store_flag_1 (rtx target, enum rtx_code code, rtx op0, rtx op1, - - /* Do a logical OR or AND of the two words and compare the - result. */ -- op00 = simplify_gen_subreg (word_mode, op0, int_mode, 0); -- op01 = simplify_gen_subreg (word_mode, op0, int_mode, UNITS_PER_WORD); -+ op00 = force_subreg (word_mode, op0, int_mode, 0); -+ op01 = force_subreg (word_mode, op0, int_mode, UNITS_PER_WORD); - tem = expand_binop (word_mode, - op1 == const0_rtx ? ior_optab : and_optab, - op00, op01, NULL_RTX, unsignedp, -diff --git a/gcc/expr.cc b/gcc/expr.cc -index 9f66d479445..8ffa76b1bb8 100644 ---- a/gcc/expr.cc -+++ b/gcc/expr.cc -@@ -302,7 +302,7 @@ convert_move (rtx to, rtx from, int unsignedp) - GET_MODE_BITSIZE (to_mode))); - - if (VECTOR_MODE_P (to_mode)) -- from = simplify_gen_subreg (to_mode, from, GET_MODE (from), 0); -+ from = force_subreg (to_mode, from, GET_MODE (from), 0); - else - to = simplify_gen_subreg (from_mode, to, GET_MODE (to), 0); - -@@ -936,7 +936,7 @@ convert_modes (machine_mode mode, machine_mode oldmode, rtx x, int unsignedp) - { - gcc_assert (known_eq (GET_MODE_BITSIZE (mode), - GET_MODE_BITSIZE (oldmode))); -- return simplify_gen_subreg (mode, x, oldmode, 0); -+ return force_subreg (mode, x, oldmode, 0); - } - - temp = gen_reg_rtx (mode); -@@ -3076,8 +3076,8 @@ emit_group_load_1 (rtx *tmps, rtx dst, rtx orig_src, tree type, - } - } - else if (CONSTANT_P (src) && GET_MODE (dst) != BLKmode -- && XVECLEN (dst, 0) > 1) -- tmps[i] = simplify_gen_subreg (mode, src, GET_MODE (dst), bytepos); -+ && XVECLEN (dst, 0) > 1) -+ tmps[i] = force_subreg (mode, src, GET_MODE (dst), bytepos); - else if (CONSTANT_P (src)) - { - if (known_eq (bytelen, ssize)) -@@ -3301,7 +3301,7 @@ emit_group_store (rtx orig_dst, rtx src, tree type ATTRIBUTE_UNUSED, - if (known_eq (rtx_to_poly_int64 (XEXP (XVECEXP (src, 0, start), 1)), - bytepos)) - { -- temp = simplify_gen_subreg (outer, tmps[start], inner, 0); -+ temp = force_subreg (outer, tmps[start], inner, 0); - if (temp) - { - emit_move_insn (dst, temp); -@@ -3321,7 +3321,7 @@ emit_group_store (rtx orig_dst, rtx src, tree type ATTRIBUTE_UNUSED, - finish - 1), 1)), - bytepos)) - { -- temp = simplify_gen_subreg (outer, tmps[finish - 1], inner, 0); -+ temp = force_subreg (outer, tmps[finish - 1], inner, 0); - if (temp) - { - emit_move_insn (dst, temp); -@@ -6195,11 +6195,9 @@ expand_assignment (tree to, tree from, bool nontemporal) - to_mode = GET_MODE_INNER (to_mode); - machine_mode from_mode = GET_MODE_INNER (GET_MODE (result)); - rtx from_real -- = simplify_gen_subreg (to_mode, XEXP (result, 0), -- from_mode, 0); -+ = force_subreg (to_mode, XEXP (result, 0), from_mode, 0); - rtx from_imag -- = simplify_gen_subreg (to_mode, XEXP (result, 1), -- from_mode, 0); -+ = force_subreg (to_mode, XEXP (result, 1), from_mode, 0); - if (!from_real || !from_imag) - goto concat_store_slow; - emit_move_insn (XEXP (to_rtx, 0), from_real); -@@ -6215,8 +6213,7 @@ expand_assignment (tree to, tree from, bool nontemporal) - if (MEM_P (result)) - from_rtx = change_address (result, to_mode, NULL_RTX); - else -- from_rtx -- = simplify_gen_subreg (to_mode, result, from_mode, 0); -+ from_rtx = force_subreg (to_mode, result, from_mode, 0); - if (from_rtx) - { - emit_move_insn (XEXP (to_rtx, 0), -@@ -6228,10 +6225,10 @@ expand_assignment (tree to, tree from, bool nontemporal) - { - to_mode = GET_MODE_INNER (to_mode); - rtx from_real -- = simplify_gen_subreg (to_mode, result, from_mode, 0); -+ = force_subreg (to_mode, result, from_mode, 0); - rtx from_imag -- = simplify_gen_subreg (to_mode, result, from_mode, -- GET_MODE_SIZE (to_mode)); -+ = force_subreg (to_mode, result, from_mode, -+ GET_MODE_SIZE (to_mode)); - if (!from_real || !from_imag) - goto concat_store_slow; - emit_move_insn (XEXP (to_rtx, 0), from_real); --- -2.44.2 - diff --git a/packages/gcc/14.2.0/0016-Revert-one-of-the-force_subreg-changes.patch b/packages/gcc/14.2.0/0016-Revert-one-of-the-force_subreg-changes.patch deleted file mode 100644 index 629cfbda..00000000 --- a/packages/gcc/14.2.0/0016-Revert-one-of-the-force_subreg-changes.patch +++ /dev/null @@ -1,46 +0,0 @@ -From 5468439a1f987b7d801c6c76d6c989e57af8916a Mon Sep 17 00:00:00 2001 -From: Richard Sandiford <richard.sandiford@arm.com> -Date: Tue, 25 Jun 2024 09:41:21 +0100 -Subject: [PATCH 16/16] Revert one of the force_subreg changes - -One of the changes in g:d4047da6a070175aae7121c739d1cad6b08ff4b2 -caused a regression in ft32-elf; see: - - https://gcc.gnu.org/pipermail/gcc-patches/2024-June/655418.html - -for details. This change was different from the others in that the -original call was to simplify_subreg rather than simplify_lowpart_subreg. -The old code would therefore go on to do the force_reg for more cases -than the new code would. - -gcc/ - * expmed.cc (store_bit_field_using_insv): Revert earlier change - to use force_subreg instead of simplify_gen_subreg. - -(cherry picked from commit b694bf417cdd7d0a4d78e9927bab6bc202b7df6c) ---- - gcc/expmed.cc | 8 +++++++- - 1 file changed, 7 insertions(+), 1 deletion(-) - -diff --git a/gcc/expmed.cc b/gcc/expmed.cc -index bd190722de6..85ec2614a3f 100644 ---- a/gcc/expmed.cc -+++ b/gcc/expmed.cc -@@ -695,7 +695,13 @@ store_bit_field_using_insv (const extraction_insn *insv, rtx op0, - if we must narrow it, be sure we do it correctly. */ - - if (GET_MODE_SIZE (value_mode) < GET_MODE_SIZE (op_mode)) -- tmp = force_subreg (op_mode, value1, value_mode, 0); -+ { -+ tmp = simplify_subreg (op_mode, value1, value_mode, 0); -+ if (! tmp) -+ tmp = simplify_gen_subreg (op_mode, -+ force_reg (value_mode, value1), -+ value_mode, 0); -+ } - else - { - tmp = gen_lowpart_if_possible (op_mode, value1); --- -2.44.2 - diff --git a/packages/gcc/14.2.0/chksum b/packages/gcc/14.2.0/chksum deleted file mode 100644 index 40000f5c..00000000 --- a/packages/gcc/14.2.0/chksum +++ /dev/null @@ -1,8 +0,0 @@ -md5 gcc-14.2.0.tar.xz 2268420ba02dc01821960e274711bde0 -sha1 gcc-14.2.0.tar.xz d91ecc3d20ce6298bd95f9b09cc51dc6d3c73ae3 -sha256 gcc-14.2.0.tar.xz a7b39bc69cbf9e25826c5a60ab26477001f7c08d85cec04bc0e29cabed6f3cc9 -sha512 gcc-14.2.0.tar.xz 932bdef0cda94bacedf452ab17f103c0cb511ff2cec55e9112fc0328cbf1d803b42595728ea7b200e0a057c03e85626f937012e49a7515bc5dd256b2bf4bc396 -md5 gcc-14.2.0.tar.gz b89ddcdaf5c1b6214abad40d9761a6ba -sha1 gcc-14.2.0.tar.gz d4d09500ace1dc9ab69f6c4c791de012da8607ed -sha256 gcc-14.2.0.tar.gz 7d376d445f93126dc545e2c0086d0f647c3094aae081cdb78f42ce2bc25e7293 -sha512 gcc-14.2.0.tar.gz d6828a5702ff4b667cc3e1e7e9f180191041b7efb68ffdc54248a42aa1799f41db6743acfe9ab74ea59977ba06f425fcf943a9fe3a77f9db706fc6bdbd657c1a diff --git a/packages/gcc/14.3.0/0000-libtool-leave-framework-alone.patch b/packages/gcc/14.3.0/0000-libtool-leave-framework-alone.patch new file mode 100644 index 00000000..a5f6f66b --- /dev/null +++ b/packages/gcc/14.3.0/0000-libtool-leave-framework-alone.patch @@ -0,0 +1,21 @@ +--- + libtool-ldflags | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/libtool-ldflags b/libtool-ldflags +index 5de9e2978d40..0dde24bedfc5 100755 +--- a/libtool-ldflags ++++ b/libtool-ldflags +@@ -36,6 +36,11 @@ prev_arg= + 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/14.3.0/0001-gcc-plugin-POSIX-include-sys-select-h.patch b/packages/gcc/14.3.0/0001-gcc-plugin-POSIX-include-sys-select-h.patch new file mode 100644 index 00000000..181d6332 --- /dev/null +++ b/packages/gcc/14.3.0/0001-gcc-plugin-POSIX-include-sys-select-h.patch @@ -0,0 +1,17 @@ +--- + libcc1/connection.cc | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/libcc1/connection.cc b/libcc1/connection.cc +index 175e7a176b9e..60e37c2ce0c5 100644 +--- a/libcc1/connection.cc ++++ b/libcc1/connection.cc +@@ -21,6 +21,7 @@ along with GCC; see the file COPYING3. If not see + #include <string> + #include <unistd.h> + #include <sys/types.h> ++#include <sys/select.h> + #include <string.h> + #include <errno.h> + #include "marshall.hh" + diff --git a/packages/gcc/14.3.0/0002-0002-arm-softfloat-libgcc.patch.patch b/packages/gcc/14.3.0/0002-0002-arm-softfloat-libgcc.patch.patch new file mode 100644 index 00000000..d2a7dfce --- /dev/null +++ b/packages/gcc/14.3.0/0002-0002-arm-softfloat-libgcc.patch.patch @@ -0,0 +1,43 @@ +From c18ad43db5808bf40b9ceb877df7bcd438b59cdd Mon Sep 17 00:00:00 2001 +From: Chris Packham <chris.packham@alliedtelesis.co.nz> +Date: Sun, 25 May 2025 10:34:00 +1200 +Subject: [PATCH] 0002-arm-softfloat-libgcc.patch + +--- + gcc/config/arm/linux-elf.h | 2 +- + libgcc/config/arm/t-linux | 7 ++++++- + 2 files changed, 7 insertions(+), 2 deletions(-) + +diff --git a/gcc/config/arm/linux-elf.h b/gcc/config/arm/linux-elf.h +index ccae8abf6f6c..fcd180dff243 100644 +--- 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" + +diff --git a/libgcc/config/arm/t-linux b/libgcc/config/arm/t-linux +index 3d520decafbc..e7bc042d4e40 100644 +--- 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. +-- +2.49.0 + diff --git a/packages/gcc/14.3.0/0003-0003-libgcc-disable-split-stack-nothreads.patch.patch b/packages/gcc/14.3.0/0003-0003-libgcc-disable-split-stack-nothreads.patch.patch new file mode 100644 index 00000000..2fea1b63 --- /dev/null +++ b/packages/gcc/14.3.0/0003-0003-libgcc-disable-split-stack-nothreads.patch.patch @@ -0,0 +1,23 @@ +From 9b74f600cb69cf86c9a8e29e8cea775effd780c2 Mon Sep 17 00:00:00 2001 +From: Chris Packham <chris.packham@alliedtelesis.co.nz> +Date: Sun, 25 May 2025 10:34:01 +1200 +Subject: [PATCH] 0003-libgcc-disable-split-stack-nothreads.patch + +--- + libgcc/config/t-stack | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/libgcc/config/t-stack b/libgcc/config/t-stack +index cc0366b4cd81..f3f97e86d60e 100644 +--- 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 +-- +2.49.0 + diff --git a/packages/gcc/14.3.0/0004-Remove-use-of-include_next-from-c-headers.patch b/packages/gcc/14.3.0/0004-Remove-use-of-include_next-from-c-headers.patch new file mode 100644 index 00000000..2dbe28a5 --- /dev/null +++ b/packages/gcc/14.3.0/0004-Remove-use-of-include_next-from-c-headers.patch @@ -0,0 +1,307 @@ +From a9766b7fd69768ec614f838edcb6a38fd7b3cb0d Mon Sep 17 00:00:00 2001 +From: Keith Packard <keithp@keithp.com> +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 <keithp@keithp.com> +--- + 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 48d44160baba..d30c44e51896 100644 +--- a/libstdc++-v3/include/bits/std_abs.h ++++ b/libstdc++-v3/include/bits/std_abs.h +@@ -35,9 +35,9 @@ + #include <bits/c++config.h> + + #define _GLIBCXX_INCLUDE_NEXT_C_HEADERS +-#include_next <stdlib.h> ++#include <stdlib.h> + #ifdef __CORRECT_ISO_CPP_MATH_H_PROTO +-# include_next <math.h> ++# include <math.h> + #endif + #undef _GLIBCXX_INCLUDE_NEXT_C_HEADERS + +diff --git a/libstdc++-v3/include/c/cassert b/libstdc++-v3/include/c/cassert +index 5cd11fff9ece..01d8c7fa5fcd 100644 +--- a/libstdc++-v3/include/c/cassert ++++ b/libstdc++-v3/include/c/cassert +@@ -31,4 +31,4 @@ + #pragma GCC system_header + + #include <bits/c++config.h> +-#include_next <assert.h> ++#include <assert.h> +diff --git a/libstdc++-v3/include/c/cctype b/libstdc++-v3/include/c/cctype +index c6f650394357..1540a3259454 100644 +--- a/libstdc++-v3/include/c/cctype ++++ b/libstdc++-v3/include/c/cctype +@@ -31,6 +31,6 @@ + + #pragma GCC system_header + +-#include_next <ctype.h> ++#include <ctype.h> + + #endif +diff --git a/libstdc++-v3/include/c/cerrno b/libstdc++-v3/include/c/cerrno +index 9e47b182d25c..250ea5d7744a 100644 +--- a/libstdc++-v3/include/c/cerrno ++++ b/libstdc++-v3/include/c/cerrno +@@ -41,7 +41,7 @@ + #pragma GCC system_header + + #include <bits/c++config.h> +-#include_next <errno.h> ++#include <errno.h> + + // 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 81d9772ed9f6..660440fc810b 100644 +--- a/libstdc++-v3/include/c/cfloat ++++ b/libstdc++-v3/include/c/cfloat +@@ -32,6 +32,6 @@ + #pragma GCC system_header + + #include <bits/c++config.h> +-#include_next <float.h> ++#include <float.h> + + #endif +diff --git a/libstdc++-v3/include/c/climits b/libstdc++-v3/include/c/climits +index 255bed411259..919e1ec4855d 100644 +--- a/libstdc++-v3/include/c/climits ++++ b/libstdc++-v3/include/c/climits +@@ -32,6 +32,6 @@ + #pragma GCC system_header + + #include <bits/c++config.h> +-#include_next <limits.h> ++#include <limits.h> + + #endif +diff --git a/libstdc++-v3/include/c/clocale b/libstdc++-v3/include/c/clocale +index 4258df1958b6..95357d40ca1b 100644 +--- a/libstdc++-v3/include/c/clocale ++++ b/libstdc++-v3/include/c/clocale +@@ -31,6 +31,6 @@ + + #pragma GCC system_header + +-#include_next <locale.h> ++#include <locale.h> + + #endif +diff --git a/libstdc++-v3/include/c/cmath b/libstdc++-v3/include/c/cmath +index 43020eee9d29..619031ba8e4a 100644 +--- a/libstdc++-v3/include/c/cmath ++++ b/libstdc++-v3/include/c/cmath +@@ -33,7 +33,7 @@ + + #include <bits/c++config.h> + +-#include_next <math.h> ++#include <math.h> + + // Get rid of those macros defined in <math.h> in lieu of real functions. + #undef abs +diff --git a/libstdc++-v3/include/c/csetjmp b/libstdc++-v3/include/c/csetjmp +index 4a5b0334590f..4a7744ba1c7e 100644 +--- a/libstdc++-v3/include/c/csetjmp ++++ b/libstdc++-v3/include/c/csetjmp +@@ -31,7 +31,7 @@ + + #pragma GCC system_header + +-#include_next <setjmp.h> ++#include <setjmp.h> + + // Get rid of those macros defined in <setjmp.h> in lieu of real functions. + #undef longjmp +diff --git a/libstdc++-v3/include/c/csignal b/libstdc++-v3/include/c/csignal +index 040b48368f94..afe91f7c7866 100644 +--- a/libstdc++-v3/include/c/csignal ++++ b/libstdc++-v3/include/c/csignal +@@ -31,6 +31,6 @@ + + #pragma GCC system_header + +-#include_next <signal.h> ++#include <signal.h> + + #endif +diff --git a/libstdc++-v3/include/c/cstdarg b/libstdc++-v3/include/c/cstdarg +index 5d97e043da84..568dc07994f6 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 <stdarg.h> ++#include <stdarg.h> + + #endif +diff --git a/libstdc++-v3/include/c/cstddef b/libstdc++-v3/include/c/cstddef +index 4fd889a1dffc..28997b73a647 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 <stddef.h> ++#include <stddef.h> + + #endif +diff --git a/libstdc++-v3/include/c/cstdio b/libstdc++-v3/include/c/cstdio +index 01293054d501..6632e5b09586 100644 +--- a/libstdc++-v3/include/c/cstdio ++++ b/libstdc++-v3/include/c/cstdio +@@ -31,7 +31,7 @@ + + #pragma GCC system_header + +-#include_next <stdio.h> ++#include <stdio.h> + + // Get rid of those macros defined in <stdio.h> in lieu of real functions. + #undef clearerr +diff --git a/libstdc++-v3/include/c/cstdlib b/libstdc++-v3/include/c/cstdlib +index f5707f8a8ce4..4156882e09aa 100644 +--- a/libstdc++-v3/include/c/cstdlib ++++ b/libstdc++-v3/include/c/cstdlib +@@ -31,6 +31,6 @@ + + #pragma GCC system_header + +-#include_next <stdlib.h> ++#include <stdlib.h> + + #endif +diff --git a/libstdc++-v3/include/c/cstring b/libstdc++-v3/include/c/cstring +index 0082080fcab0..209ccd112faa 100644 +--- a/libstdc++-v3/include/c/cstring ++++ b/libstdc++-v3/include/c/cstring +@@ -31,6 +31,6 @@ + + #pragma GCC system_header + +-#include_next <string.h> ++#include <string.h> + + #endif +diff --git a/libstdc++-v3/include/c/ctime b/libstdc++-v3/include/c/ctime +index 5476ff7da399..33c61aa08d73 100644 +--- a/libstdc++-v3/include/c/ctime ++++ b/libstdc++-v3/include/c/ctime +@@ -31,6 +31,6 @@ + + #pragma GCC system_header + +-#include_next <time.h> ++#include <time.h> + + #endif +diff --git a/libstdc++-v3/include/c/cuchar b/libstdc++-v3/include/c/cuchar +index 430d1ff50ba1..7b2c9d738269 100644 +--- a/libstdc++-v3/include/c/cuchar ++++ b/libstdc++-v3/include/c/cuchar +@@ -39,7 +39,7 @@ + #include <cwchar> + + #if _GLIBCXX_USE_C11_UCHAR_CXX11 +-# include_next <uchar.h> ++# include <uchar.h> + #endif + + #endif // C++11 +diff --git a/libstdc++-v3/include/c/cwchar b/libstdc++-v3/include/c/cwchar +index 7a62eb74abbf..c1857099ef12 100644 +--- a/libstdc++-v3/include/c/cwchar ++++ b/libstdc++-v3/include/c/cwchar +@@ -36,7 +36,7 @@ + #include <ctime> + + #if _GLIBCXX_HAVE_WCHAR_H +-#include_next <wchar.h> ++#include <wchar.h> + #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 011ceadbb1b4..6a67549ea4bd 100644 +--- a/libstdc++-v3/include/c/cwctype ++++ b/libstdc++-v3/include/c/cwctype +@@ -34,7 +34,7 @@ + #include <bits/c++config.h> + + #if _GLIBCXX_HAVE_WCTYPE_H +-#include_next <wctype.h> ++#include <wctype.h> + #endif + + #endif +diff --git a/libstdc++-v3/include/c_global/cmath b/libstdc++-v3/include/c_global/cmath +index 114b0693151e..bea5665a293d 100644 +--- a/libstdc++-v3/include/c_global/cmath ++++ b/libstdc++-v3/include/c_global/cmath +@@ -44,7 +44,7 @@ + #include <bits/cpp_type_traits.h> + #include <ext/type_traits.h> + #define _GLIBCXX_INCLUDE_NEXT_C_HEADERS +-#include_next <math.h> ++#include <math.h> + #undef _GLIBCXX_INCLUDE_NEXT_C_HEADERS + #include <bits/std_abs.h> + +diff --git a/libstdc++-v3/include/c_global/cstdlib b/libstdc++-v3/include/c_global/cstdlib +index 7bb11f5b788a..5a6a28898221 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 <stdlib.h> not a libstdc++ + // wrapper that might already be installed later in the include search path. + #define _GLIBCXX_INCLUDE_NEXT_C_HEADERS +-#include_next <stdlib.h> ++#include <stdlib.h> + #undef _GLIBCXX_INCLUDE_NEXT_C_HEADERS + #include <bits/std_abs.h> + +-- +2.49.0 + diff --git a/packages/gcc/14.3.0/0005-Allow-default-libc-to-be-specified-to-configure.patch b/packages/gcc/14.3.0/0005-Allow-default-libc-to-be-specified-to-configure.patch new file mode 100644 index 00000000..b55b8a1b --- /dev/null +++ b/packages/gcc/14.3.0/0005-Allow-default-libc-to-be-specified-to-configure.patch @@ -0,0 +1,141 @@ +From d87c4fb35576c61b75c0a003f9bbccea8321b3a3 Mon Sep 17 00:00:00 2001 +From: Keith Packard <keithp@keithp.com> +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 <keithp@keithp.com> +--- + 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 a3566f5c77da..f993b4b26c4c 100644 +--- a/gcc/config.gcc ++++ b/gcc/config.gcc +@@ -695,6 +695,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 \ +@@ -911,16 +913,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 +@@ -1035,7 +1037,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 +@@ -1721,13 +1724,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 + ;; + *) +@@ -3125,7 +3128,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*) +@@ -6079,3 +6082,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 cb743b5a875a..5213bf64a6d4 100644 +--- a/gcc/configure.ac ++++ b/gcc/configure.ac +@@ -2561,6 +2561,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. +-- +2.49.0 + diff --git a/packages/gcc/14.3.0/0006-driver-Extend-getenv-function-to-allow-default-value.patch b/packages/gcc/14.3.0/0006-driver-Extend-getenv-function-to-allow-default-value.patch new file mode 100644 index 00000000..e262eb58 --- /dev/null +++ b/packages/gcc/14.3.0/0006-driver-Extend-getenv-function-to-allow-default-value.patch @@ -0,0 +1,102 @@ +From 2663eed443ff0cb465f28c0598713dc6ca83feeb Mon Sep 17 00:00:00 2001 +From: Keith Packard <keithp@keithp.com> +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 <keithp@keithp.com> +--- + 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 64728fead512..3f487db6cad7 100644 +--- a/gcc/doc/invoke.texi ++++ b/gcc/doc/invoke.texi +@@ -37065,17 +37065,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 fc9f1f545dc8..8e6e25d935be 100644 +--- a/gcc/gcc.cc ++++ b/gcc/gcc.cc +@@ -10318,12 +10318,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. */ +-- +2.49.0 + diff --git a/packages/gcc/14.3.0/0007-Add-newlib-and-picolibc-as-default-C-library-choices.patch b/packages/gcc/14.3.0/0007-Add-newlib-and-picolibc-as-default-C-library-choices.patch new file mode 100644 index 00000000..cfc81557 --- /dev/null +++ b/packages/gcc/14.3.0/0007-Add-newlib-and-picolibc-as-default-C-library-choices.patch @@ -0,0 +1,42 @@ +From d4b4b5159d270bb4bfec71847d041b4b2d71759d Mon Sep 17 00:00:00 2001 +From: Keith Packard <keithp@keithp.com> +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 <keithp@keithp.com> +--- + gcc/config.gcc | 11 ++++++++++- + 1 file changed, 10 insertions(+), 1 deletion(-) + +diff --git a/gcc/config.gcc b/gcc/config.gcc +index f993b4b26c4c..bcf23f9d0a42 100644 +--- a/gcc/config.gcc ++++ b/gcc/config.gcc +@@ -693,7 +693,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="" + +@@ -6096,6 +6096,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 ++ ;; + "") + ;; + *) +-- +2.49.0 + diff --git a/packages/gcc/14.3.0/0008-Support-picolibc-targets.patch b/packages/gcc/14.3.0/0008-Support-picolibc-targets.patch new file mode 100644 index 00000000..20914c37 --- /dev/null +++ b/packages/gcc/14.3.0/0008-Support-picolibc-targets.patch @@ -0,0 +1,38 @@ +From a3fb1dcf2b7146c1ae6014c655957a775e1ea6b0 Mon Sep 17 00:00:00 2001 +From: Keith Packard <keithp@keithp.com> +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 <keithp@keithp.com> +--- + gcc/config.gcc | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/gcc/config.gcc b/gcc/config.gcc +index bcf23f9d0a42..f770d21e5d4c 100644 +--- a/gcc/config.gcc ++++ b/gcc/config.gcc +@@ -1168,6 +1168,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 +-- +2.49.0 + diff --git a/packages/gcc/14.3.0/0009-gcc-Allow-g-to-work-differently-from-gcc.patch b/packages/gcc/14.3.0/0009-gcc-Allow-g-to-work-differently-from-gcc.patch new file mode 100644 index 00000000..9e94f94e --- /dev/null +++ b/packages/gcc/14.3.0/0009-gcc-Allow-g-to-work-differently-from-gcc.patch @@ -0,0 +1,68 @@ +From 905b18c94f5792a2e08caa41576f9cb5d1dad526 Mon Sep 17 00:00:00 2001 +From: Keith Packard <keithp@keithp.com> +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 <keithp@keithp.com> +--- + 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 f153891a1ef6..ec980d95e3b4 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 ++<http://www.gnu.org/licenses/>. */ ++ ++#define IN_GPP ++#include "gcc.cc" +-- +2.49.0 + diff --git a/packages/gcc/14.3.0/0010-libgcc-Exclude-UCLIBC-from-GLIBC-thread-check.patch b/packages/gcc/14.3.0/0010-libgcc-Exclude-UCLIBC-from-GLIBC-thread-check.patch new file mode 100644 index 00000000..46c6788e --- /dev/null +++ b/packages/gcc/14.3.0/0010-libgcc-Exclude-UCLIBC-from-GLIBC-thread-check.patch @@ -0,0 +1,35 @@ +From e1c06be963b4048902ee5c19d589b7619d3c5fa2 Mon Sep 17 00:00:00 2001 +From: Chris Packham <chris.packham@alliedtelesis.co.nz> +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 <chris.packham@alliedtelesis.co.nz> +--- + 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 82e8f9ffcf66..e63d02fb8dcc 100644 +--- a/libgcc/gthr-posix.h ++++ b/libgcc/gthr-posix.h +@@ -246,7 +246,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) +-- +2.49.0 + diff --git a/packages/gcc/14.3.0/chksum b/packages/gcc/14.3.0/chksum new file mode 100644 index 00000000..2db0b8d1 --- /dev/null +++ b/packages/gcc/14.3.0/chksum @@ -0,0 +1,8 @@ +md5 gcc-14.3.0.tar.xz 2e2f25966bbb5321bf6a3beafcd241b5 +sha1 gcc-14.3.0.tar.xz e33b9ffb8baf1528d72a8a26a1ee678928ca9121 +sha256 gcc-14.3.0.tar.xz e0dc77297625631ac8e50fa92fffefe899a4eb702592da5c32ef04e2293aca3a +sha512 gcc-14.3.0.tar.xz cb4e3259640721bbd275c723fe4df53d12f9b1673afb3db274c22c6aa457865dccf2d6ea20b4fd4c591f6152e6d4b87516c402015900f06ce9d43af66d3b7a93 +md5 gcc-14.3.0.tar.gz 1ba56546c0274ea75457bf5c00c61506 +sha1 gcc-14.3.0.tar.gz 1866e57122db9f31ba3117175bf50d46d1146eb8 +sha256 gcc-14.3.0.tar.gz ace8b8b0dbfe6abfc22f821cb093e195aa5498b7ccf7cd23e4424b9f14afed22 +sha512 gcc-14.3.0.tar.gz b2c3ab244f809217eb9d71c2b4e7f7e1d9d8b0c8ab3d4c737939075c1fef528cb4629d1cbec717a4839612f3123ca0ebf81af8398fa42a5bf88f99e12bf223b4 diff --git a/packages/gcc/14.2.0/experimental/0001-picolibc-Add-custom-spec-file-fragments-for-using-pi.patch b/packages/gcc/14.3.0/experimental/0001-picolibc-Add-custom-spec-file-fragments-for-using-pi.patch index 487a28c3..487a28c3 100644 --- a/packages/gcc/14.2.0/experimental/0001-picolibc-Add-custom-spec-file-fragments-for-using-pi.patch +++ b/packages/gcc/14.3.0/experimental/0001-picolibc-Add-custom-spec-file-fragments-for-using-pi.patch diff --git a/packages/gcc/14.2.0/version.desc b/packages/gcc/14.3.0/version.desc index e69de29b..e69de29b 100644 --- a/packages/gcc/14.2.0/version.desc +++ b/packages/gcc/14.3.0/version.desc diff --git a/packages/gcc/14.2.0/0000-libtool-leave-framework-alone.patch b/packages/gcc/15.1.0/0000-libtool-leave-framework-alone.patch index 1a86e415..b5804ea1 100644 --- a/packages/gcc/14.2.0/0000-libtool-leave-framework-alone.patch +++ b/packages/gcc/15.1.0/0000-libtool-leave-framework-alone.patch @@ -4,7 +4,7 @@ --- a/libtool-ldflags +++ b/libtool-ldflags -@@ -36,6 +36,11 @@ +@@ -36,6 +36,11 @@ prev_arg= for arg do case $arg in diff --git a/packages/gcc/14.2.0/0001-gcc-plugin-POSIX-include-sys-select-h.patch b/packages/gcc/15.1.0/0001-gcc-plugin-POSIX-include-sys-select-h.patch index 5f9a07a2..3040e23c 100644 --- a/packages/gcc/14.2.0/0001-gcc-plugin-POSIX-include-sys-select-h.patch +++ b/packages/gcc/15.1.0/0001-gcc-plugin-POSIX-include-sys-select-h.patch @@ -4,7 +4,7 @@ --- a/libcc1/connection.cc +++ b/libcc1/connection.cc -@@ -21,6 +21,7 @@ +@@ -21,6 +21,7 @@ along with GCC; see the file COPYING3. #include <string> #include <unistd.h> #include <sys/types.h> diff --git a/packages/gcc/14.2.0/0002-arm-softfloat-libgcc.patch b/packages/gcc/15.1.0/0002-arm-softfloat-libgcc.patch index d9800365..d9800365 100644 --- a/packages/gcc/14.2.0/0002-arm-softfloat-libgcc.patch +++ b/packages/gcc/15.1.0/0002-arm-softfloat-libgcc.patch diff --git a/packages/gcc/14.2.0/0003-libgcc-disable-split-stack-nothreads.patch b/packages/gcc/15.1.0/0003-libgcc-disable-split-stack-nothreads.patch index df91a9ff..df91a9ff 100644 --- a/packages/gcc/14.2.0/0003-libgcc-disable-split-stack-nothreads.patch +++ b/packages/gcc/15.1.0/0003-libgcc-disable-split-stack-nothreads.patch diff --git a/packages/gcc/14.2.0/0004-Remove-use-of-include_next-from-c-headers.patch b/packages/gcc/15.1.0/0004-Remove-use-of-include_next-from-c-headers.patch index 429d3bd3..2612262a 100644 --- a/packages/gcc/14.2.0/0004-Remove-use-of-include_next-from-c-headers.patch +++ b/packages/gcc/15.1.0/0004-Remove-use-of-include_next-from-c-headers.patch @@ -41,8 +41,8 @@ Signed-off-by: Keith Packard <keithp@keithp.com> --- a/libstdc++-v3/include/bits/std_abs.h +++ b/libstdc++-v3/include/bits/std_abs.h -@@ -35,9 +35,9 @@ - #include <bits/c++config.h> +@@ -41,9 +41,9 @@ + #pragma GCC diagnostic ignored "-Wlong-long" #define _GLIBCXX_INCLUDE_NEXT_C_HEADERS -#include_next <stdlib.h> @@ -55,159 +55,171 @@ Signed-off-by: Keith Packard <keithp@keithp.com> --- a/libstdc++-v3/include/c/cassert +++ b/libstdc++-v3/include/c/cassert -@@ -31,4 +31,4 @@ - #pragma GCC system_header +@@ -36,6 +36,6 @@ + #pragma GCC diagnostic ignored "-Wpedantic" // include_next #include <bits/c++config.h> -#include_next <assert.h> +#include <assert.h> + + #pragma GCC diagnostic pop --- a/libstdc++-v3/include/c/cctype +++ b/libstdc++-v3/include/c/cctype -@@ -31,6 +31,6 @@ - - #pragma GCC system_header +@@ -36,7 +36,7 @@ + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wpedantic" // include_next -#include_next <ctype.h> +#include <ctype.h> - #endif + #pragma GCC diagnostic pop + --- a/libstdc++-v3/include/c/cerrno +++ b/libstdc++-v3/include/c/cerrno -@@ -41,7 +41,7 @@ - #pragma GCC system_header +@@ -46,7 +46,7 @@ + #pragma GCC diagnostic ignored "-Wpedantic" // include_next #include <bits/c++config.h> -#include_next <errno.h> +#include <errno.h> - // Adhere to section 17.4.1.2 clause 5 of ISO 14882:1998 - #ifndef errno + #pragma GCC diagnostic pop + --- a/libstdc++-v3/include/c/cfloat +++ b/libstdc++-v3/include/c/cfloat -@@ -32,6 +32,6 @@ - #pragma GCC system_header +@@ -37,7 +37,7 @@ + #pragma GCC diagnostic ignored "-Wpedantic" // include_next #include <bits/c++config.h> -#include_next <float.h> +#include <float.h> - #endif + #pragma GCC diagnostic pop + --- a/libstdc++-v3/include/c/climits +++ b/libstdc++-v3/include/c/climits -@@ -32,6 +32,6 @@ - #pragma GCC system_header +@@ -37,7 +37,7 @@ + #pragma GCC diagnostic ignored "-Wpedantic" // include_next #include <bits/c++config.h> -#include_next <limits.h> +#include <limits.h> - #endif + #pragma GCC diagnostic pop + --- a/libstdc++-v3/include/c/clocale +++ b/libstdc++-v3/include/c/clocale -@@ -31,6 +31,6 @@ - - #pragma GCC system_header +@@ -36,7 +36,7 @@ + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wpedantic" // include_next -#include_next <locale.h> +#include <locale.h> - #endif + #pragma GCC diagnostic pop + --- a/libstdc++-v3/include/c/cmath +++ b/libstdc++-v3/include/c/cmath -@@ -33,7 +33,7 @@ - - #include <bits/c++config.h> +@@ -38,7 +38,7 @@ + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wpedantic" // include_next -#include_next <math.h> +#include <math.h> - // Get rid of those macros defined in <math.h> in lieu of real functions. - #undef abs + #pragma GCC diagnostic pop + --- a/libstdc++-v3/include/c/csetjmp +++ b/libstdc++-v3/include/c/csetjmp -@@ -31,7 +31,7 @@ - - #pragma GCC system_header +@@ -36,7 +36,7 @@ + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wpedantic" // include_next -#include_next <setjmp.h> +#include <setjmp.h> - // Get rid of those macros defined in <setjmp.h> in lieu of real functions. - #undef longjmp + #pragma GCC diagnostic pop + --- a/libstdc++-v3/include/c/csignal +++ b/libstdc++-v3/include/c/csignal -@@ -31,6 +31,6 @@ - - #pragma GCC system_header +@@ -36,7 +36,7 @@ + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wpedantic" // include_next -#include_next <signal.h> +#include <signal.h> - #endif + #pragma GCC diagnostic pop + --- a/libstdc++-v3/include/c/cstdarg +++ b/libstdc++-v3/include/c/cstdarg -@@ -32,6 +32,6 @@ - #pragma GCC system_header +@@ -37,7 +37,7 @@ + #pragma GCC diagnostic ignored "-Wpedantic" // include_next #undef __need___va_list -#include_next <stdarg.h> +#include <stdarg.h> - #endif + #pragma GCC diagnostic pop + --- a/libstdc++-v3/include/c/cstddef +++ b/libstdc++-v3/include/c/cstddef -@@ -35,6 +35,6 @@ +@@ -40,7 +40,7 @@ #define __need_ptrdiff_t #define __need_NULL #define __need_offsetof -#include_next <stddef.h> +#include <stddef.h> - #endif + #pragma GCC diagnostic pop + --- a/libstdc++-v3/include/c/cstdio +++ b/libstdc++-v3/include/c/cstdio -@@ -31,7 +31,7 @@ - - #pragma GCC system_header +@@ -36,7 +36,7 @@ + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wpedantic" // include_next -#include_next <stdio.h> +#include <stdio.h> - // Get rid of those macros defined in <stdio.h> in lieu of real functions. - #undef clearerr + #pragma GCC diagnostic pop + --- a/libstdc++-v3/include/c/cstdlib +++ b/libstdc++-v3/include/c/cstdlib -@@ -31,6 +31,6 @@ - - #pragma GCC system_header +@@ -36,7 +36,7 @@ + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wpedantic" // include_next -#include_next <stdlib.h> +#include <stdlib.h> - #endif + #pragma GCC diagnostic pop + --- a/libstdc++-v3/include/c/cstring +++ b/libstdc++-v3/include/c/cstring -@@ -31,6 +31,6 @@ - - #pragma GCC system_header +@@ -36,7 +36,7 @@ + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wpedantic" // include_next -#include_next <string.h> +#include <string.h> - #endif + #pragma GCC diagnostic pop + --- a/libstdc++-v3/include/c/ctime +++ b/libstdc++-v3/include/c/ctime -@@ -31,6 +31,6 @@ - - #pragma GCC system_header +@@ -36,7 +36,7 @@ + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wpedantic" // include_next -#include_next <time.h> +#include <time.h> - #endif + #pragma GCC diagnostic pop + --- a/libstdc++-v3/include/c/cuchar +++ b/libstdc++-v3/include/c/cuchar -@@ -39,7 +39,7 @@ +@@ -41,7 +41,7 @@ #include <cwchar> #if _GLIBCXX_USE_C11_UCHAR_CXX11 @@ -218,18 +230,18 @@ Signed-off-by: Keith Packard <keithp@keithp.com> #endif // C++11 --- a/libstdc++-v3/include/c/cwchar +++ b/libstdc++-v3/include/c/cwchar -@@ -36,7 +36,7 @@ - #include <ctime> +@@ -41,7 +41,7 @@ + #pragma GCC diagnostic ignored "-Wpedantic" // include_next #if _GLIBCXX_HAVE_WCHAR_H -#include_next <wchar.h> +#include <wchar.h> #endif - // Need to do a bit of trickery here with mbstate_t as char_traits + #pragma GCC diagnostic pop --- a/libstdc++-v3/include/c/cwctype +++ b/libstdc++-v3/include/c/cwctype -@@ -34,7 +34,7 @@ +@@ -39,7 +39,7 @@ #include <bits/c++config.h> #if _GLIBCXX_HAVE_WCTYPE_H @@ -237,26 +249,26 @@ Signed-off-by: Keith Packard <keithp@keithp.com> +#include <wctype.h> #endif - #endif + #pragma GCC diagnostic pop --- a/libstdc++-v3/include/c_global/cmath +++ b/libstdc++-v3/include/c_global/cmath -@@ -44,7 +44,7 @@ - #include <bits/cpp_type_traits.h> - #include <ext/type_traits.h> +@@ -52,7 +52,7 @@ + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wpedantic" // include_next #define _GLIBCXX_INCLUDE_NEXT_C_HEADERS -#include_next <math.h> +#include <math.h> #undef _GLIBCXX_INCLUDE_NEXT_C_HEADERS - #include <bits/std_abs.h> + #pragma GCC diagnostic pop --- a/libstdc++-v3/include/c_global/cstdlib +++ b/libstdc++-v3/include/c_global/cstdlib -@@ -76,7 +76,7 @@ - // Need to ensure this finds the C library's <stdlib.h> not a libstdc++ - // wrapper that might already be installed later in the include search path. +@@ -80,7 +80,7 @@ namespace std + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wpedantic" // include_next #define _GLIBCXX_INCLUDE_NEXT_C_HEADERS -#include_next <stdlib.h> +#include <stdlib.h> #undef _GLIBCXX_INCLUDE_NEXT_C_HEADERS - #include <bits/std_abs.h> + #pragma GCC diagnostic pop diff --git a/packages/gcc/14.2.0/0005-Allow-default-libc-to-be-specified-to-configure.patch b/packages/gcc/15.1.0/0005-Allow-default-libc-to-be-specified-to-configure.patch index 9a7a2a85..4dee0f38 100644 --- a/packages/gcc/14.2.0/0005-Allow-default-libc-to-be-specified-to-configure.patch +++ b/packages/gcc/15.1.0/0005-Allow-default-libc-to-be-specified-to-configure.patch @@ -21,7 +21,7 @@ Signed-off-by: Keith Packard <keithp@keithp.com> --- a/gcc/config.gcc +++ b/gcc/config.gcc -@@ -695,6 +695,8 @@ +@@ -696,6 +696,8 @@ esac # Common C libraries. tm_defines="$tm_defines LIBC_GLIBC=1 LIBC_UCLIBC=2 LIBC_BIONIC=3 LIBC_MUSL=4" @@ -30,7 +30,7 @@ Signed-off-by: Keith Packard <keithp@keithp.com> # 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 \ -@@ -911,16 +913,16 @@ +@@ -912,16 +914,16 @@ case ${target} in esac case $target in *-*-*android*) @@ -51,7 +51,7 @@ Signed-off-by: Keith Packard <keithp@keithp.com> ;; esac # Assume that glibc or uClibc or Bionic are being used and so __cxa_atexit -@@ -1035,7 +1037,8 @@ +@@ -1036,7 +1038,8 @@ case ${target} in case ${enable_threads} in "" | yes | posix) thread_file='posix' ;; esac @@ -61,7 +61,7 @@ Signed-off-by: Keith Packard <keithp@keithp.com> ;; *-*-rdos*) use_gcc_stdint=wrap -@@ -1721,13 +1724,13 @@ +@@ -1747,13 +1750,13 @@ csky-*-*) case ${target} in csky-*-linux-gnu*) @@ -77,7 +77,7 @@ Signed-off-by: Keith Packard <keithp@keithp.com> default_use_cxa_atexit=no ;; *) -@@ -3125,7 +3128,7 @@ +@@ -3144,7 +3147,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" @@ -86,7 +86,7 @@ Signed-off-by: Keith Packard <keithp@keithp.com> extra_objs="$extra_objs linux.o rs6000-linux.o" ;; powerpc-wrs-vxworks*) -@@ -6079,3 +6082,32 @@ +@@ -6161,3 +6164,32 @@ i[34567]86-*-* | x86_64-*-*) fi ;; esac @@ -121,7 +121,7 @@ Signed-off-by: Keith Packard <keithp@keithp.com> +esac --- a/gcc/configure.ac +++ b/gcc/configure.ac -@@ -2546,6 +2546,10 @@ +@@ -2582,6 +2582,10 @@ if { { test x$host != x$target && test " fi AC_SUBST(inhibit_libc) diff --git a/packages/gcc/14.2.0/0006-driver-Extend-getenv-function-to-allow-default-value.patch b/packages/gcc/15.1.0/0006-driver-Extend-getenv-function-to-allow-default-value.patch index 955ff3ca..cd29b91c 100644 --- a/packages/gcc/14.2.0/0006-driver-Extend-getenv-function-to-allow-default-value.patch +++ b/packages/gcc/15.1.0/0006-driver-Extend-getenv-function-to-allow-default-value.patch @@ -40,7 +40,7 @@ Signed-off-by: Keith Packard <keithp@keithp.com> --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi -@@ -36963,17 +36963,21 @@ +@@ -37564,17 +37564,21 @@ The following built-in spec functions ar @table @code @item @code{getenv} @@ -71,7 +71,7 @@ Signed-off-by: Keith Packard <keithp@keithp.com> The @code{if-exists} spec function takes one argument, an absolute --- a/gcc/gcc.cc +++ b/gcc/gcc.cc -@@ -10300,12 +10300,20 @@ +@@ -10338,12 +10338,20 @@ getenv_spec_function (int argc, const ch char *ptr; size_t len; diff --git a/packages/gcc/14.2.0/0007-Add-newlib-and-picolibc-as-default-C-library-choices.patch b/packages/gcc/15.1.0/0007-Add-newlib-and-picolibc-as-default-C-library-choices.patch index 5443630b..2f839fad 100644 --- a/packages/gcc/14.2.0/0007-Add-newlib-and-picolibc-as-default-C-library-choices.patch +++ b/packages/gcc/15.1.0/0007-Add-newlib-and-picolibc-as-default-C-library-choices.patch @@ -10,7 +10,7 @@ Signed-off-by: Keith Packard <keithp@keithp.com> --- a/gcc/config.gcc +++ b/gcc/config.gcc -@@ -693,7 +693,7 @@ +@@ -694,7 +694,7 @@ case ${target} in esac # Common C libraries. @@ -19,7 +19,7 @@ Signed-off-by: Keith Packard <keithp@keithp.com> default_libc="" -@@ -6096,6 +6096,15 @@ +@@ -6178,6 +6178,15 @@ bionic) musl) default_libc=LIBC_MUSL ;; diff --git a/packages/gcc/14.2.0/0008-Support-picolibc-targets.patch b/packages/gcc/15.1.0/0008-Support-picolibc-targets.patch index 987baf39..c52c68d5 100644 --- a/packages/gcc/14.2.0/0008-Support-picolibc-targets.patch +++ b/packages/gcc/15.1.0/0008-Support-picolibc-targets.patch @@ -13,7 +13,7 @@ Signed-off-by: Keith Packard <keithp@keithp.com> --- a/gcc/config.gcc +++ b/gcc/config.gcc -@@ -1168,6 +1168,17 @@ +@@ -1165,6 +1165,17 @@ case ${target} in ;; esac ;; diff --git a/packages/gcc/14.2.0/0009-gcc-Allow-g-to-work-differently-from-gcc.patch b/packages/gcc/15.1.0/0009-gcc-Allow-g-to-work-differently-from-gcc.patch index 57a22f98..483a2280 100644 --- a/packages/gcc/14.2.0/0009-gcc-Allow-g-to-work-differently-from-gcc.patch +++ b/packages/gcc/15.1.0/0009-gcc-Allow-g-to-work-differently-from-gcc.patch @@ -20,7 +20,7 @@ Signed-off-by: Keith Packard <keithp@keithp.com> --- a/gcc/cp/Make-lang.in +++ b/gcc/cp/Make-lang.in -@@ -77,7 +77,12 @@ +@@ -77,7 +77,12 @@ CFLAGS-cp/module.o += -DMODULE_VERSION=' endif # Create the compiler driver for g++. diff --git a/packages/gcc/14.2.0/0010-libgcc-Exclude-UCLIBC-from-GLIBC-thread-check.patch b/packages/gcc/15.1.0/0010-libgcc-Exclude-UCLIBC-from-GLIBC-thread-check.patch index c0a32648..f5c3e1fd 100644 --- a/packages/gcc/14.2.0/0010-libgcc-Exclude-UCLIBC-from-GLIBC-thread-check.patch +++ b/packages/gcc/15.1.0/0010-libgcc-Exclude-UCLIBC-from-GLIBC-thread-check.patch @@ -19,7 +19,7 @@ Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz> --- a/libgcc/gthr-posix.h +++ b/libgcc/gthr-posix.h -@@ -246,7 +246,7 @@ +@@ -270,7 +270,7 @@ __gthread_active_p (void) library does not provide pthread_cancel, so we do use pthread_create there (and interceptor libraries lose). */ diff --git a/packages/gcc/15.1.0/chksum b/packages/gcc/15.1.0/chksum new file mode 100644 index 00000000..b82ef46d --- /dev/null +++ b/packages/gcc/15.1.0/chksum @@ -0,0 +1,8 @@ +md5 gcc-15.1.0.tar.gz 78e5ad8598b1b246962ceab014345bfd +sha1 gcc-15.1.0.tar.gz 1ce26a0f2ca9bdf7d4302d26d05626e14a4464d7 +sha256 gcc-15.1.0.tar.gz 51b9919ea69c980d7a381db95d4be27edf73b21254eb13d752a08003b4d013b1 +sha512 gcc-15.1.0.tar.gz e8fd551e2c6209a4e5fa25ae66cfaef7ce4823bd22481a573626413dc24026680bebf4d960dbab307b3d5045f8568b2d2dec2fe14084c91e48316c36e0edefd8 +md5 gcc-15.1.0.tar.xz e55d13c55428bca27b4d2ea02f883135 +sha1 gcc-15.1.0.tar.xz 42017f9c1b53a345ea1214c32012609b29dba5a2 +sha256 gcc-15.1.0.tar.xz e2b09ec21660f01fecffb715e0120265216943f038d0e48a9868713e54f06cea +sha512 gcc-15.1.0.tar.xz ddd35ca6c653dffa88f7c7ef9ee4cd806e156e0f3b30f4d63e75a8363361285cd566ee73127734cde6a934611de815bee3e32e24bfd2e0ab9f7ff35c929821c1 diff --git a/packages/gcc/15.1.0/experimental/0001-picolibc-Add-custom-spec-file-fragments-for-using-pi.patch b/packages/gcc/15.1.0/experimental/0001-picolibc-Add-custom-spec-file-fragments-for-using-pi.patch new file mode 100644 index 00000000..4bbd0c68 --- /dev/null +++ b/packages/gcc/15.1.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 <keithp@keithp.com> +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 <keithp@keithp.com> +--- + 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 +@@ -6213,3 +6213,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 ++ <http://www.gnu.org/licenses/>. */ ++ ++#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 ++; <http://www.gnu.org/licenses/>. ++ ++-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/15.1.0/version.desc b/packages/gcc/15.1.0/version.desc new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/packages/gcc/15.1.0/version.desc diff --git a/packages/gcc/7.5.0/0031-riscv-Add-.type-and-.size-directives-to-riscv-libgcc-funct.patch b/packages/gcc/7.5.0/0031-riscv-Add-.type-and-.size-directives-to-riscv-libgcc-funct.patch new file mode 100644 index 00000000..e613c628 --- /dev/null +++ b/packages/gcc/7.5.0/0031-riscv-Add-.type-and-.size-directives-to-riscv-libgcc-funct.patch @@ -0,0 +1,602 @@ +From 3a4c600f389e8c5aa6dcbd6cd14bd0c546af0bb2 Mon Sep 17 00:00:00 2001 +From: Jim Wilson <jimw@sifive.com> +Date: Sat, 9 Dec 2017 03:00:57 +0000 +Subject: [PATCH] Add .type and .size directives to riscv libgcc functions. + + libgcc/ + * config/riscv/div.S: Use FUNC_* macros. + * config/riscv/muldi3.S, config/riscv/multi3.S: Likewise + * config/riscv/save-restore.S: Likewise. + * config/riscv/riscv-asm.h: New. + +From-SVN: r255521 +--- + libgcc/ChangeLog | 7 ++ + libgcc/config/riscv/div.S | 33 ++--- + libgcc/config/riscv/muldi3.S | 6 +- + libgcc/config/riscv/multi3.S | 13 +- + libgcc/config/riscv/riscv-asm.h | 35 ++++++ + libgcc/config/riscv/save-restore.S | 190 ++++++++++++++++------------- + 6 files changed, 182 insertions(+), 102 deletions(-) + create mode 100644 libgcc/config/riscv/riscv-asm.h + +diff --git a/libgcc/config/riscv/div.S b/libgcc/config/riscv/div.S +index 63d542e846..4366c5ce1d 100644 +--- a/libgcc/config/riscv/div.S ++++ b/libgcc/config/riscv/div.S +@@ -23,6 +23,8 @@ a copy of the GCC Runtime Library Exception along with this program; + see the files COPYING3 and COPYING.RUNTIME respectively. If not, see + <http://www.gnu.org/licenses/>. */ + ++#include "riscv-asm.h" ++ + .text + .align 2 + +@@ -33,8 +35,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see + # define __divdi3 __divsi3 + # define __moddi3 __modsi3 + #else +- .globl __udivsi3 +-__udivsi3: ++FUNC_BEGIN (__udivsi3) + /* Compute __udivdi3(a0 << 32, a1 << 32); cast result to uint32_t. */ + sll a0, a0, 32 + sll a1, a1, 32 +@@ -42,9 +43,9 @@ __udivsi3: + jal __udivdi3 + sext.w a0, a0 + jr t0 ++FUNC_END (__udivsi3) + +- .globl __umodsi3 +-__umodsi3: ++FUNC_BEGIN (__umodsi3) + /* Compute __udivdi3((uint32_t)a0, (uint32_t)a1); cast a1 to uint32_t. */ + sll a0, a0, 32 + sll a1, a1, 32 +@@ -54,25 +55,22 @@ __umodsi3: + jal __udivdi3 + sext.w a0, a1 + jr t0 ++FUNC_END (__umodsi3) + +- .globl __modsi3 +- __modsi3 = __moddi3 ++FUNC_ALIAS (__modsi3, __moddi3) + +- .globl __divsi3 +-__divsi3: ++FUNC_BEGIN( __divsi3) + /* Check for special case of INT_MIN/-1. Otherwise, fall into __divdi3. */ + li t0, -1 + beq a1, t0, .L20 + #endif + +- .globl __divdi3 +-__divdi3: ++FUNC_BEGIN (__divdi3) + bltz a0, .L10 + bltz a1, .L11 + /* Since the quotient is positive, fall into __udivdi3. */ + +- .globl __udivdi3 +-__udivdi3: ++FUNC_BEGIN (__udivdi3) + mv a2, a1 + mv a1, a0 + li a0, -1 +@@ -96,14 +94,15 @@ __udivdi3: + bnez a3, .L3 + .L5: + ret ++FUNC_END (__udivdi3) + +- .globl __umoddi3 +-__umoddi3: ++FUNC_BEGIN (__umoddi3) + /* Call __udivdi3(a0, a1), then return the remainder, which is in a1. */ + move t0, ra + jal __udivdi3 + move a0, a1 + jr t0 ++FUNC_END (__umoddi3) + + /* Handle negative arguments to __divdi3. */ + .L10: +@@ -118,9 +117,9 @@ __umoddi3: + jal __udivdi3 + neg a0, a0 + jr t0 ++FUNC_END (__divdi3) + +- .globl __moddi3 +-__moddi3: ++FUNC_BEGIN (__moddi3) + move t0, ra + bltz a1, .L31 + bltz a0, .L32 +@@ -136,6 +135,7 @@ __moddi3: + jal __udivdi3 /* The dividend is hella negative. */ + neg a0, a1 + jr t0 ++FUNC_END (__moddi3) + + #if __riscv_xlen == 64 + /* continuation of __divsi3 */ +@@ -143,4 +143,5 @@ __moddi3: + sll t0, t0, 31 + bne a0, t0, __divdi3 + ret ++FUNC_END (__divsi3) + #endif +diff --git a/libgcc/config/riscv/muldi3.S b/libgcc/config/riscv/muldi3.S +index eb3d9b0df3..7c07878eea 100644 +--- a/libgcc/config/riscv/muldi3.S ++++ b/libgcc/config/riscv/muldi3.S +@@ -23,6 +23,8 @@ a copy of the GCC Runtime Library Exception along with this program; + see the files COPYING3 and COPYING.RUNTIME respectively. If not, see + <http://www.gnu.org/licenses/>. */ + ++#include "riscv-asm.h" ++ + .text + .align 2 + +@@ -31,8 +33,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see + # define __muldi3 __mulsi3 + #endif + +- .globl __muldi3 +-__muldi3: ++FUNC_BEGIN (__muldi3) + mv a2, a0 + li a0, 0 + .L1: +@@ -44,3 +45,4 @@ __muldi3: + slli a2, a2, 1 + bnez a1, .L1 + ret ++FUNC_END (__muldi3) +diff --git a/libgcc/config/riscv/multi3.S b/libgcc/config/riscv/multi3.S +index 4d454e6501..a3b89c6520 100644 +--- a/libgcc/config/riscv/multi3.S ++++ b/libgcc/config/riscv/multi3.S +@@ -23,6 +23,8 @@ a copy of the GCC Runtime Library Exception along with this program; + see the files COPYING3 and COPYING.RUNTIME respectively. If not, see + <http://www.gnu.org/licenses/>. */ + ++#include "riscv-asm.h" ++ + .text + .align 2 + +@@ -31,8 +33,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see + # define __multi3 __muldi3 + #endif + +- .globl __multi3 +-__multi3: ++FUNC_BEGIN (__multi3) + + #if __riscv_xlen == 32 + /* Our RV64 64-bit routines are equivalent to our RV32 32-bit routines. */ +@@ -79,3 +80,11 @@ __multi3: + mv a0, t2 + mv a1, t4 + jr t0 ++ ++#if __riscv_xlen == 32 ++/* Our RV64 64-bit routines are equivalent to our RV32 32-bit routines. */ ++# undef __muldi3 ++#endif ++ ++FUNC_END (__multi3) ++ +diff --git a/libgcc/config/riscv/riscv-asm.h b/libgcc/config/riscv/riscv-asm.h +new file mode 100644 +index 0000000000..fbfe5f0dbf +--- /dev/null ++++ b/libgcc/config/riscv/riscv-asm.h +@@ -0,0 +1,35 @@ ++/* Copyright (C) 2017 Free Software Foundation, Inc. ++ ++This file 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. ++ ++This file 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 ++<http://www.gnu.org/licenses/>. */ ++ ++#define FUNC_TYPE(X) .type X,@function ++#define FUNC_SIZE(X) .size X,.-X ++ ++#define FUNC_BEGIN(X) \ ++ .globl X; \ ++ FUNC_TYPE (X); \ ++X: ++ ++#define FUNC_END(X) \ ++ FUNC_SIZE(X) ++ ++#define FUNC_ALIAS(X,Y) \ ++ .globl X; \ ++ X = Y +diff --git a/libgcc/config/riscv/save-restore.S b/libgcc/config/riscv/save-restore.S +index 2073a73089..c2f1740f42 100644 +--- a/libgcc/config/riscv/save-restore.S ++++ b/libgcc/config/riscv/save-restore.S +@@ -23,39 +23,13 @@ a copy of the GCC Runtime Library Exception along with this program; + see the files COPYING3 and COPYING.RUNTIME respectively. If not, see + <http://www.gnu.org/licenses/>. */ + +- .text ++#include "riscv-asm.h" + +- .globl __riscv_save_12 +- .globl __riscv_save_11 +- .globl __riscv_save_10 +- .globl __riscv_save_9 +- .globl __riscv_save_8 +- .globl __riscv_save_7 +- .globl __riscv_save_6 +- .globl __riscv_save_5 +- .globl __riscv_save_4 +- .globl __riscv_save_3 +- .globl __riscv_save_2 +- .globl __riscv_save_1 +- .globl __riscv_save_0 +- +- .globl __riscv_restore_12 +- .globl __riscv_restore_11 +- .globl __riscv_restore_10 +- .globl __riscv_restore_9 +- .globl __riscv_restore_8 +- .globl __riscv_restore_7 +- .globl __riscv_restore_6 +- .globl __riscv_restore_5 +- .globl __riscv_restore_4 +- .globl __riscv_restore_3 +- .globl __riscv_restore_2 +- .globl __riscv_restore_1 +- .globl __riscv_restore_0 ++ .text + + #if __riscv_xlen == 64 + +-__riscv_save_12: ++FUNC_BEGIN (__riscv_save_12) + .cfi_startproc + # __riscv_save_* routine use t0/x5 as return address + .cfi_return_column 5 +@@ -66,8 +40,8 @@ __riscv_save_12: + .cfi_offset 27, -104 + j .Ls10 + +-__riscv_save_11: +-__riscv_save_10: ++FUNC_BEGIN (__riscv_save_11) ++FUNC_BEGIN (__riscv_save_10) + .cfi_restore 27 + addi sp, sp, -112 + .cfi_def_cfa_offset 112 +@@ -79,8 +53,8 @@ __riscv_save_10: + .cfi_offset 25, -88 + j .Ls8 + +-__riscv_save_9: +-__riscv_save_8: ++FUNC_BEGIN (__riscv_save_9) ++FUNC_BEGIN (__riscv_save_8) + .cfi_restore 25 + .cfi_restore 26 + .cfi_restore 27 +@@ -94,8 +68,8 @@ __riscv_save_8: + .cfi_offset 23, -72 + j .Ls6 + +-__riscv_save_7: +-__riscv_save_6: ++FUNC_BEGIN (__riscv_save_7) ++FUNC_BEGIN (__riscv_save_6) + .cfi_restore 23 + .cfi_restore 24 + .cfi_restore 25 +@@ -111,8 +85,8 @@ __riscv_save_6: + .cfi_offset 21, -56 + j .Ls4 + +-__riscv_save_5: +-__riscv_save_4: ++FUNC_BEGIN (__riscv_save_5) ++FUNC_BEGIN (__riscv_save_4) + .cfi_restore 21 + .cfi_restore 22 + .cfi_restore 24 +@@ -133,8 +107,8 @@ __riscv_save_4: + .cfi_offset 19, -40 + j .Ls2 + +-__riscv_save_3: +-__riscv_save_2: ++FUNC_BEGIN (__riscv_save_3) ++FUNC_BEGIN (__riscv_save_2) + .cfi_restore 19 + .cfi_restore 20 + .cfi_restore 21 +@@ -164,9 +138,20 @@ __riscv_save_2: + sub sp, sp, t1 + jr t0 + .cfi_endproc +- +-__riscv_save_1: +-__riscv_save_0: ++FUNC_END (__riscv_save_12) ++FUNC_END (__riscv_save_11) ++FUNC_END (__riscv_save_10) ++FUNC_END (__riscv_save_9) ++FUNC_END (__riscv_save_8) ++FUNC_END (__riscv_save_7) ++FUNC_END (__riscv_save_6) ++FUNC_END (__riscv_save_5) ++FUNC_END (__riscv_save_4) ++FUNC_END (__riscv_save_3) ++FUNC_END (__riscv_save_2) ++ ++FUNC_BEGIN (__riscv_save_1) ++FUNC_BEGIN (__riscv_save_0) + .cfi_startproc + # __riscv_save_* routine use t0/x5 as return address + .cfi_return_column 5 +@@ -178,8 +163,10 @@ __riscv_save_0: + .cfi_offset 1, -8 + jr t0 + .cfi_endproc ++FUNC_END (__riscv_save_1) ++FUNC_END (__riscv_save_0) + +-__riscv_restore_12: ++FUNC_BEGIN (__riscv_restore_12) + .cfi_startproc + .cfi_def_cfa_offset 112 + .cfi_offset 27, -104 +@@ -199,8 +186,8 @@ __riscv_restore_12: + .cfi_restore 27 + addi sp, sp, 16 + +-__riscv_restore_11: +-__riscv_restore_10: ++FUNC_BEGIN (__riscv_restore_11) ++FUNC_BEGIN (__riscv_restore_10) + .cfi_restore 27 + .cfi_def_cfa_offset 96 + ld s10, 0(sp) +@@ -209,8 +196,8 @@ __riscv_restore_10: + .cfi_restore 25 + addi sp, sp, 16 + +-__riscv_restore_9: +-__riscv_restore_8: ++FUNC_BEGIN (__riscv_restore_9) ++FUNC_BEGIN (__riscv_restore_8) + .cfi_restore 25 + .cfi_restore 26 + .cfi_restore 27 +@@ -221,8 +208,8 @@ __riscv_restore_8: + .cfi_restore 23 + addi sp, sp, 16 + +-__riscv_restore_7: +-__riscv_restore_6: ++FUNC_BEGIN (__riscv_restore_7) ++FUNC_BEGIN (__riscv_restore_6) + .cfi_restore 23 + .cfi_restore 24 + .cfi_restore 25 +@@ -235,8 +222,8 @@ __riscv_restore_6: + .cfi_restore 21 + addi sp, sp, 16 + +-__riscv_restore_5: +-__riscv_restore_4: ++FUNC_BEGIN (__riscv_restore_5) ++FUNC_BEGIN (__riscv_restore_4) + .cfi_restore 21 + .cfi_restore 22 + .cfi_restore 23 +@@ -251,8 +238,8 @@ __riscv_restore_4: + .cfi_restore 19 + addi sp, sp, 16 + +-__riscv_restore_3: +-__riscv_restore_2: ++FUNC_BEGIN (__riscv_restore_3) ++FUNC_BEGIN (__riscv_restore_2) + .cfi_restore 19 + .cfi_restore 20 + .cfi_restore 21 +@@ -269,8 +256,8 @@ __riscv_restore_2: + .cfi_restore 9 + addi sp, sp, 16 + +-__riscv_restore_1: +-__riscv_restore_0: ++FUNC_BEGIN (__riscv_restore_1) ++FUNC_BEGIN (__riscv_restore_0) + .cfi_restore 9 + .cfi_restore 18 + .cfi_restore 19 +@@ -291,10 +278,23 @@ __riscv_restore_0: + .cfi_def_cfa_offset 0 + ret + .cfi_endproc ++FUNC_END (__riscv_restore_12) ++FUNC_END (__riscv_restore_11) ++FUNC_END (__riscv_restore_10) ++FUNC_END (__riscv_restore_9) ++FUNC_END (__riscv_restore_8) ++FUNC_END (__riscv_restore_7) ++FUNC_END (__riscv_restore_6) ++FUNC_END (__riscv_restore_5) ++FUNC_END (__riscv_restore_4) ++FUNC_END (__riscv_restore_3) ++FUNC_END (__riscv_restore_2) ++FUNC_END (__riscv_restore_1) ++FUNC_END (__riscv_restore_0) + + #else + +-__riscv_save_12: ++FUNC_BEGIN (__riscv_save_12) + .cfi_startproc + # __riscv_save_* routine use t0/x5 as return address + .cfi_return_column 5 +@@ -305,10 +305,10 @@ __riscv_save_12: + .cfi_offset 27, -52 + j .Ls10 + +-__riscv_save_11: +-__riscv_save_10: +-__riscv_save_9: +-__riscv_save_8: ++FUNC_BEGIN (__riscv_save_11) ++FUNC_BEGIN (__riscv_save_10) ++FUNC_BEGIN (__riscv_save_9) ++FUNC_BEGIN (__riscv_save_8) + .cfi_restore 27 + addi sp, sp, -64 + .cfi_def_cfa_offset 64 +@@ -324,10 +324,10 @@ __riscv_save_8: + .cfi_offset 23, -36 + j .Ls6 + +-__riscv_save_7: +-__riscv_save_6: +-__riscv_save_5: +-__riscv_save_4: ++FUNC_BEGIN (__riscv_save_7) ++FUNC_BEGIN (__riscv_save_6) ++FUNC_BEGIN (__riscv_save_5) ++FUNC_BEGIN (__riscv_save_4) + .cfi_restore 23 + .cfi_restore 24 + .cfi_restore 25 +@@ -358,11 +358,20 @@ __riscv_save_4: + sub sp, sp, t1 + jr t0 + .cfi_endproc +- +-__riscv_save_3: +-__riscv_save_2: +-__riscv_save_1: +-__riscv_save_0: ++FUNC_END (__riscv_save_12) ++FUNC_END (__riscv_save_11) ++FUNC_END (__riscv_save_10) ++FUNC_END (__riscv_save_9) ++FUNC_END (__riscv_save_8) ++FUNC_END (__riscv_save_7) ++FUNC_END (__riscv_save_6) ++FUNC_END (__riscv_save_5) ++FUNC_END (__riscv_save_4) ++ ++FUNC_BEGIN (__riscv_save_3) ++FUNC_BEGIN (__riscv_save_2) ++FUNC_BEGIN (__riscv_save_1) ++FUNC_BEGIN (__riscv_save_0) + .cfi_startproc + # __riscv_save_* routine use t0/x5 as return address + .cfi_return_column 5 +@@ -377,8 +386,12 @@ __riscv_save_0: + .cfi_offset 1, -4 + jr t0 + .cfi_endproc ++FUNC_END (__riscv_save_3) ++FUNC_END (__riscv_save_2) ++FUNC_END (__riscv_save_1) ++FUNC_END (__riscv_save_0) + +-__riscv_restore_12: ++FUNC_BEGIN (__riscv_restore_12) + .cfi_startproc + .cfi_def_cfa_offset 64 + .cfi_offset 27, -52 +@@ -398,10 +411,10 @@ __riscv_restore_12: + .cfi_restore 27 + addi sp, sp, 16 + +-__riscv_restore_11: +-__riscv_restore_10: +-__riscv_restore_9: +-__riscv_restore_8: ++FUNC_BEGIN (__riscv_restore_11) ++FUNC_BEGIN (__riscv_restore_10) ++FUNC_BEGIN (__riscv_restore_9) ++FUNC_BEGIN (__riscv_restore_8) + .cfi_restore 27 + .cfi_def_cfa_offset 48 + lw s10, 0(sp) +@@ -414,10 +427,10 @@ __riscv_restore_8: + .cfi_restore 23 + addi sp, sp, 16 + +-__riscv_restore_7: +-__riscv_restore_6: +-__riscv_restore_5: +-__riscv_restore_4: ++FUNC_BEGIN (__riscv_restore_7) ++FUNC_BEGIN (__riscv_restore_6) ++FUNC_BEGIN (__riscv_restore_5) ++FUNC_BEGIN (__riscv_restore_4) + .cfi_restore 23 + .cfi_restore 24 + .cfi_restore 25 +@@ -434,10 +447,10 @@ __riscv_restore_4: + .cfi_restore 19 + addi sp, sp, 16 + +-__riscv_restore_3: +-__riscv_restore_2: +-__riscv_restore_1: +-__riscv_restore_0: ++FUNC_BEGIN (__riscv_restore_3) ++FUNC_BEGIN (__riscv_restore_2) ++FUNC_BEGIN (__riscv_restore_1) ++FUNC_BEGIN (__riscv_restore_0) + .cfi_restore 19 + .cfi_restore 20 + .cfi_restore 21 +@@ -459,5 +472,18 @@ __riscv_restore_0: + .cfi_def_cfa_offset 0 + ret + .cfi_endproc ++FUNC_END (__riscv_restore_12) ++FUNC_END (__riscv_restore_11) ++FUNC_END (__riscv_restore_10) ++FUNC_END (__riscv_restore_9) ++FUNC_END (__riscv_restore_8) ++FUNC_END (__riscv_restore_7) ++FUNC_END (__riscv_restore_6) ++FUNC_END (__riscv_restore_5) ++FUNC_END (__riscv_restore_4) ++FUNC_END (__riscv_restore_3) ++FUNC_END (__riscv_restore_2) ++FUNC_END (__riscv_restore_1) ++FUNC_END (__riscv_restore_0) + + #endif +-- +2.49.0 + diff --git a/packages/gcc/7.5.0/0032-riscv-Make-__divdi3-handle-div-by-zero-same-as-hard.patch b/packages/gcc/7.5.0/0032-riscv-Make-__divdi3-handle-div-by-zero-same-as-hard.patch new file mode 100644 index 00000000..47c25104 --- /dev/null +++ b/packages/gcc/7.5.0/0032-riscv-Make-__divdi3-handle-div-by-zero-same-as-hard.patch @@ -0,0 +1,40 @@ +From 4013baf99c38f7bca06a51f8301e8fb195ccfa33 Mon Sep 17 00:00:00 2001 +From: Jim Wilson <jimw@sifive.com> +Date: Tue, 2 Jun 2020 11:19:39 -0700 +Subject: [PATCH] RISC-V: Make __divdi3 handle div by zero same as hardware. + +The ISA manual specifies that divide by zero always returns -1 as the result. +We were failing to do that when the dividend was negative. + +Original patch from Virginie Moser. + + libgcc/ + * config/riscv/div.S (__divdi3): For negative arguments, change bgez + to bgtz. +--- + libgcc/config/riscv/div.S | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) + +diff --git a/libgcc/config/riscv/div.S b/libgcc/config/riscv/div.S +index 151f8e273a..17234324c1 100644 +--- a/libgcc/config/riscv/div.S ++++ b/libgcc/config/riscv/div.S +@@ -107,10 +107,12 @@ FUNC_END (__umoddi3) + /* Handle negative arguments to __divdi3. */ + .L10: + neg a0, a0 +- bgez a1, .L12 /* Compute __udivdi3(-a0, a1), then negate the result. */ ++ /* Zero is handled as a negative so that the result will not be inverted. */ ++ bgtz a1, .L12 /* Compute __udivdi3(-a0, a1), then negate the result. */ ++ + neg a1, a1 +- j __udivdi3 /* Compute __udivdi3(-a0, -a1). */ +-.L11: /* Compute __udivdi3(a0, -a1), then negate the result. */ ++ j __udivdi3 /* Compute __udivdi3(-a0, -a1). */ ++.L11: /* Compute __udivdi3(a0, -a1), then negate the result. */ + neg a1, a1 + .L12: + move t0, ra +-- +2.49.0 + diff --git a/packages/gcc/7.5.0/0033-riscv-jal-cannot-refer-to-a-default-visibility-symb.patch b/packages/gcc/7.5.0/0033-riscv-jal-cannot-refer-to-a-default-visibility-symb.patch new file mode 100644 index 00000000..1422c69d --- /dev/null +++ b/packages/gcc/7.5.0/0033-riscv-jal-cannot-refer-to-a-default-visibility-symb.patch @@ -0,0 +1,120 @@ +From 45116f342057b7facecd3d05c2091ce3a77eda59 Mon Sep 17 00:00:00 2001 +From: Nelson Chu <nelson.chu@sifive.com> +Date: Mon, 29 Nov 2021 04:48:20 -0800 +Subject: [PATCH] RISC-V: jal cannot refer to a default visibility symbol for + shared object. + +This is the original binutils bugzilla report, +https://sourceware.org/bugzilla/show_bug.cgi?id=28509 + +And this is the first version of the proposed binutils patch, +https://sourceware.org/pipermail/binutils/2021-November/118398.html + +After applying the binutils patch, I get the the unexpected error when +building libgcc, + +/scratch/nelsonc/riscv-gnu-toolchain/riscv-gcc/libgcc/config/riscv/div.S:42: +/scratch/nelsonc/build-upstream/rv64gc-linux/build-install/riscv64-unknown-linux-gnu/bin/ld: relocation R_RISCV_JAL against `__udivdi3' which may bind externally can not be used when making a shared object; recompile with -fPIC + +Therefore, this patch add an extra hidden alias symbol for __udivdi3, and +then use HIDDEN_JUMPTARGET to target a non-preemptible symbol instead. +The solution is similar to glibc as follows, +https://sourceware.org/git/?p=glibc.git;a=commit;h=68389203832ab39dd0dbaabbc4059e7fff51c29b + +libgcc/ChangeLog: + + * config/riscv/div.S: Add the hidden alias symbol for __udivdi3, and + then use HIDDEN_JUMPTARGET to target it since it is non-preemptible. + * config/riscv/riscv-asm.h: Added new macros HIDDEN_JUMPTARGET and + HIDDEN_DEF. +--- + libgcc/config/riscv/div.S | 15 ++++++++------- + libgcc/config/riscv/riscv-asm.h | 6 ++++++ + 2 files changed, 14 insertions(+), 7 deletions(-) + +diff --git a/libgcc/config/riscv/div.S b/libgcc/config/riscv/div.S +index c9bd7879c1..723c3b82e4 100644 +--- a/libgcc/config/riscv/div.S ++++ b/libgcc/config/riscv/div.S +@@ -40,7 +40,7 @@ FUNC_BEGIN (__udivsi3) + sll a0, a0, 32 + sll a1, a1, 32 + move t0, ra +- jal __udivdi3 ++ jal HIDDEN_JUMPTARGET(__udivdi3) + sext.w a0, a0 + jr t0 + FUNC_END (__udivsi3) +@@ -52,7 +52,7 @@ FUNC_BEGIN (__umodsi3) + srl a0, a0, 32 + srl a1, a1, 32 + move t0, ra +- jal __udivdi3 ++ jal HIDDEN_JUMPTARGET(__udivdi3) + sext.w a0, a1 + jr t0 + FUNC_END (__umodsi3) +@@ -95,11 +95,12 @@ FUNC_BEGIN (__udivdi3) + .L5: + ret + FUNC_END (__udivdi3) ++HIDDEN_DEF (__udivdi3) + + FUNC_BEGIN (__umoddi3) + /* Call __udivdi3(a0, a1), then return the remainder, which is in a1. */ + move t0, ra +- jal __udivdi3 ++ jal HIDDEN_JUMPTARGET(__udivdi3) + move a0, a1 + jr t0 + FUNC_END (__umoddi3) +@@ -111,12 +112,12 @@ FUNC_END (__umoddi3) + bgtz a1, .L12 /* Compute __udivdi3(-a0, a1), then negate the result. */ + + neg a1, a1 +- j __udivdi3 /* Compute __udivdi3(-a0, -a1). */ ++ j HIDDEN_JUMPTARGET(__udivdi3) /* Compute __udivdi3(-a0, -a1). */ + .L11: /* Compute __udivdi3(a0, -a1), then negate the result. */ + neg a1, a1 + .L12: + move t0, ra +- jal __udivdi3 ++ jal HIDDEN_JUMPTARGET(__udivdi3) + neg a0, a0 + jr t0 + FUNC_END (__divdi3) +@@ -126,7 +127,7 @@ FUNC_BEGIN (__moddi3) + bltz a1, .L31 + bltz a0, .L32 + .L30: +- jal __udivdi3 /* The dividend is not negative. */ ++ jal HIDDEN_JUMPTARGET(__udivdi3) /* The dividend is not negative. */ + move a0, a1 + jr t0 + .L31: +@@ -134,7 +135,7 @@ FUNC_BEGIN (__moddi3) + bgez a0, .L30 + .L32: + neg a0, a0 +- jal __udivdi3 /* The dividend is hella negative. */ ++ jal HIDDEN_JUMPTARGET(__udivdi3) /* The dividend is hella negative. */ + neg a0, a1 + jr t0 + FUNC_END (__moddi3) +diff --git a/libgcc/config/riscv/riscv-asm.h b/libgcc/config/riscv/riscv-asm.h +index 8550707a4a..96dd85b0df 100644 +--- a/libgcc/config/riscv/riscv-asm.h ++++ b/libgcc/config/riscv/riscv-asm.h +@@ -33,3 +33,9 @@ X: + #define FUNC_ALIAS(X,Y) \ + .globl X; \ + X = Y ++ ++#define CONCAT1(a, b) CONCAT2(a, b) ++#define CONCAT2(a, b) a ## b ++#define HIDDEN_JUMPTARGET(X) CONCAT1(__hidden_, X) ++#define HIDDEN_DEF(X) FUNC_ALIAS(HIDDEN_JUMPTARGET(X), X); \ ++ .hidden HIDDEN_JUMPTARGET(X) +-- +2.49.0 + diff --git a/packages/gcc/8.5.0/0033-riscv-Make-__divdi3-handle-div-by-zero-same-as-hard.patch b/packages/gcc/8.5.0/0033-riscv-Make-__divdi3-handle-div-by-zero-same-as-hard.patch new file mode 100644 index 00000000..47c25104 --- /dev/null +++ b/packages/gcc/8.5.0/0033-riscv-Make-__divdi3-handle-div-by-zero-same-as-hard.patch @@ -0,0 +1,40 @@ +From 4013baf99c38f7bca06a51f8301e8fb195ccfa33 Mon Sep 17 00:00:00 2001 +From: Jim Wilson <jimw@sifive.com> +Date: Tue, 2 Jun 2020 11:19:39 -0700 +Subject: [PATCH] RISC-V: Make __divdi3 handle div by zero same as hardware. + +The ISA manual specifies that divide by zero always returns -1 as the result. +We were failing to do that when the dividend was negative. + +Original patch from Virginie Moser. + + libgcc/ + * config/riscv/div.S (__divdi3): For negative arguments, change bgez + to bgtz. +--- + libgcc/config/riscv/div.S | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) + +diff --git a/libgcc/config/riscv/div.S b/libgcc/config/riscv/div.S +index 151f8e273a..17234324c1 100644 +--- a/libgcc/config/riscv/div.S ++++ b/libgcc/config/riscv/div.S +@@ -107,10 +107,12 @@ FUNC_END (__umoddi3) + /* Handle negative arguments to __divdi3. */ + .L10: + neg a0, a0 +- bgez a1, .L12 /* Compute __udivdi3(-a0, a1), then negate the result. */ ++ /* Zero is handled as a negative so that the result will not be inverted. */ ++ bgtz a1, .L12 /* Compute __udivdi3(-a0, a1), then negate the result. */ ++ + neg a1, a1 +- j __udivdi3 /* Compute __udivdi3(-a0, -a1). */ +-.L11: /* Compute __udivdi3(a0, -a1), then negate the result. */ ++ j __udivdi3 /* Compute __udivdi3(-a0, -a1). */ ++.L11: /* Compute __udivdi3(a0, -a1), then negate the result. */ + neg a1, a1 + .L12: + move t0, ra +-- +2.49.0 + diff --git a/packages/gcc/8.5.0/0034-riscv-jal-cannot-refer-to-a-default-visibility-symb.patch b/packages/gcc/8.5.0/0034-riscv-jal-cannot-refer-to-a-default-visibility-symb.patch new file mode 100644 index 00000000..1422c69d --- /dev/null +++ b/packages/gcc/8.5.0/0034-riscv-jal-cannot-refer-to-a-default-visibility-symb.patch @@ -0,0 +1,120 @@ +From 45116f342057b7facecd3d05c2091ce3a77eda59 Mon Sep 17 00:00:00 2001 +From: Nelson Chu <nelson.chu@sifive.com> +Date: Mon, 29 Nov 2021 04:48:20 -0800 +Subject: [PATCH] RISC-V: jal cannot refer to a default visibility symbol for + shared object. + +This is the original binutils bugzilla report, +https://sourceware.org/bugzilla/show_bug.cgi?id=28509 + +And this is the first version of the proposed binutils patch, +https://sourceware.org/pipermail/binutils/2021-November/118398.html + +After applying the binutils patch, I get the the unexpected error when +building libgcc, + +/scratch/nelsonc/riscv-gnu-toolchain/riscv-gcc/libgcc/config/riscv/div.S:42: +/scratch/nelsonc/build-upstream/rv64gc-linux/build-install/riscv64-unknown-linux-gnu/bin/ld: relocation R_RISCV_JAL against `__udivdi3' which may bind externally can not be used when making a shared object; recompile with -fPIC + +Therefore, this patch add an extra hidden alias symbol for __udivdi3, and +then use HIDDEN_JUMPTARGET to target a non-preemptible symbol instead. +The solution is similar to glibc as follows, +https://sourceware.org/git/?p=glibc.git;a=commit;h=68389203832ab39dd0dbaabbc4059e7fff51c29b + +libgcc/ChangeLog: + + * config/riscv/div.S: Add the hidden alias symbol for __udivdi3, and + then use HIDDEN_JUMPTARGET to target it since it is non-preemptible. + * config/riscv/riscv-asm.h: Added new macros HIDDEN_JUMPTARGET and + HIDDEN_DEF. +--- + libgcc/config/riscv/div.S | 15 ++++++++------- + libgcc/config/riscv/riscv-asm.h | 6 ++++++ + 2 files changed, 14 insertions(+), 7 deletions(-) + +diff --git a/libgcc/config/riscv/div.S b/libgcc/config/riscv/div.S +index c9bd7879c1..723c3b82e4 100644 +--- a/libgcc/config/riscv/div.S ++++ b/libgcc/config/riscv/div.S +@@ -40,7 +40,7 @@ FUNC_BEGIN (__udivsi3) + sll a0, a0, 32 + sll a1, a1, 32 + move t0, ra +- jal __udivdi3 ++ jal HIDDEN_JUMPTARGET(__udivdi3) + sext.w a0, a0 + jr t0 + FUNC_END (__udivsi3) +@@ -52,7 +52,7 @@ FUNC_BEGIN (__umodsi3) + srl a0, a0, 32 + srl a1, a1, 32 + move t0, ra +- jal __udivdi3 ++ jal HIDDEN_JUMPTARGET(__udivdi3) + sext.w a0, a1 + jr t0 + FUNC_END (__umodsi3) +@@ -95,11 +95,12 @@ FUNC_BEGIN (__udivdi3) + .L5: + ret + FUNC_END (__udivdi3) ++HIDDEN_DEF (__udivdi3) + + FUNC_BEGIN (__umoddi3) + /* Call __udivdi3(a0, a1), then return the remainder, which is in a1. */ + move t0, ra +- jal __udivdi3 ++ jal HIDDEN_JUMPTARGET(__udivdi3) + move a0, a1 + jr t0 + FUNC_END (__umoddi3) +@@ -111,12 +112,12 @@ FUNC_END (__umoddi3) + bgtz a1, .L12 /* Compute __udivdi3(-a0, a1), then negate the result. */ + + neg a1, a1 +- j __udivdi3 /* Compute __udivdi3(-a0, -a1). */ ++ j HIDDEN_JUMPTARGET(__udivdi3) /* Compute __udivdi3(-a0, -a1). */ + .L11: /* Compute __udivdi3(a0, -a1), then negate the result. */ + neg a1, a1 + .L12: + move t0, ra +- jal __udivdi3 ++ jal HIDDEN_JUMPTARGET(__udivdi3) + neg a0, a0 + jr t0 + FUNC_END (__divdi3) +@@ -126,7 +127,7 @@ FUNC_BEGIN (__moddi3) + bltz a1, .L31 + bltz a0, .L32 + .L30: +- jal __udivdi3 /* The dividend is not negative. */ ++ jal HIDDEN_JUMPTARGET(__udivdi3) /* The dividend is not negative. */ + move a0, a1 + jr t0 + .L31: +@@ -134,7 +135,7 @@ FUNC_BEGIN (__moddi3) + bgez a0, .L30 + .L32: + neg a0, a0 +- jal __udivdi3 /* The dividend is hella negative. */ ++ jal HIDDEN_JUMPTARGET(__udivdi3) /* The dividend is hella negative. */ + neg a0, a1 + jr t0 + FUNC_END (__moddi3) +diff --git a/libgcc/config/riscv/riscv-asm.h b/libgcc/config/riscv/riscv-asm.h +index 8550707a4a..96dd85b0df 100644 +--- a/libgcc/config/riscv/riscv-asm.h ++++ b/libgcc/config/riscv/riscv-asm.h +@@ -33,3 +33,9 @@ X: + #define FUNC_ALIAS(X,Y) \ + .globl X; \ + X = Y ++ ++#define CONCAT1(a, b) CONCAT2(a, b) ++#define CONCAT2(a, b) a ## b ++#define HIDDEN_JUMPTARGET(X) CONCAT1(__hidden_, X) ++#define HIDDEN_DEF(X) FUNC_ALIAS(HIDDEN_JUMPTARGET(X), X); \ ++ .hidden HIDDEN_JUMPTARGET(X) +-- +2.49.0 + diff --git a/packages/gcc/9.5.0/0031-riscv-Make-__divdi3-handle-div-by-zero-same-as-hard.patch b/packages/gcc/9.5.0/0031-riscv-Make-__divdi3-handle-div-by-zero-same-as-hard.patch new file mode 100644 index 00000000..47c25104 --- /dev/null +++ b/packages/gcc/9.5.0/0031-riscv-Make-__divdi3-handle-div-by-zero-same-as-hard.patch @@ -0,0 +1,40 @@ +From 4013baf99c38f7bca06a51f8301e8fb195ccfa33 Mon Sep 17 00:00:00 2001 +From: Jim Wilson <jimw@sifive.com> +Date: Tue, 2 Jun 2020 11:19:39 -0700 +Subject: [PATCH] RISC-V: Make __divdi3 handle div by zero same as hardware. + +The ISA manual specifies that divide by zero always returns -1 as the result. +We were failing to do that when the dividend was negative. + +Original patch from Virginie Moser. + + libgcc/ + * config/riscv/div.S (__divdi3): For negative arguments, change bgez + to bgtz. +--- + libgcc/config/riscv/div.S | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) + +diff --git a/libgcc/config/riscv/div.S b/libgcc/config/riscv/div.S +index 151f8e273a..17234324c1 100644 +--- a/libgcc/config/riscv/div.S ++++ b/libgcc/config/riscv/div.S +@@ -107,10 +107,12 @@ FUNC_END (__umoddi3) + /* Handle negative arguments to __divdi3. */ + .L10: + neg a0, a0 +- bgez a1, .L12 /* Compute __udivdi3(-a0, a1), then negate the result. */ ++ /* Zero is handled as a negative so that the result will not be inverted. */ ++ bgtz a1, .L12 /* Compute __udivdi3(-a0, a1), then negate the result. */ ++ + neg a1, a1 +- j __udivdi3 /* Compute __udivdi3(-a0, -a1). */ +-.L11: /* Compute __udivdi3(a0, -a1), then negate the result. */ ++ j __udivdi3 /* Compute __udivdi3(-a0, -a1). */ ++.L11: /* Compute __udivdi3(a0, -a1), then negate the result. */ + neg a1, a1 + .L12: + move t0, ra +-- +2.49.0 + diff --git a/packages/gcc/9.5.0/0032-riscv-jal-cannot-refer-to-a-default-visibility-symb.patch b/packages/gcc/9.5.0/0032-riscv-jal-cannot-refer-to-a-default-visibility-symb.patch new file mode 100644 index 00000000..1422c69d --- /dev/null +++ b/packages/gcc/9.5.0/0032-riscv-jal-cannot-refer-to-a-default-visibility-symb.patch @@ -0,0 +1,120 @@ +From 45116f342057b7facecd3d05c2091ce3a77eda59 Mon Sep 17 00:00:00 2001 +From: Nelson Chu <nelson.chu@sifive.com> +Date: Mon, 29 Nov 2021 04:48:20 -0800 +Subject: [PATCH] RISC-V: jal cannot refer to a default visibility symbol for + shared object. + +This is the original binutils bugzilla report, +https://sourceware.org/bugzilla/show_bug.cgi?id=28509 + +And this is the first version of the proposed binutils patch, +https://sourceware.org/pipermail/binutils/2021-November/118398.html + +After applying the binutils patch, I get the the unexpected error when +building libgcc, + +/scratch/nelsonc/riscv-gnu-toolchain/riscv-gcc/libgcc/config/riscv/div.S:42: +/scratch/nelsonc/build-upstream/rv64gc-linux/build-install/riscv64-unknown-linux-gnu/bin/ld: relocation R_RISCV_JAL against `__udivdi3' which may bind externally can not be used when making a shared object; recompile with -fPIC + +Therefore, this patch add an extra hidden alias symbol for __udivdi3, and +then use HIDDEN_JUMPTARGET to target a non-preemptible symbol instead. +The solution is similar to glibc as follows, +https://sourceware.org/git/?p=glibc.git;a=commit;h=68389203832ab39dd0dbaabbc4059e7fff51c29b + +libgcc/ChangeLog: + + * config/riscv/div.S: Add the hidden alias symbol for __udivdi3, and + then use HIDDEN_JUMPTARGET to target it since it is non-preemptible. + * config/riscv/riscv-asm.h: Added new macros HIDDEN_JUMPTARGET and + HIDDEN_DEF. +--- + libgcc/config/riscv/div.S | 15 ++++++++------- + libgcc/config/riscv/riscv-asm.h | 6 ++++++ + 2 files changed, 14 insertions(+), 7 deletions(-) + +diff --git a/libgcc/config/riscv/div.S b/libgcc/config/riscv/div.S +index c9bd7879c1..723c3b82e4 100644 +--- a/libgcc/config/riscv/div.S ++++ b/libgcc/config/riscv/div.S +@@ -40,7 +40,7 @@ FUNC_BEGIN (__udivsi3) + sll a0, a0, 32 + sll a1, a1, 32 + move t0, ra +- jal __udivdi3 ++ jal HIDDEN_JUMPTARGET(__udivdi3) + sext.w a0, a0 + jr t0 + FUNC_END (__udivsi3) +@@ -52,7 +52,7 @@ FUNC_BEGIN (__umodsi3) + srl a0, a0, 32 + srl a1, a1, 32 + move t0, ra +- jal __udivdi3 ++ jal HIDDEN_JUMPTARGET(__udivdi3) + sext.w a0, a1 + jr t0 + FUNC_END (__umodsi3) +@@ -95,11 +95,12 @@ FUNC_BEGIN (__udivdi3) + .L5: + ret + FUNC_END (__udivdi3) ++HIDDEN_DEF (__udivdi3) + + FUNC_BEGIN (__umoddi3) + /* Call __udivdi3(a0, a1), then return the remainder, which is in a1. */ + move t0, ra +- jal __udivdi3 ++ jal HIDDEN_JUMPTARGET(__udivdi3) + move a0, a1 + jr t0 + FUNC_END (__umoddi3) +@@ -111,12 +112,12 @@ FUNC_END (__umoddi3) + bgtz a1, .L12 /* Compute __udivdi3(-a0, a1), then negate the result. */ + + neg a1, a1 +- j __udivdi3 /* Compute __udivdi3(-a0, -a1). */ ++ j HIDDEN_JUMPTARGET(__udivdi3) /* Compute __udivdi3(-a0, -a1). */ + .L11: /* Compute __udivdi3(a0, -a1), then negate the result. */ + neg a1, a1 + .L12: + move t0, ra +- jal __udivdi3 ++ jal HIDDEN_JUMPTARGET(__udivdi3) + neg a0, a0 + jr t0 + FUNC_END (__divdi3) +@@ -126,7 +127,7 @@ FUNC_BEGIN (__moddi3) + bltz a1, .L31 + bltz a0, .L32 + .L30: +- jal __udivdi3 /* The dividend is not negative. */ ++ jal HIDDEN_JUMPTARGET(__udivdi3) /* The dividend is not negative. */ + move a0, a1 + jr t0 + .L31: +@@ -134,7 +135,7 @@ FUNC_BEGIN (__moddi3) + bgez a0, .L30 + .L32: + neg a0, a0 +- jal __udivdi3 /* The dividend is hella negative. */ ++ jal HIDDEN_JUMPTARGET(__udivdi3) /* The dividend is hella negative. */ + neg a0, a1 + jr t0 + FUNC_END (__moddi3) +diff --git a/libgcc/config/riscv/riscv-asm.h b/libgcc/config/riscv/riscv-asm.h +index 8550707a4a..96dd85b0df 100644 +--- a/libgcc/config/riscv/riscv-asm.h ++++ b/libgcc/config/riscv/riscv-asm.h +@@ -33,3 +33,9 @@ X: + #define FUNC_ALIAS(X,Y) \ + .globl X; \ + X = Y ++ ++#define CONCAT1(a, b) CONCAT2(a, b) ++#define CONCAT2(a, b) a ## b ++#define HIDDEN_JUMPTARGET(X) CONCAT1(__hidden_, X) ++#define HIDDEN_DEF(X) FUNC_ALIAS(HIDDEN_JUMPTARGET(X), X); \ ++ .hidden HIDDEN_JUMPTARGET(X) +-- +2.49.0 + diff --git a/packages/gcc/package.desc b/packages/gcc/package.desc index 689c5395..35ff82d8 100644 --- a/packages/gcc/package.desc +++ b/packages/gcc/package.desc @@ -2,5 +2,5 @@ repository='git git://gcc.gnu.org/git/gcc.git' mirrors='$(CT_Mirrors GNU gcc/gcc-${CT_GCC_VERSION}) $(CT_Mirrors sourceware gcc/releases/gcc-${CT_GCC_VERSION})' relevantpattern='4.*|. *|.' origin='GNU' -milestones='4.9 5 6 7 8 9 10 11 12 13 14' +milestones='4.9 5 6 7 8 9 10 11 12 13 14 15' archive_formats='.tar.xz .tar.gz' |