pkgsrc-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: pkgsrc/lang/gcc10



Module Name:    pkgsrc
Committed By:   js
Date:           Mon Apr  1 14:33:58 UTC 2024

Modified Files:
        pkgsrc/lang/gcc10: Makefile Makefile.common distinfo
        pkgsrc/lang/gcc10/patches: patch-gcc_Makefile.in patch-gcc_config.gcc
            patch-gcc_plugin.c patch-libgcc_config.host patch-libgcc_crtstuff.c
            patch-libquadmath_printf_quadmath-printf.c
            patch-libquadmath_strtod_strtod__l.c
Added Files:
        pkgsrc/lang/gcc10/patches: patch-gcc_opts-common.c
            patch-gcc_opts-jobserver.h patch-gmp_gen-sieve.c
            patch-gmp_mpn_generic_compute_powtab.c patch-gmp_mpz_millerrabin.c
            patch-gmp_mpz_nextprime.c patch-gmp_mpz_primorial_ui.c
            patch-gmp_primesieve.c patch-include_plugin-api.h
            patch-libgfortran_intrinsics_execute_command_line.c
            patch-libgfortran_intrinsics_string_intrinsics_inc.c
            patch-libiberty_pex-unix.c patch-libobjc_objc_runtime.h
            patch-libquadmath_printf_printf_fphex.c
            patch-libstdc++-v3_include_bits_std_abs.h
            patch-libstdc++-v3_include_bits_stl_function.h
            patch-libstdc++-v3_include_c_global_cmath
            patch-libstdc++-v3_include_c_global_cstring
            patch-libstdc++-v3_include_c_global_cwchar
            patch-libstdc++-v3_libsupc++_cxxabi.h
            patch-libstdc++-v3_libsupc++_cxxabi_init_exception.h
            patch-libstdc++-v3_src_c++11_system_error.cc

Log Message:
Port lang/gcc10 to QNX

With this, there is finally a somewhat modern compiler for QNX.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 pkgsrc/lang/gcc10/Makefile
cvs rdiff -u -r1.7 -r1.8 pkgsrc/lang/gcc10/Makefile.common
cvs rdiff -u -r1.16 -r1.17 pkgsrc/lang/gcc10/distinfo
cvs rdiff -u -r1.1 -r1.2 pkgsrc/lang/gcc10/patches/patch-gcc_Makefile.in \
    pkgsrc/lang/gcc10/patches/patch-gcc_plugin.c \
    pkgsrc/lang/gcc10/patches/patch-libgcc_crtstuff.c \
    pkgsrc/lang/gcc10/patches/patch-libquadmath_printf_quadmath-printf.c \
    pkgsrc/lang/gcc10/patches/patch-libquadmath_strtod_strtod__l.c
cvs rdiff -u -r1.4 -r1.5 pkgsrc/lang/gcc10/patches/patch-gcc_config.gcc
cvs rdiff -u -r0 -r1.1 pkgsrc/lang/gcc10/patches/patch-gcc_opts-common.c \
    pkgsrc/lang/gcc10/patches/patch-gcc_opts-jobserver.h \
    pkgsrc/lang/gcc10/patches/patch-gmp_gen-sieve.c \
    pkgsrc/lang/gcc10/patches/patch-gmp_mpn_generic_compute_powtab.c \
    pkgsrc/lang/gcc10/patches/patch-gmp_mpz_millerrabin.c \
    pkgsrc/lang/gcc10/patches/patch-gmp_mpz_nextprime.c \
    pkgsrc/lang/gcc10/patches/patch-gmp_mpz_primorial_ui.c \
    pkgsrc/lang/gcc10/patches/patch-gmp_primesieve.c \
    pkgsrc/lang/gcc10/patches/patch-include_plugin-api.h \
    pkgsrc/lang/gcc10/patches/patch-libgfortran_intrinsics_execute_command_line.c \
    pkgsrc/lang/gcc10/patches/patch-libgfortran_intrinsics_string_intrinsics_inc.c \
    pkgsrc/lang/gcc10/patches/patch-libiberty_pex-unix.c \
    pkgsrc/lang/gcc10/patches/patch-libobjc_objc_runtime.h \
    pkgsrc/lang/gcc10/patches/patch-libquadmath_printf_printf_fphex.c \
    pkgsrc/lang/gcc10/patches/patch-libstdc++-v3_include_bits_std_abs.h \
    pkgsrc/lang/gcc10/patches/patch-libstdc++-v3_include_bits_stl_function.h \
    pkgsrc/lang/gcc10/patches/patch-libstdc++-v3_include_c_global_cmath \
    pkgsrc/lang/gcc10/patches/patch-libstdc++-v3_include_c_global_cstring \
    pkgsrc/lang/gcc10/patches/patch-libstdc++-v3_include_c_global_cwchar \
    pkgsrc/lang/gcc10/patches/patch-libstdc++-v3_libsupc++_cxxabi.h \
    pkgsrc/lang/gcc10/patches/patch-libstdc++-v3_libsupc++_cxxabi_init_exception.h \
    pkgsrc/lang/gcc10/patches/patch-libstdc++-v3_src_c++11_system_error.cc
cvs rdiff -u -r1.2 -r1.3 pkgsrc/lang/gcc10/patches/patch-libgcc_config.host

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/lang/gcc10/Makefile
diff -u pkgsrc/lang/gcc10/Makefile:1.22 pkgsrc/lang/gcc10/Makefile:1.23
--- pkgsrc/lang/gcc10/Makefile:1.22     Sat Jun  3 13:22:04 2023
+++ pkgsrc/lang/gcc10/Makefile  Mon Apr  1 14:33:57 2024
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.22 2023/06/03 13:22:04 riastradh Exp $
+# $NetBSD: Makefile,v 1.23 2024/04/01 14:33:57 js Exp $
 
 PKGNAME=       ${GCC_PKGNAME}-${GCC10_DIST_VERSION}
 ## When bumping the PKGREVISION of this package the PKGREVISION of
@@ -28,7 +28,8 @@ BUILDLINK_TRANSFORM+= rm:-stdlib=libc++
 
 # Disable fixincludes on SmartOS, header changes result in broken includes
 # being generated, see https://github.com/joyent/pkgsrc-legacy/issues/270
-.if ${OS_VARIANT} == "SmartOS"
+# Same on QNX.
+.if ${OS_VARIANT} == "SmartOS" || ${OPSYS} == "QNX"
 SUBST_CLASSES+=                fixinc
 SUBST_STAGE.fixinc=    pre-configure
 SUBST_FILES.fixinc=    gcc/Makefile.in
@@ -48,6 +49,11 @@ SUBST_SED.libstdc=   -e 's,libtool_VERSION
 CONFIGURE_ARGS+=       --enable-libssp
 .endif
 
+CONFIGURE_ENV.QNX+=    ACCEPT_INFERIOR_RM_PROGRAM=yes
+# Make invokes further configure scripts
+MAKE_ENV.QNX+=         ACCEPT_INFERIOR_RM_PROGRAM=yes
+MAKE_ENV.QNX+=         GENAUTOMATA_LDFLAGS="-Wl,--stack,10000000"
+
 ## For target librarys and libjava programs.
 CONFIGURE_ENV+=                LDFLAGS_FOR_TARGET=${LDFLAGS_FOR_TARGET:Q}
 

Index: pkgsrc/lang/gcc10/Makefile.common
diff -u pkgsrc/lang/gcc10/Makefile.common:1.7 pkgsrc/lang/gcc10/Makefile.common:1.8
--- pkgsrc/lang/gcc10/Makefile.common:1.7       Tue Aug 29 09:48:46 2023
+++ pkgsrc/lang/gcc10/Makefile.common   Mon Apr  1 14:33:57 2024
@@ -1,10 +1,11 @@
-# $NetBSD: Makefile.common,v 1.7 2023/08/29 09:48:46 nia Exp $
+# $NetBSD: Makefile.common,v 1.8 2024/04/01 14:33:57 js Exp $
 # used by lang/gcc10-libjit/Makefile
 
 GCC_PKGNAME=           gcc10
 .include               "version.mk"
 
 DISTNAME=      gcc-${GCC10_DIST_VERSION}
+PKGREVISION=   1
 CATEGORIES=    lang
 MASTER_SITES=  ${MASTER_SITE_GNU:=gcc/gcc-${GCC10_DIST_VERSION}/}
 EXTRACT_SUFX=  .tar.xz
@@ -82,7 +83,7 @@ MAKE_ENV.NetBSD+=     ac_cv_func_newlocale=n
 MAKE_ENV.NetBSD+=      ac_cv_func_uselocale=no
 MAKE_ENV.SunOS+=       ac_cv_func_mkostemp=no
 
-.if !empty(PKGSRC_COMPILER:Mclang) || ${OPSYS} == "DragonFly"
+.if !empty(PKGSRC_COMPILER:Mclang) || ${OPSYS} == "DragonFly" || ${OPSYS} == "QNX"
 CONFIGURE_ARGS+=       --disable-bootstrap
 .endif
 

Index: pkgsrc/lang/gcc10/distinfo
diff -u pkgsrc/lang/gcc10/distinfo:1.16 pkgsrc/lang/gcc10/distinfo:1.17
--- pkgsrc/lang/gcc10/distinfo:1.16     Tue Sep  5 16:54:19 2023
+++ pkgsrc/lang/gcc10/distinfo  Mon Apr  1 14:33:57 2024
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.16 2023/09/05 16:54:19 vins Exp $
+$NetBSD: distinfo,v 1.17 2024/04/01 14:33:57 js Exp $
 
 BLAKE2s (gcc-10.5.0.tar.xz) = af4a8b262d9d4e534e8e1c311897e68e7d64f147ad1eed42e77f9674da188bf3
 SHA512 (gcc-10.5.0.tar.xz) = d86dbc18b978771531f4039465e7eb7c19845bf607dc513c97abf8e45ffe1086a99d98f83dfb7b37204af22431574186de9d5ff80c8c3c3a98dbe3983195bffd
@@ -8,8 +8,8 @@ SHA512 (isl-0.16.1.tar.bz2) = c188667a84
 Size (isl-0.16.1.tar.bz2) = 1626446 bytes
 SHA1 (patch-contrib_download__prerequisites) = 9cdcde21ab174052911447d20762ddfd40aa8791
 SHA1 (patch-fixincludes_inclhack.def) = 7b00974d3f52a8364190a607f52a5d7e8a6db41a
-SHA1 (patch-gcc_Makefile.in) = c0f97c75ba1d37eae894141edd58bb36b734f651
-SHA1 (patch-gcc_config.gcc) = 8729fc44778fb94856cd3861a440cfdf9c962214
+SHA1 (patch-gcc_Makefile.in) = a47571d8340702d1a86d0dfb7df654280c6a6ee6
+SHA1 (patch-gcc_config.gcc) = 4767d5b16794f4485879ed10e172cb2f86bc0777
 SHA1 (patch-gcc_config.host) = 8920ce841f6088b365c9b590e3ea9535bd880b40
 SHA1 (patch-gcc_config_aarch64_aarch64-builtins.c) = 87185f5c2e2dbe4195cb19fe6213d2d616d5519b
 SHA1 (patch-gcc_config_aarch64_aarch64-netbsd.h) = abf19e2445bce1773162bddef16cd7f41eb36827
@@ -23,18 +23,40 @@ SHA1 (patch-gcc_config_sparc_sparc.c) = 
 SHA1 (patch-gcc_configure) = 6a2d8eeeed2bf08c3c81291178e669dc91c913ce
 SHA1 (patch-gcc_ggc-common.c) = 3e325767922ab7d2079fdb9a3d6b6aa531a2fea5
 SHA1 (patch-gcc_lto_lto.c) = 7bd85ac8ade76a28c394f6fbe5d495f91824f79f
-SHA1 (patch-gcc_plugin.c) = 7a7ebc6650fe327fa7be1f7a4d26e8edc7597fcf
+SHA1 (patch-gcc_opts-common.c) = 8cfb8e50a8690b1094449f4eb2d278ddeeb4b633
+SHA1 (patch-gcc_opts-jobserver.h) = 7206af8d26fa773ce1df9234ee5cdd4afcc80918
+SHA1 (patch-gcc_plugin.c) = fe897fa051c5a1e69af423c354a07baa7332043e
 SHA1 (patch-gcc_targhooks.c) = b28d8a9696d07bbfb00b7d8c55193ba99447ff1d
+SHA1 (patch-gmp_gen-sieve.c) = 7e95627a7f46e9db965de5620999c7bdc6ef6606
+SHA1 (patch-gmp_mpn_generic_compute_powtab.c) = 2301acc51d23bb5558360f133c037a39dec2bd7f
+SHA1 (patch-gmp_mpz_millerrabin.c) = dc92fc81042028ffa1722a85cf42f225bee32cd5
+SHA1 (patch-gmp_mpz_nextprime.c) = 12d7ba775972bf8ef1501131dbbb4bffeb4b0214
+SHA1 (patch-gmp_mpz_primorial_ui.c) = 973d4faadb27bb353bf68f28fd76a5bf0d6315fb
+SHA1 (patch-gmp_primesieve.c) = 3477e4de710bc1eb4297d53e54dc7173cf961217
+SHA1 (patch-include_plugin-api.h) = f39ef61b50b08daf85872ce2764877f5bc32779d
 SHA1 (patch-isl_configure) = 5523c76d95b229b3cd25461b4c2b7af24bf2534e
 SHA1 (patch-libffi_configure) = 22006b20d7f655e2455a7ad613d676703b6c1ccc
 SHA1 (patch-libffi_testsuite_libffi.call_float2.c) = 27b84a11378fb648dfaad0c70abedd77a0a1c1a8
-SHA1 (patch-libgcc_config.host) = d40d4d08c807eeff98cc246d1ea756b5b2c749b0
-SHA1 (patch-libgcc_crtstuff.c) = a16d465039de00c195cf0694560140a9c38f3a25
+SHA1 (patch-libgcc_config.host) = 1dda38390749c8727281099d86d763e1896a54b1
+SHA1 (patch-libgcc_crtstuff.c) = 38d03a3b417aa3116986641f0f7b595166206623
+SHA1 (patch-libgfortran_intrinsics_execute_command_line.c) = 05b554ffce113efa6b92cae1dfeda6dfefeed92c
+SHA1 (patch-libgfortran_intrinsics_string_intrinsics_inc.c) = 2c027c7bd318342c0498d46f9712a55a86ab76c7
 SHA1 (patch-libgfortran_io_format.c) = 9bbc5e4f6277bdec785b3690fd08259939a2aa1a
 SHA1 (patch-libgfortran_io_io.h) = d44676239a7f45e42054d24bd5224f43c20055c0
 SHA1 (patch-libgfortran_io_list__read.c) = 589cdb8dcd180b781ededc086e8775224fca5779
 SHA1 (patch-libgfortran_io_read.c) = cf21493396d07a5e8ad0dfb70a8d25a11482fc98
 SHA1 (patch-libgfortran_runtime_environ.c) = c7217704a00f4c0314bbc1838ac6fc966cc854d0
-SHA1 (patch-libquadmath_printf_quadmath-printf.c) = 78e09f1e6d61ee57cee83275093cf46b2335d204
-SHA1 (patch-libquadmath_strtod_strtod__l.c) = 6142c10d34174174cce7f06c37eab04dc431b2dc
+SHA1 (patch-libiberty_pex-unix.c) = 52896635b2578e8338a82ad3a3e9fd4d911c8489
+SHA1 (patch-libobjc_objc_runtime.h) = 420137482a6e3fa1f9dc4196e60dfde47a80f68a
+SHA1 (patch-libquadmath_printf_printf_fphex.c) = 4e3927bb2ba9013e1ef69e38d0481c930b77a2fc
+SHA1 (patch-libquadmath_printf_quadmath-printf.c) = 9c862bd2e07f8724646896a9f93bb8bb15bb4185
+SHA1 (patch-libquadmath_strtod_strtod__l.c) = 1a3a419218fb260c1c4a0ed08f5a72bde683d039
+SHA1 (patch-libstdc++-v3_include_bits_std_abs.h) = 2a32b52dc2d958085525461bd6da0a7b299ee09d
+SHA1 (patch-libstdc++-v3_include_bits_stl_function.h) = 2757a988fb0a19825abb9963dc236effa9e3ea80
+SHA1 (patch-libstdc++-v3_include_c_global_cmath) = 24ec0941fcad205ce090b969a90ce5e85e235775
+SHA1 (patch-libstdc++-v3_include_c_global_cstring) = 0a87e7939448957bb352d8a50d5d3cb07f2f9a5d
+SHA1 (patch-libstdc++-v3_include_c_global_cwchar) = 9408c1876183fa3f9d4440acdc96217c8a47ed87
+SHA1 (patch-libstdc++-v3_libsupc++_cxxabi.h) = 3bf8c2c8528f9374d157fa47e8ad0d13fc16b8a4
+SHA1 (patch-libstdc++-v3_libsupc++_cxxabi_init_exception.h) = 260c4af26e88e0015f54b04910cf91dd2ee8cb5f
 SHA1 (patch-libstdc++-v3_libsupc++_new__opa.cc) = 4183b00a5ee6e61524da4755c825a0c08fd01ed6
+SHA1 (patch-libstdc++-v3_src_c++11_system_error.cc) = 2c4b5326f4a4f518b202055aa3fbcc76c27f51dd

Index: pkgsrc/lang/gcc10/patches/patch-gcc_Makefile.in
diff -u pkgsrc/lang/gcc10/patches/patch-gcc_Makefile.in:1.1 pkgsrc/lang/gcc10/patches/patch-gcc_Makefile.in:1.2
--- pkgsrc/lang/gcc10/patches/patch-gcc_Makefile.in:1.1 Sun May 10 15:02:44 2020
+++ pkgsrc/lang/gcc10/patches/patch-gcc_Makefile.in     Mon Apr  1 14:33:57 2024
@@ -1,11 +1,13 @@
-$NetBSD: patch-gcc_Makefile.in,v 1.1 2020/05/10 15:02:44 maya Exp $
+$NetBSD: patch-gcc_Makefile.in,v 1.2 2024/04/01 14:33:57 js Exp $
 
-Add gcc libdir to a programs rpath so that _this gcc's_ support libraries
+Add gcc libdir to programs' rpath so that _this gcc's_ support libraries
 are found.
 
---- gcc/Makefile.in.orig       2017-04-18 18:10:27.000000000 +0000
+Add a hack to increase the stack for genautomata on QNX.
+
+--- gcc/Makefile.in.orig       2023-07-07 07:08:18.000000000 +0000
 +++ gcc/Makefile.in
-@@ -2112,6 +2112,7 @@ prefix.o: $(BASEVER)
+@@ -2206,6 +2206,7 @@ default-d.o: config/default-d.c
  # Language-independent files.
  
  DRIVER_DEFINES = \
@@ -13,3 +15,12 @@ are found.
    -DSTANDARD_STARTFILE_PREFIX=\"$(unlibsubdir)/\" \
    -DSTANDARD_EXEC_PREFIX=\"$(libdir)/gcc/\" \
    -DSTANDARD_LIBEXEC_PREFIX=\"$(libexecdir)/gcc/\" \
+@@ -2860,7 +2861,7 @@ $(genprogerr:%=build/gen%$(build_exeext)
+ genprog = $(genprogerr) check checksum match
+ 
+ # These programs need libs over and above what they get from the above list.
+-build/genautomata$(build_exeext) : BUILD_LIBS += -lm
++build/genautomata$(build_exeext) : BUILD_LIBS += -lm $(GENAUTOMATA_LDFLAGS)
+ 
+ build/genrecog$(build_exeext) : build/hash-table.o build/inchash.o
+ build/gencfn-macros$(build_exeext) : build/hash-table.o build/vec.o \
Index: pkgsrc/lang/gcc10/patches/patch-gcc_plugin.c
diff -u pkgsrc/lang/gcc10/patches/patch-gcc_plugin.c:1.1 pkgsrc/lang/gcc10/patches/patch-gcc_plugin.c:1.2
--- pkgsrc/lang/gcc10/patches/patch-gcc_plugin.c:1.1    Tue Sep  5 16:54:19 2023
+++ pkgsrc/lang/gcc10/patches/patch-gcc_plugin.c        Mon Apr  1 14:33:57 2024
@@ -1,15 +1,18 @@
-$NetBSD: patch-gcc_plugin.c,v 1.1 2023/09/05 16:54:19 vins Exp $
+$NetBSD: patch-gcc_plugin.c,v 1.2 2024/04/01 14:33:57 js Exp $
 
 Support dynamic link interface functions.
 
---- gcc/plugin.c.orig  2022-05-27 07:21:11.335381405 +0000
+Needs to come after the other includes as those add some defines that change
+behavior (breaks QNX otherwise).
+
+--- gcc/plugin.c.orig  2023-07-07 07:08:19.000000000 +0000
 +++ gcc/plugin.c
-@@ -20,6 +20,8 @@ along with GCC; see the file COPYING3.
- /* This file contains the support for GCC plugin mechanism based on the
-    APIs described in doc/plugin.texi.  */
+@@ -30,6 +30,8 @@ along with GCC; see the file COPYING3.  
+ #include "intl.h"
+ #include "plugin.h"
  
 +#include <dlfcn.h>
 +
- #include "config.h"
- #include "system.h"
- #include "coretypes.h"
+ #ifdef ENABLE_PLUGIN
+ #include "plugin-version.h"
+ #endif
Index: pkgsrc/lang/gcc10/patches/patch-libgcc_crtstuff.c
diff -u pkgsrc/lang/gcc10/patches/patch-libgcc_crtstuff.c:1.1 pkgsrc/lang/gcc10/patches/patch-libgcc_crtstuff.c:1.2
--- pkgsrc/lang/gcc10/patches/patch-libgcc_crtstuff.c:1.1       Sun May 10 15:02:44 2020
+++ pkgsrc/lang/gcc10/patches/patch-libgcc_crtstuff.c   Mon Apr  1 14:33:57 2024
@@ -1,8 +1,10 @@
-$NetBSD: patch-libgcc_crtstuff.c,v 1.1 2020/05/10 15:02:44 maya Exp $
+$NetBSD: patch-libgcc_crtstuff.c,v 1.2 2024/04/01 14:33:57 js Exp $
 
 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90147
 
---- libgcc/crtstuff.c.orig     2017-01-01 12:07:43.000000000 +0000
+Disable TM clone registry on QNX, as the linker does not support it.
+
+--- libgcc/crtstuff.c.orig     2023-07-07 07:08:21.000000000 +0000
 +++ libgcc/crtstuff.c
 @@ -81,7 +81,7 @@ call_ ## FUNC (void)                                 \
  #endif
@@ -13,3 +15,13 @@ https://gcc.gnu.org/bugzilla/show_bug.cg
  #define BSD_DL_ITERATE_PHDR_AVAILABLE
  #endif
   
+@@ -151,7 +151,8 @@ call_ ## FUNC (void)                                       \
+ # define HIDDEN_DTOR_LIST_END
+ #endif
+ 
+-#if !defined(USE_TM_CLONE_REGISTRY) && defined(OBJECT_FORMAT_ELF)
++#if !defined(USE_TM_CLONE_REGISTRY) && defined(OBJECT_FORMAT_ELF) \
++    && !defined(__QNX__)
+ # define USE_TM_CLONE_REGISTRY 1
+ #elif !defined(USE_TM_CLONE_REGISTRY)
+ # define USE_TM_CLONE_REGISTRY 0
Index: pkgsrc/lang/gcc10/patches/patch-libquadmath_printf_quadmath-printf.c
diff -u pkgsrc/lang/gcc10/patches/patch-libquadmath_printf_quadmath-printf.c:1.1 pkgsrc/lang/gcc10/patches/patch-libquadmath_printf_quadmath-printf.c:1.2
--- pkgsrc/lang/gcc10/patches/patch-libquadmath_printf_quadmath-printf.c:1.1    Sun May 17 19:47:20 2020
+++ pkgsrc/lang/gcc10/patches/patch-libquadmath_printf_quadmath-printf.c        Mon Apr  1 14:33:58 2024
@@ -1,12 +1,20 @@
-$NetBSD: patch-libquadmath_printf_quadmath-printf.c,v 1.1 2020/05/17 19:47:20 rillig Exp $
+$NetBSD: patch-libquadmath_printf_quadmath-printf.c,v 1.2 2024/04/01 14:33:58 js Exp $
 
 Fix -Werror=char-subscripts.
 
 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95178
 
---- libquadmath/printf/quadmath-printf.c.orig  2020-05-07 10:50:02.000000000 +0000
+--- libquadmath/printf/quadmath-printf.c.orig  2023-07-07 07:08:21.000000000 +0000
 +++ libquadmath/printf/quadmath-printf.c
-@@ -189,7 +189,7 @@ quadmath_snprintf (char *str, size_t siz
+@@ -22,6 +22,7 @@ Boston, MA 02110-1301, USA.  */
+ #include <stdarg.h>
+ #include <string.h>
+ #include <stdio.h>
++#include <unistd.h>
+ #include "quadmath-printf.h"
+ 
+ /* Read a simple integer from a string and update the string pointer.
+@@ -189,7 +190,7 @@ quadmath_snprintf (char *str, size_t siz
        ++format;
        info.width = va_arg (ap, int);
      }
@@ -15,7 +23,7 @@ https://gcc.gnu.org/bugzilla/show_bug.cg
      /* Constant width specification.  */
      info.width = read_int (&format);
  
-@@ -206,7 +206,7 @@ quadmath_snprintf (char *str, size_t siz
+@@ -206,7 +207,7 @@ quadmath_snprintf (char *str, size_t siz
  
          info.prec = va_arg (ap, int);
        }
Index: pkgsrc/lang/gcc10/patches/patch-libquadmath_strtod_strtod__l.c
diff -u pkgsrc/lang/gcc10/patches/patch-libquadmath_strtod_strtod__l.c:1.1 pkgsrc/lang/gcc10/patches/patch-libquadmath_strtod_strtod__l.c:1.2
--- pkgsrc/lang/gcc10/patches/patch-libquadmath_strtod_strtod__l.c:1.1  Sun May 17 19:47:20 2020
+++ pkgsrc/lang/gcc10/patches/patch-libquadmath_strtod_strtod__l.c      Mon Apr  1 14:33:58 2024
@@ -1,10 +1,12 @@
-$NetBSD: patch-libquadmath_strtod_strtod__l.c,v 1.1 2020/05/17 19:47:20 rillig Exp $
+$NetBSD: patch-libquadmath_strtod_strtod__l.c,v 1.2 2024/04/01 14:33:58 js Exp $
 
 Fix -Werror=char-subscripts.
 
 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95178
 
---- libquadmath/strtod/strtod_l.c.orig 2020-05-07 10:50:02.000000000 +0000
+Fix _MAX and _MIN being defined on QNX and breaking the concatenation.
+
+--- libquadmath/strtod/strtod_l.c.orig 2023-07-07 07:08:21.000000000 +0000
 +++ libquadmath/strtod/strtod_l.c
 @@ -57,10 +57,10 @@
  # define STRING_TYPE char
@@ -21,3 +23,17 @@ https://gcc.gnu.org/bugzilla/show_bug.cg
  # define TOLOWER_C(Ch) \
    ({__typeof(Ch) __tlc = (Ch); \
      (__tlc >= 'A' && __tlc <= 'Z') ? __tlc - 'A' + 'a' : __tlc; })
+@@ -89,6 +89,13 @@ __quadmath_strncasecmp_c (const char *s1
+ #endif
+ 
+ 
++#ifdef _MAX
++#undef _MAX
++#endif
++#ifdef _MIN
++#undef _MIN
++#endif
++
+ /* Constants we need from float.h; select the set for the FLOAT precision.  */
+ #define MANT_DIG      PASTE(FLT,_MANT_DIG)
+ #define       DIG             PASTE(FLT,_DIG)

Index: pkgsrc/lang/gcc10/patches/patch-gcc_config.gcc
diff -u pkgsrc/lang/gcc10/patches/patch-gcc_config.gcc:1.4 pkgsrc/lang/gcc10/patches/patch-gcc_config.gcc:1.5
--- pkgsrc/lang/gcc10/patches/patch-gcc_config.gcc:1.4  Sun Jul  3 15:59:17 2022
+++ pkgsrc/lang/gcc10/patches/patch-gcc_config.gcc      Mon Apr  1 14:33:57 2024
@@ -1,13 +1,15 @@
-$NetBSD: patch-gcc_config.gcc,v 1.4 2022/07/03 15:59:17 wiz Exp $
+$NetBSD: patch-gcc_config.gcc,v 1.5 2024/04/01 14:33:57 js Exp $
 
 Match what is in NetBSD src. Fixes at least aarch64eb, and
 probably several others.
 
 Allow builds on Darwin 21.
 
---- gcc/config.gcc.orig        2021-04-08 04:56:28.033740243 -0700
-+++ gcc/config.gcc     2022-02-02 10:27:44.252878051 -0800
-@@ -462,6 +462,16 @@
+Fix build on QNX.
+
+--- gcc/config.gcc.orig        2023-07-07 07:08:19.000000000 +0000
++++ gcc/config.gcc
+@@ -462,6 +462,16 @@ m32r*-*-*)
          cpu_type=m32r
        extra_options="${extra_options} g.opt"
          ;;
@@ -24,7 +26,7 @@ Allow builds on Darwin 21.
  m68k-*-*)
        extra_headers=math-68881.h
        extra_options="${extra_options} m68k/m68k-tables.opt"
-@@ -877,6 +887,11 @@
+@@ -891,6 +901,11 @@ case ${target} in
    case ${enable_threads} in
      "" | yes | posix) thread_file='posix' ;;
    esac
@@ -36,7 +38,7 @@ Allow builds on Darwin 21.
    nbsd_tm_file="netbsd.h netbsd-stdint.h netbsd-elf.h"
    default_use_cxa_atexit=yes
    target_has_targetdm=yes
-@@ -1111,6 +1126,11 @@
+@@ -1125,6 +1140,11 @@ aarch64*-*-netbsd*)
        tm_file="${tm_file} aarch64/aarch64-elf.h aarch64/aarch64-errata.h aarch64/aarch64-netbsd.h"
        tmake_file="${tmake_file} aarch64/t-aarch64 aarch64/t-aarch64-netbsd"
        extra_options="${extra_options} netbsd.opt netbsd-elf.opt"
@@ -48,7 +50,7 @@ Allow builds on Darwin 21.
        ;;
  aarch64*-*-linux*)
        tm_file="${tm_file} dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h"
-@@ -1252,7 +1272,6 @@
+@@ -1266,7 +1286,6 @@ arm*-*-freebsd*)                # ARM Fr
        with_tls=${with_tls:-gnu}
        ;;
  arm*-*-netbsdelf*)
@@ -56,7 +58,7 @@ Allow builds on Darwin 21.
        tmake_file="${tmake_file} arm/t-arm"
        tm_file="dbxelf.h elfos.h ${nbsd_tm_file} arm/elf.h"
        extra_options="${extra_options} netbsd.opt netbsd-elf.opt"
-@@ -1261,26 +1280,34 @@
+@@ -1275,26 +1294,34 @@ arm*-*-netbsdelf*)
        esac
        case ${target} in
        arm*-*-netbsdelf-*eabi*)
@@ -98,7 +100,7 @@ Allow builds on Darwin 21.
        ;;
  arm*-*-linux-* | arm*-*-uclinuxfdpiceabi)
        tm_file="dbxelf.h elfos.h gnu-user.h linux.h linux-android.h glibc-stdint.h arm/elf.h arm/linux-gas.h arm/linux-elf.h"
-@@ -1928,6 +1955,7 @@
+@@ -1942,6 +1969,7 @@ i[34567]86-*-netbsdelf*)
        ;;
  x86_64-*-netbsd*)
        tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h ${nbsd_tm_file} i386/x86-64.h i386/netbsd64.h"
@@ -106,7 +108,16 @@ Allow builds on Darwin 21.
        extra_options="${extra_options} netbsd.opt netbsd-elf.opt"
        ;;
  i[34567]86-*-openbsd*)
-@@ -2250,6 +2278,16 @@
+@@ -2072,7 +2100,7 @@ i[34567]86-*-lynxos*)
+       gnu_ld=yes
+       gas=yes
+       ;;
+-i[34567]86-*-nto-qnx*)
++i[34567]86-*-qnx*)
+       tm_file="${tm_file} i386/att.h dbxelf.h tm-dwarf2.h elfos.h i386/unix.h i386/nto.h"
+       extra_options="${extra_options} i386/nto.opt"
+       gnu_ld=yes
+@@ -2264,6 +2292,16 @@ ia64*-*-elf*)
                target_cpu_default="${target_cpu_default}|MASK_GNU_LD"
        fi
        ;;
@@ -123,7 +134,7 @@ Allow builds on Darwin 21.
  ia64*-*-freebsd*)
        tm_file="${tm_file} dbxelf.h elfos.h ${fbsd_tm_file} ia64/sysv4.h ia64/freebsd.h"
        target_cpu_default="MASK_GNU_AS|MASK_GNU_LD"
-@@ -2362,8 +2400,25 @@
+@@ -2376,8 +2414,25 @@ m68k-*-elf* | fido-*-elf*)
                ;;
        esac
        ;;
@@ -150,7 +161,7 @@ Allow builds on Darwin 21.
        default_cf_cpu=5475
        tm_file="${tm_file} dbxelf.h elfos.h ${nbsd_tm_file} m68k/netbsd-elf.h"
        extra_options="${extra_options} netbsd.opt netbsd-elf.opt"
-@@ -2503,6 +2558,26 @@
+@@ -2517,6 +2572,26 @@ riscv*-*-freebsd*)
        # automatically detect that GAS supports it, yet we require it.
        gcc_cv_initfini_array=yes
        ;;
@@ -177,7 +188,7 @@ Allow builds on Darwin 21.
  mips*-*-netbsd*)                      # NetBSD/mips, either endian.
        target_cpu_default="MASK_ABICALLS"
        tm_file="elfos.h ${tm_file} mips/elf.h ${nbsd_tm_file} mips/netbsd.h"
-@@ -2918,11 +2993,24 @@
+@@ -2932,11 +3007,24 @@ powerpc*-*-freebsd*)
                ;;
        esac
        ;;
@@ -206,7 +217,7 @@ Allow builds on Darwin 21.
        ;;
  powerpc-*-eabisimaltivec*)
        tm_file="${tm_file} dbxelf.h elfos.h gnu-user.h freebsd-spec.h newlib-stdint.h rs6000/sysv4.h rs6000/eabi.h rs6000/eabisim.h rs6000/eabialtivec.h"
-@@ -3394,9 +3482,11 @@
+@@ -3408,9 +3496,11 @@ sparc64-*-freebsd*|ultrasparc-*-freebsd*
  sparc64-*-netbsd*)
        tm_file="sparc/biarch64.h ${tm_file}"
        tm_file="${tm_file} dbxelf.h elfos.h sparc/sysv4.h ${nbsd_tm_file} sparc/netbsd-elf.h"
@@ -218,7 +229,7 @@ Allow builds on Darwin 21.
        ;;
  sparc64-*-openbsd*)
        tm_file="sparc/openbsd1-64.h ${tm_file} dbxelf.h elfos.h sparc/sysv4.h sparc/sp64-elf.h"
-@@ -3911,6 +4001,9 @@
+@@ -3925,6 +4015,9 @@ if test x$with_cpu = x ; then
      frv550-*-*linux*)
        with_cpu=fr550
        ;;
@@ -228,7 +239,7 @@ Allow builds on Darwin 21.
      m68k*-*-*)
        case "$with_arch" in
        "cf")
-@@ -4421,7 +4514,7 @@
+@@ -4435,7 +4528,7 @@ case "${target}" in
                esac
                ;;
  

Index: pkgsrc/lang/gcc10/patches/patch-libgcc_config.host
diff -u pkgsrc/lang/gcc10/patches/patch-libgcc_config.host:1.2 pkgsrc/lang/gcc10/patches/patch-libgcc_config.host:1.3
--- pkgsrc/lang/gcc10/patches/patch-libgcc_config.host:1.2      Wed Feb  2 22:07:28 2022
+++ pkgsrc/lang/gcc10/patches/patch-libgcc_config.host  Mon Apr  1 14:33:57 2024
@@ -1,11 +1,13 @@
-$NetBSD: patch-libgcc_config.host,v 1.2 2022/02/02 22:07:28 mrg Exp $
+$NetBSD: patch-libgcc_config.host,v 1.3 2024/04/01 14:33:57 js Exp $
 
 This is needed for arm64 to get Out-of-line LSE atomics linked into libgcc.
 libsupc++ fails to link without this, and for arm to build.
 
---- libgcc/config.host.orig    2021-04-08 04:56:29.805761640 -0700
-+++ libgcc/config.host 2022-02-02 04:08:51.653635705 -0800
-@@ -377,6 +377,7 @@
+Fix build on QNX.
+
+--- libgcc/config.host.orig    2023-07-07 07:08:21.000000000 +0000
++++ libgcc/config.host
+@@ -405,6 +405,7 @@ aarch64*-*-freebsd*)
  aarch64*-*-netbsd*)
        extra_parts="$extra_parts crtfastmath.o"
        tmake_file="${tmake_file} ${cpu_type}/t-aarch64"
@@ -13,7 +15,7 @@ libsupc++ fails to link without this, an
        tmake_file="${tmake_file} ${cpu_type}/t-softfp t-softfp t-crtfm"
        md_unwind_header=aarch64/aarch64-unwind.h
        ;;
-@@ -463,7 +464,8 @@
+@@ -491,7 +492,8 @@ arm*-*-netbsdelf*)
        case ${host} in
          arm*-*-netbsdelf-*eabi*)
            tmake_file="${tmake_file} arm/t-netbsd-eabi"
@@ -23,3 +25,12 @@ libsupc++ fails to link without this, an
            ;;
          *)
            tmake_file="${tmake_file} arm/t-netbsd t-slibgcc-gld-nover"
+@@ -797,7 +799,7 @@ i[34567]86-pc-msdosdjgpp*)
+       ;;
+ i[34567]86-*-lynxos*)
+       ;;
+-i[34567]86-*-nto-qnx*)
++i[34567]86-*-qnx*)
+       tmake_file="$tmake_file i386/t-nto t-libgcc-pic"
+       extra_parts=crtbegin.o
+       ;;

Added files:

Index: pkgsrc/lang/gcc10/patches/patch-gcc_opts-common.c
diff -u /dev/null pkgsrc/lang/gcc10/patches/patch-gcc_opts-common.c:1.1
--- /dev/null   Mon Apr  1 14:33:58 2024
+++ pkgsrc/lang/gcc10/patches/patch-gcc_opts-common.c   Mon Apr  1 14:33:57 2024
@@ -0,0 +1,13 @@
+$NetBSD: patch-gcc_opts-common.c,v 1.1 2024/04/01 14:33:57 js Exp $
+
+--- gcc/opts-common.c.orig     2023-07-07 07:08:19.000000000 +0000
++++ gcc/opts-common.c
+@@ -1808,7 +1808,7 @@ void prepend_xassembler_to_collect_as_op
+     }
+ }
+ 
+-jobserver_info::jobserver_info ()
++jobserver_info::jobserver_info () : rfd(-1), wfd(-1), is_active(false)
+ {
+   /* Traditionally, GNU make uses opened pipes for jobserver-auth,
+     e.g. --jobserver-auth=3,4.
Index: pkgsrc/lang/gcc10/patches/patch-gcc_opts-jobserver.h
diff -u /dev/null pkgsrc/lang/gcc10/patches/patch-gcc_opts-jobserver.h:1.1
--- /dev/null   Mon Apr  1 14:33:58 2024
+++ pkgsrc/lang/gcc10/patches/patch-gcc_opts-jobserver.h        Mon Apr  1 14:33:57 2024
@@ -0,0 +1,28 @@
+$NetBSD: patch-gcc_opts-jobserver.h,v 1.1 2024/04/01 14:33:57 js Exp $
+
+--- gcc/opts-jobserver.h.orig  2023-07-07 07:08:19.000000000 +0000
++++ gcc/opts-jobserver.h
+@@ -30,17 +30,17 @@ struct jobserver_info
+   jobserver_info ();
+ 
+   /* Error message if there is a problem.  */
+-  string error_msg = "";
++  string error_msg;
+   /* Skipped MAKEFLAGS where --jobserver-auth is skipped.  */
+-  string skipped_makeflags = "";
++  string skipped_makeflags;
+   /* File descriptor for reading used for jobserver communication.  */
+-  int rfd = -1;
++  int rfd;
+   /* File descriptor for writing used for jobserver communication.  */
+-  int wfd = -1;
++  int wfd;
+   /* Named pipe path.  */
+-  string pipe_path = "";
++  string pipe_path;
+   /* Return true if jobserver is active.  */
+-  bool is_active = false;
++  bool is_active;
+ };
+ 
+ #endif /* GCC_JOBSERVER_H */
Index: pkgsrc/lang/gcc10/patches/patch-gmp_gen-sieve.c
diff -u /dev/null pkgsrc/lang/gcc10/patches/patch-gmp_gen-sieve.c:1.1
--- /dev/null   Mon Apr  1 14:33:58 2024
+++ pkgsrc/lang/gcc10/patches/patch-gmp_gen-sieve.c     Mon Apr  1 14:33:57 2024
@@ -0,0 +1,17 @@
+$NetBSD: patch-gmp_gen-sieve.c,v 1.1 2024/04/01 14:33:57 js Exp $
+
+Fix compiling with GCC 4.4.2 on QNX.
+
+--- gmp/gen-sieve.c.orig       2023-07-29 13:42:16.000000000 +0000
++++ gmp/gen-sieve.c
+@@ -95,8 +95,9 @@ generate (int limb_bits, int limit)
+ void
+ setmask (mpz_t mask, int a, int b)
+ {
++  unsigned i;
+   mpz_set_ui (mask, 0);
+-  for (unsigned i = 0; i < 2 * a * b; ++i)
++  for (i = 0; i < 2 * a * b; ++i)
+     if ((bit_to_n (i) % a == 0) || (bit_to_n (i) % b == 0))
+       mpz_setbit (mask, i);
+ }
Index: pkgsrc/lang/gcc10/patches/patch-gmp_mpn_generic_compute_powtab.c
diff -u /dev/null pkgsrc/lang/gcc10/patches/patch-gmp_mpn_generic_compute_powtab.c:1.1
--- /dev/null   Mon Apr  1 14:33:58 2024
+++ pkgsrc/lang/gcc10/patches/patch-gmp_mpn_generic_compute_powtab.c    Mon Apr  1 14:33:57 2024
@@ -0,0 +1,67 @@
+$NetBSD: patch-gmp_mpn_generic_compute_powtab.c,v 1.1 2024/04/01 14:33:57 js Exp $
+
+Fix compiling with GCC 4.4.2 on QNX.
+
+--- gmp/mpn/generic/compute_powtab.c.orig      2023-07-29 13:42:16.000000000 +0000
++++ gmp/mpn/generic/compute_powtab.c
+@@ -70,6 +70,7 @@ mpn_compute_powtab_mul (powers_t *powtab
+   mp_limb_t cy;
+   long start_idx;
+   int c;
++  long pi;
+ 
+   mp_limb_t big_base = mp_bases[base].big_base;
+   int chars_per_limb = mp_bases[base].chars_per_limb;
+@@ -139,7 +140,7 @@ mpn_compute_powtab_mul (powers_t *powtab
+       start_idx = n_pows - 3;
+     }
+ 
+-  for (long pi = start_idx; pi >= 0; pi--)
++  for (pi = start_idx; pi >= 0; pi--)
+     {
+       t = powtab_mem_ptr;
+       powtab_mem_ptr += 2 * n + 2;
+@@ -223,7 +224,8 @@ mpn_compute_powtab_div (powers_t *powtab
+ 
+   mp_size_t n = 1;
+   mp_size_t shift = 0;
+-  for (long pi = n_pows - 1; pi >= 0; pi--)
++  long pi;
++  for (pi = n_pows - 1; pi >= 0; pi--)
+     {
+       t = powtab_mem_ptr;
+       powtab_mem_ptr += 2 * n;
+@@ -271,7 +273,7 @@ mpn_compute_powtab_div (powers_t *powtab
+ 
+   /* Strip any remaining low zero limbs.  */
+   pt -= n_pows + 1;
+-  for (long pi = n_pows; pi >= 0; pi--)
++  for (pi = n_pows; pi >= 0; pi--)
+     {
+       mp_ptr t = pt[pi].p;
+       mp_size_t shift = pt[pi].shift;
+@@ -293,7 +295,8 @@ powtab_decide (size_t *exptab, size_t un
+ {
+   int chars_per_limb = mp_bases[base].chars_per_limb;
+   long n_pows = 0;
+-  for (size_t pn = (un + 1) >> 1; pn != 1; pn = (pn + 1) >> 1)
++  size_t pn;
++  for (pn = (un + 1) >> 1; pn != 1; pn = (pn + 1) >> 1)
+     {
+       exptab[n_pows] = pn * chars_per_limb;
+       n_pows++;
+@@ -301,11 +304,12 @@ powtab_decide (size_t *exptab, size_t un
+   exptab[n_pows] = chars_per_limb;
+ 
+ #if HAVE_mpn_compute_powtab_mul && HAVE_mpn_compute_powtab_div
+-  size_t pn = un - 1;
++  pn = un - 1;
+   size_t xn = (un + 1) >> 1;
+   unsigned mcost = 1;
+   unsigned dcost = 1;
+-  for (long i = n_pows - 2; i >= 0; i--)
++  long i;
++  for (i = n_pows - 2; i >= 0; i--)
+     {
+       size_t pow = (pn >> (i + 1)) + 1;
+ 
Index: pkgsrc/lang/gcc10/patches/patch-gmp_mpz_millerrabin.c
diff -u /dev/null pkgsrc/lang/gcc10/patches/patch-gmp_mpz_millerrabin.c:1.1
--- /dev/null   Mon Apr  1 14:33:58 2024
+++ pkgsrc/lang/gcc10/patches/patch-gmp_mpz_millerrabin.c       Mon Apr  1 14:33:57 2024
@@ -0,0 +1,16 @@
+$NetBSD: patch-gmp_mpz_millerrabin.c,v 1.1 2024/04/01 14:33:57 js Exp $
+
+Fix compiling with GCC 4.4.2 on QNX.
+
+--- gmp/mpz/millerrabin.c.orig 2023-07-29 13:42:17.000000000 +0000
++++ gmp/mpz/millerrabin.c
+@@ -206,7 +206,8 @@ millerrabin (mpz_srcptr n, mpz_ptr x, mp
+   if (mpz_cmp_ui (y, 1L) == 0 || mod_eq_m1 (y, n))
+     return 1;
+ 
+-  for (mp_bitcnt_t i = 1; i < k; ++i)
++  mp_bitcnt_t i;
++  for (i = 1; i < k; ++i)
+     {
+       mpz_powm_ui (y, y, 2L, n);
+       if (mod_eq_m1 (y, n))
Index: pkgsrc/lang/gcc10/patches/patch-gmp_mpz_nextprime.c
diff -u /dev/null pkgsrc/lang/gcc10/patches/patch-gmp_mpz_nextprime.c:1.1
--- /dev/null   Mon Apr  1 14:33:58 2024
+++ pkgsrc/lang/gcc10/patches/patch-gmp_mpz_nextprime.c Mon Apr  1 14:33:57 2024
@@ -0,0 +1,43 @@
+$NetBSD: patch-gmp_mpz_nextprime.c,v 1.1 2024/04/01 14:33:57 js Exp $
+
+Fix compiling with GCC 4.4.2 on QNX.
+
+--- gmp/mpz/nextprime.c.orig   2023-07-29 13:42:17.000000000 +0000
++++ gmp/mpz/nextprime.c
+@@ -113,7 +113,8 @@ findnext_small (unsigned t, short diff)
+   for (; ; t += diff)
+     {
+       unsigned prime = 3;
+-      for (int i = 0; ; prime += primegap_small[i++])
++      int i;
++      for (i = 0; ; prime += primegap_small[i++])
+       {
+         unsigned q, r;
+         q = t / prime;
+@@ -182,14 +183,18 @@ findnext (mpz_ptr p,
+       i = 0;
+       last_prime = 3;
+       /* THINK: should we get rid of sieve_limit and use (i < prime_limit)? */
+-      for (mp_limb_t j = 4, *sp = sieve; j < sieve_limit; j += GMP_LIMB_BITS * 3)
+-      for (mp_limb_t b = j, x = ~ *(sp++); x != 0; b += 3, x >>= 1)
+-        if (x & 1)
+-          {
+-            mp_limb_t prime = b | 1;
+-            primegap_tmp[i++] = prime - last_prime;
+-            last_prime = prime;
+-          }
++      mp_limb_t j, *sp;
++      for (j = 4, sp = sieve; j < sieve_limit; j += GMP_LIMB_BITS * 3)
++        {
++          mp_limb_t b, x;
++        for (b = j, x = ~ *(sp++); x != 0; b += 3, x >>= 1)
++          if (x & 1)
++            {
++              mp_limb_t prime = b | 1;
++              primegap_tmp[i++] = prime - last_prime;
++              last_prime = prime;
++            }
++        }
+ 
+       /* Both primesieve and prime_limit ignore the first two primes. */
+       ASSERT(i == prime_limit);
Index: pkgsrc/lang/gcc10/patches/patch-gmp_mpz_primorial_ui.c
diff -u /dev/null pkgsrc/lang/gcc10/patches/patch-gmp_mpz_primorial_ui.c:1.1
--- /dev/null   Mon Apr  1 14:33:58 2024
+++ pkgsrc/lang/gcc10/patches/patch-gmp_mpz_primorial_ui.c      Mon Apr  1 14:33:57 2024
@@ -0,0 +1,31 @@
+$NetBSD: patch-gmp_mpz_primorial_ui.c,v 1.1 2024/04/01 14:33:57 js Exp $
+
+Fix compiling with GCC 4.4.2 on QNX.
+
+--- gmp/mpz/primorial_ui.c.orig        2023-07-29 13:42:17.000000000 +0000
++++ gmp/mpz/primorial_ui.c
+@@ -106,13 +106,17 @@ mpz_primorial_ui (mpz_ptr res, unsigned 
+       max_prod = GMP_NUMB_MAX / n;
+ 
+       /* Loop on sieved primes. */
+-      for (mp_limb_t i = 4, *sp = sieve; i < n; i += GMP_LIMB_BITS * 3)
+-        for (mp_limb_t b = i, x = ~ *(sp++); x != 0; b += 3, x >>= 1)
+-          if (x & 1)
+-            {
+-              mp_limb_t prime = b | 1;
+-              FACTOR_LIST_STORE (prime, prod, max_prod, factors, j);
+-            }
++        mp_limb_t i, *sp;
++      for (i = 4, sp = sieve; i < n; i += GMP_LIMB_BITS * 3)
++          {
++            mp_limb_t b, x;
++          for (b = i, x = ~ *(sp++); x != 0; b += 3, x >>= 1)
++            if (x & 1)
++              {
++                mp_limb_t prime = b | 1;
++                FACTOR_LIST_STORE (prime, prod, max_prod, factors, j);
++              }
++          }
+       }
+ 
+       if (j != 0)
Index: pkgsrc/lang/gcc10/patches/patch-gmp_primesieve.c
diff -u /dev/null pkgsrc/lang/gcc10/patches/patch-gmp_primesieve.c:1.1
--- /dev/null   Mon Apr  1 14:33:58 2024
+++ pkgsrc/lang/gcc10/patches/patch-gmp_primesieve.c    Mon Apr  1 14:33:57 2024
@@ -0,0 +1,17 @@
+$NetBSD: patch-gmp_primesieve.c,v 1.1 2024/04/01 14:33:57 js Exp $
+
+Fix compiling with GCC 4.4.2 on QNX.
+
+--- gmp/primesieve.c.orig      2023-07-29 13:42:17.000000000 +0000
++++ gmp/primesieve.c
+@@ -288,8 +288,8 @@ gmp_primesieve (mp_ptr bit_array, mp_lim
+   bits = n_fto_bit(n);
+   size = bits / GMP_LIMB_BITS + 1;
+ 
+-  for (mp_size_t j = 0, lim = MIN (size, PRIMESIEVE_NUMBEROF_TABLE);
+-       j < lim; ++j)
++  mp_size_t j, lim;
++  for (j = 0, lim = MIN (size, PRIMESIEVE_NUMBEROF_TABLE); j < lim; ++j)
+     bit_array [j] = presieved [j]; /* memcopy? */
+ 
+   if (size > PRIMESIEVE_NUMBEROF_TABLE) {
Index: pkgsrc/lang/gcc10/patches/patch-include_plugin-api.h
diff -u /dev/null pkgsrc/lang/gcc10/patches/patch-include_plugin-api.h:1.1
--- /dev/null   Mon Apr  1 14:33:58 2024
+++ pkgsrc/lang/gcc10/patches/patch-include_plugin-api.h        Mon Apr  1 14:33:57 2024
@@ -0,0 +1,20 @@
+$NetBSD: patch-include_plugin-api.h,v 1.1 2024/04/01 14:33:57 js Exp $
+
+QNX uses __LITTLEENDIAN__ / __BIGENDIAN__, so detect based on that as well.
+
+--- include/plugin-api.h.orig  2023-07-07 07:08:21.000000000 +0000
++++ include/plugin-api.h
+@@ -89,6 +89,13 @@
+ #ifdef __BIG_ENDIAN__
+ #define PLUGIN_BIG_ENDIAN 1
+ #endif
++/* Detect based on __BIGENDIAN__ and __LITTLEENDIAN__ */
++#ifdef __LITTLEENDIAN__
++#define PLUGIN_LITTLE_ENDIAN 1
++#endif
++#ifdef __BIGENDIAN__
++#define PLUGIN_BIG_ENDIAN 1
++#endif
+ #endif
+ 
+ #ifdef __cplusplus
Index: pkgsrc/lang/gcc10/patches/patch-libgfortran_intrinsics_execute_command_line.c
diff -u /dev/null pkgsrc/lang/gcc10/patches/patch-libgfortran_intrinsics_execute_command_line.c:1.1
--- /dev/null   Mon Apr  1 14:33:58 2024
+++ pkgsrc/lang/gcc10/patches/patch-libgfortran_intrinsics_execute_command_line.c       Mon Apr  1 14:33:57 2024
@@ -0,0 +1,15 @@
+$NetBSD: patch-libgfortran_intrinsics_execute_command_line.c,v 1.1 2024/04/01 14:33:57 js Exp $
+
+--- libgfortran/intrinsics/execute_command_line.c.orig 2023-07-07 07:08:21.000000000 +0000
++++ libgfortran/intrinsics/execute_command_line.c
+@@ -45,6 +45,10 @@ extern char **environ;
+ #include <signal.h>
+ #endif
+ 
++#ifndef SA_RESTART
++#define SA_RESTART 0
++#endif
++
+ enum { EXEC_SYNCHRONOUS = -2, EXEC_NOERROR = 0, EXEC_SYSTEMFAILED,
+        EXEC_CHILDFAILED, EXEC_INVALIDCOMMAND };
+ static const char *cmdmsg_values[] =
Index: pkgsrc/lang/gcc10/patches/patch-libgfortran_intrinsics_string_intrinsics_inc.c
diff -u /dev/null pkgsrc/lang/gcc10/patches/patch-libgfortran_intrinsics_string_intrinsics_inc.c:1.1
--- /dev/null   Mon Apr  1 14:33:58 2024
+++ pkgsrc/lang/gcc10/patches/patch-libgfortran_intrinsics_string_intrinsics_inc.c      Mon Apr  1 14:33:57 2024
@@ -0,0 +1,17 @@
+$NetBSD: patch-libgfortran_intrinsics_string_intrinsics_inc.c,v 1.1 2024/04/01 14:33:57 js Exp $
+
+--- libgfortran/intrinsics/string_intrinsics_inc.c.orig        2023-07-07 07:08:21.000000000 +0000
++++ libgfortran/intrinsics/string_intrinsics_inc.c
+@@ -203,11 +203,7 @@ string_len_trim (gfc_charlen_type len, c
+       /* Handle the first characters until we're aligned on a long word
+        boundary.  Actually, s + i + 1 must be properly aligned, because
+        s + i will be the last byte of a long word read.  */
+-      starting = (
+-#ifdef __INTPTR_TYPE__
+-                (__INTPTR_TYPE__)
+-#endif
+-                (s + i + 1)) % long_len;
++      starting = ((intptr_t)(s + i + 1)) % long_len;
+       i -= starting;
+       for (; starting > 0; --starting)
+       if (s[i + starting] != ' ')
Index: pkgsrc/lang/gcc10/patches/patch-libiberty_pex-unix.c
diff -u /dev/null pkgsrc/lang/gcc10/patches/patch-libiberty_pex-unix.c:1.1
--- /dev/null   Mon Apr  1 14:33:58 2024
+++ pkgsrc/lang/gcc10/patches/patch-libiberty_pex-unix.c        Mon Apr  1 14:33:58 2024
@@ -0,0 +1,16 @@
+$NetBSD: patch-libiberty_pex-unix.c,v 1.1 2024/04/01 14:33:58 js Exp $
+
+QNX has spawnve and spawnvpe, which makes configure assume it's the same
+spawnve / spawnvpe that exists on Windows.
+
+--- libiberty/pex-unix.c.orig  2023-07-07 07:08:21.000000000 +0000
++++ libiberty/pex-unix.c
+@@ -366,7 +366,7 @@ pex_unix_close (struct pex_obj *obj ATTR
+ 
+ /* Execute a child.  */
+ 
+-#if defined(HAVE_SPAWNVE) && defined(HAVE_SPAWNVPE)
++#if defined(HAVE_SPAWNVE) && defined(HAVE_SPAWNVPE) && !defined(__QNX__)
+ /* Implementation of pex->exec_child using the Cygwin spawn operation.  */
+ 
+ /* Subroutine of pex_unix_exec_child.  Move OLD_FD to a new file descriptor
Index: pkgsrc/lang/gcc10/patches/patch-libobjc_objc_runtime.h
diff -u /dev/null pkgsrc/lang/gcc10/patches/patch-libobjc_objc_runtime.h:1.1
--- /dev/null   Mon Apr  1 14:33:58 2024
+++ pkgsrc/lang/gcc10/patches/patch-libobjc_objc_runtime.h      Mon Apr  1 14:33:58 2024
@@ -0,0 +1,23 @@
+$NetBSD: patch-libobjc_objc_runtime.h,v 1.1 2024/04/01 14:33:58 js Exp $
+
+This is weird. For some reason, those are not defined on QNX even when not
+including <stddef.h> first. This might be a side effect of not using
+fixincludes on QNX (as that breaks headers even more).
+
+This is obviously a nasty hack and a proper solution needs to be found, but for
+now, this makes libobjc compile.
+
+--- libobjc/objc/runtime.h.orig        2024-04-01 12:21:17.000000000 +0000
++++ libobjc/objc/runtime.h
+@@ -42,6 +42,11 @@ see the files COPYING3 and COPYING.RUNTI
+ extern "C" {
+ #endif /* __cplusplus */
+ 
++#ifdef __QNX__
++typedef __SIZE_TYPE__ size_t;
++typedef __PTRDIFF_TYPE__ ptrdiff_t;
++#endif
++
+ /* An 'Ivar' represents an instance variable.  It holds information
+    about the name, type and offset of the instance variable.  */
+ typedef struct objc_ivar *Ivar;
Index: pkgsrc/lang/gcc10/patches/patch-libquadmath_printf_printf_fphex.c
diff -u /dev/null pkgsrc/lang/gcc10/patches/patch-libquadmath_printf_printf_fphex.c:1.1
--- /dev/null   Mon Apr  1 14:33:58 2024
+++ pkgsrc/lang/gcc10/patches/patch-libquadmath_printf_printf_fphex.c   Mon Apr  1 14:33:58 2024
@@ -0,0 +1,12 @@
+$NetBSD: patch-libquadmath_printf_printf_fphex.c,v 1.1 2024/04/01 14:33:58 js Exp $
+
+--- libquadmath/printf/printf_fphex.c.orig     2023-07-07 07:08:21.000000000 +0000
++++ libquadmath/printf/printf_fphex.c
+@@ -23,6 +23,7 @@
+ #include <stdio.h>
+ #include <string.h>
+ #include <stdbool.h>
++#include <unistd.h>
+ #define NDEBUG
+ #include <assert.h>
+ #include "quadmath-rounding-mode.h"
Index: pkgsrc/lang/gcc10/patches/patch-libstdc++-v3_include_bits_std_abs.h
diff -u /dev/null pkgsrc/lang/gcc10/patches/patch-libstdc++-v3_include_bits_std_abs.h:1.1
--- /dev/null   Mon Apr  1 14:33:58 2024
+++ pkgsrc/lang/gcc10/patches/patch-libstdc++-v3_include_bits_std_abs.h Mon Apr  1 14:33:58 2024
@@ -0,0 +1,15 @@
+$NetBSD: patch-libstdc++-v3_include_bits_std_abs.h,v 1.1 2024/04/01 14:33:58 js Exp $
+
+--- libstdc++-v3/include/bits/std_abs.h.orig   2023-07-07 07:08:22.000000000 +0000
++++ libstdc++-v3/include/bits/std_abs.h
+@@ -41,6 +41,10 @@
+ #endif
+ #undef _GLIBCXX_INCLUDE_NEXT_C_HEADERS
+ 
++#ifdef __QNX__
++#define __CORRECT_ISO_CPP_MATH_H_PROTO
++#endif
++
+ #undef abs
+ 
+ extern "C++"
Index: pkgsrc/lang/gcc10/patches/patch-libstdc++-v3_include_bits_stl_function.h
diff -u /dev/null pkgsrc/lang/gcc10/patches/patch-libstdc++-v3_include_bits_stl_function.h:1.1
--- /dev/null   Mon Apr  1 14:33:58 2024
+++ pkgsrc/lang/gcc10/patches/patch-libstdc++-v3_include_bits_stl_function.h    Mon Apr  1 14:33:58 2024
@@ -0,0 +1,49 @@
+$NetBSD: patch-libstdc++-v3_include_bits_stl_function.h,v 1.1 2024/04/01 14:33:58 js Exp $
+
+--- libstdc++-v3/include/bits/stl_function.h.orig      2023-07-07 07:08:22.000000000 +0000
++++ libstdc++-v3/include/bits/stl_function.h
+@@ -60,6 +60,8 @@
+ #include <bits/move.h>
+ #endif
+ 
++#include <stdint.h>
++
+ namespace std _GLIBCXX_VISIBILITY(default)
+ {
+ _GLIBCXX_BEGIN_NAMESPACE_VERSION
+@@ -421,7 +423,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
+ #endif
+         return __x > __y;
+ #endif
+-      return (__UINTPTR_TYPE__)__x > (__UINTPTR_TYPE__)__y;
++      return (uintptr_t)__x > (uintptr_t)__y;
+       }
+     };
+ 
+@@ -440,7 +442,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
+ #endif
+         return __x < __y;
+ #endif
+-      return (__UINTPTR_TYPE__)__x < (__UINTPTR_TYPE__)__y;
++      return (uintptr_t)__x < (uintptr_t)__y;
+       }
+     };
+ 
+@@ -459,7 +461,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
+ #endif
+         return __x >= __y;
+ #endif
+-      return (__UINTPTR_TYPE__)__x >= (__UINTPTR_TYPE__)__y;
++      return (uintptr_t)__x >= (uintptr_t)__y;
+       }
+     };
+ 
+@@ -478,7 +480,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
+ #endif
+         return __x <= __y;
+ #endif
+-      return (__UINTPTR_TYPE__)__x <= (__UINTPTR_TYPE__)__y;
++      return (uintptr_t)__x <= (uintptr_t)__y;
+       }
+     };
+ 
Index: pkgsrc/lang/gcc10/patches/patch-libstdc++-v3_include_c_global_cmath
diff -u /dev/null pkgsrc/lang/gcc10/patches/patch-libstdc++-v3_include_c_global_cmath:1.1
--- /dev/null   Mon Apr  1 14:33:58 2024
+++ pkgsrc/lang/gcc10/patches/patch-libstdc++-v3_include_c_global_cmath Mon Apr  1 14:33:58 2024
@@ -0,0 +1,15 @@
+$NetBSD: patch-libstdc++-v3_include_c_global_cmath,v 1.1 2024/04/01 14:33:58 js Exp $
+
+--- libstdc++-v3/include/c_global/cmath.orig   2023-07-07 07:08:22.000000000 +0000
++++ libstdc++-v3/include/c_global/cmath
+@@ -49,6 +49,10 @@
+ #ifndef _GLIBCXX_CMATH
+ #define _GLIBCXX_CMATH 1
+ 
++#ifdef __QNX__
++#define __CORRECT_ISO_CPP_MATH_H_PROTO
++#endif
++
+ // Get rid of those macros defined in <math.h> in lieu of real functions.
+ #undef div
+ #undef acos
Index: pkgsrc/lang/gcc10/patches/patch-libstdc++-v3_include_c_global_cstring
diff -u /dev/null pkgsrc/lang/gcc10/patches/patch-libstdc++-v3_include_c_global_cstring:1.1
--- /dev/null   Mon Apr  1 14:33:58 2024
+++ pkgsrc/lang/gcc10/patches/patch-libstdc++-v3_include_c_global_cstring       Mon Apr  1 14:33:58 2024
@@ -0,0 +1,15 @@
+$NetBSD: patch-libstdc++-v3_include_c_global_cstring,v 1.1 2024/04/01 14:33:58 js Exp $
+
+--- libstdc++-v3/include/c_global/cstring.orig 2023-07-07 07:08:22.000000000 +0000
++++ libstdc++-v3/include/c_global/cstring
+@@ -44,6 +44,10 @@
+ #ifndef _GLIBCXX_CSTRING
+ #define _GLIBCXX_CSTRING 1
+ 
++#ifdef __QNX__
++#define __CORRECT_ISO_CPP_STRING_H_PROTO
++#endif
++
+ // Get rid of those macros defined in <string.h> in lieu of real functions.
+ #undef memchr
+ #undef memcmp
Index: pkgsrc/lang/gcc10/patches/patch-libstdc++-v3_include_c_global_cwchar
diff -u /dev/null pkgsrc/lang/gcc10/patches/patch-libstdc++-v3_include_c_global_cwchar:1.1
--- /dev/null   Mon Apr  1 14:33:58 2024
+++ pkgsrc/lang/gcc10/patches/patch-libstdc++-v3_include_c_global_cwchar        Mon Apr  1 14:33:58 2024
@@ -0,0 +1,15 @@
+$NetBSD: patch-libstdc++-v3_include_c_global_cwchar,v 1.1 2024/04/01 14:33:58 js Exp $
+
+--- libstdc++-v3/include/c_global/cwchar.orig  2023-07-07 07:08:22.000000000 +0000
++++ libstdc++-v3/include/c_global/cwchar
+@@ -47,6 +47,10 @@
+ #ifndef _GLIBCXX_CWCHAR
+ #define _GLIBCXX_CWCHAR 1
+ 
++#ifdef __QNX__
++#define __CORRECT_ISO_CPP_WCHAR_H_PROTO
++#endif
++
+ // Need to do a bit of trickery here with mbstate_t as char_traits
+ // assumes it is in wchar.h, regardless of wchar_t specializations.
+ #ifndef _GLIBCXX_HAVE_MBSTATE_T
Index: pkgsrc/lang/gcc10/patches/patch-libstdc++-v3_libsupc++_cxxabi.h
diff -u /dev/null pkgsrc/lang/gcc10/patches/patch-libstdc++-v3_libsupc++_cxxabi.h:1.1
--- /dev/null   Mon Apr  1 14:33:58 2024
+++ pkgsrc/lang/gcc10/patches/patch-libstdc++-v3_libsupc++_cxxabi.h     Mon Apr  1 14:33:58 2024
@@ -0,0 +1,17 @@
+$NetBSD: patch-libstdc++-v3_libsupc++_cxxabi.h,v 1.1 2024/04/01 14:33:58 js Exp $
+
+Nasty hack because ptrdiff_t is missing on QNX with GCC 10 when stddef.h is not
+included first.
+
+--- libstdc++-v3/libsupc++/cxxabi.h.orig       2023-07-07 07:08:22.000000000 +0000
++++ libstdc++-v3/libsupc++/cxxabi.h
+@@ -58,6 +58,9 @@ namespace __cxxabiv1
+   {
+ #endif
+ 
++#ifdef __QNX__
++  typedef __PTRDIFF_TYPE__ ptrdiff_t;
++#endif
+   typedef __cxa_cdtor_return_type (*__cxa_cdtor_type)(void *);
+ 
+   // Allocate array.
Index: pkgsrc/lang/gcc10/patches/patch-libstdc++-v3_libsupc++_cxxabi_init_exception.h
diff -u /dev/null pkgsrc/lang/gcc10/patches/patch-libstdc++-v3_libsupc++_cxxabi_init_exception.h:1.1
--- /dev/null   Mon Apr  1 14:33:58 2024
+++ pkgsrc/lang/gcc10/patches/patch-libstdc++-v3_libsupc++_cxxabi_init_exception.h      Mon Apr  1 14:33:58 2024
@@ -0,0 +1,14 @@
+$NetBSD: patch-libstdc++-v3_libsupc++_cxxabi_init_exception.h,v 1.1 2024/04/01 14:33:58 js Exp $
+
+--- libstdc++-v3/libsupc++/cxxabi_init_exception.h.orig        2023-07-07 07:08:22.000000000 +0000
++++ libstdc++-v3/libsupc++/cxxabi_init_exception.h
+@@ -54,6 +54,9 @@ namespace std
+ 
+ namespace __cxxabiv1
+ {
++#ifdef __QNX__
++  using std::size_t;
++#endif
+   struct __cxa_refcounted_exception;
+ 
+   extern "C"
Index: pkgsrc/lang/gcc10/patches/patch-libstdc++-v3_src_c++11_system_error.cc
diff -u /dev/null pkgsrc/lang/gcc10/patches/patch-libstdc++-v3_src_c++11_system_error.cc:1.1
--- /dev/null   Mon Apr  1 14:33:58 2024
+++ pkgsrc/lang/gcc10/patches/patch-libstdc++-v3_src_c++11_system_error.cc      Mon Apr  1 14:33:58 2024
@@ -0,0 +1,15 @@
+$NetBSD: patch-libstdc++-v3_src_c++11_system_error.cc,v 1.1 2024/04/01 14:33:58 js Exp $
+
+EALREADY and EBUSY are the same on QNX.
+
+--- libstdc++-v3/src/c++11/system_error.cc.orig        2023-07-07 07:08:22.000000000 +0000
++++ libstdc++-v3/src/c++11/system_error.cc
+@@ -100,7 +100,7 @@ namespace
+ #ifdef EAGAIN
+       case EAGAIN:
+ #endif
+-#ifdef EALREADY
++#if defined(EALREADY) && (!defined(EBUSY) || EALREADY != EBUSY)
+       case EALREADY:
+ #endif
+ #ifdef EBADF



Home | Main Index | Thread Index | Old Index