Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified)) by mollari.NetBSD.org (Postfix) with ESMTPS id 8F8301A921F for ; Sun, 13 Mar 2022 08:34:10 +0000 (UTC) Received: by mail.netbsd.org (Postfix, from userid 605) id B645684EDC; Sun, 13 Mar 2022 08:34:09 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by mail.netbsd.org (Postfix) with ESMTP id EE3DA84EDB for ; Sun, 13 Mar 2022 08:34:08 +0000 (UTC) X-Virus-Scanned: amavisd-new at netbsd.org Received: from mail.netbsd.org ([IPv6:::1]) by localhost (mail.netbsd.org [IPv6:::1]) (amavisd-new, port 10025) with ESMTP id 3Hh6nXkcolcg for ; Sun, 13 Mar 2022 08:34:05 +0000 (UTC) Received: from cvs.NetBSD.org (ivanova.NetBSD.org [IPv6:2001:470:a085:999:28c:faff:fe03:5984]) by mail.netbsd.org (Postfix) with ESMTP id 36B8B84CE2 for ; Sun, 13 Mar 2022 08:34:05 +0000 (UTC) Received: by cvs.NetBSD.org (Postfix, from userid 500) id 2F622FB24; Sun, 13 Mar 2022 08:34:05 +0000 (UTC) Content-Transfer-Encoding: 7bit Content-Type: multipart/mixed; boundary="_----------=_1647160445211770" MIME-Version: 1.0 Date: Sun, 13 Mar 2022 08:34:05 +0000 From: "Nia Alarie" Subject: CVS commit: pkgsrc/lang To: pkgsrc-changes@NetBSD.org Reply-To: nia@netbsd.org X-Mailer: log_accum Message-Id: <20220313083405.2F622FB24@cvs.NetBSD.org> Sender: pkgsrc-changes-owner@NetBSD.org List-Id: Precedence: bulk List-Unsubscribe: This is a multi-part message in MIME format. --_----------=_1647160445211770 Content-Disposition: inline Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" Module Name: pkgsrc Committed By: nia Date: Sun Mar 13 08:34:05 UTC 2022 Modified Files: pkgsrc/lang: Makefile Added Files: pkgsrc/lang/gcc10-aux: DESCR Makefile buildlink3.mk distinfo options.mk version.mk pkgsrc/lang/gcc10-aux/patches: patch-contrib_download__prerequisites patch-fixincludes_inclhack.def patch-gcc_Makefile.in patch-gcc_ada_Makefile.rtl patch-gcc_ada_adaint.c patch-gcc_ada_adaint.h patch-gcc_ada_cstreams.c patch-gcc_ada_libgnarl_s-osinte____netbsd.adb patch-gcc_ada_libgnarl_s-osinte____netbsd.ads patch-gcc_ada_libgnarl_s-taprop____posix.adb patch-gcc_ada_libgnat_g-socthi.ads patch-gcc_ada_libgnat_g-socthi____bsd.adb patch-gcc_ada_libgnat_s-osprim____posix.adb patch-gcc_ada_s-oscons-tmplt.c patch-gcc_ada_sysdep.c patch-gcc_config.gcc patch-gcc_config.host patch-gcc_config_aarch64_aarch64-builtins.c patch-gcc_config_aarch64_aarch64-netbsd.h patch-gcc_config_aarch64_driver-aarch64.c patch-gcc_config_darwin-driver.c patch-gcc_config_sparc_sparc.c patch-gcc_configure patch-gcc_ggc-common.c patch-gcc_lto_lto.c patch-gcc_targhooks.c patch-gnattools_configure patch-isl_configure patch-libffi_configure patch-libffi_testsuite_libffi.call_float2.c patch-libgcc_config.host patch-libgcc_crtstuff.c patch-libgfortran_io_format.c patch-libgfortran_io_io.h patch-libgfortran_io_list__read.c patch-libgfortran_io_read.c patch-libgfortran_runtime_environ.c patch-libquadmath_printf_quadmath-printf.c patch-libquadmath_strtod_strtod__l.c patch-libstdc++-v3_libsupc++_new__opa.cc Log Message: lang: import gcc10-aux, the gcc10 ada compiler. from irvise in pkgsrc-wip. To generate a diff of this commit: cvs rdiff -u -r1.639 -r1.640 pkgsrc/lang/Makefile cvs rdiff -u -r0 -r1.1 pkgsrc/lang/gcc10-aux/DESCR \ pkgsrc/lang/gcc10-aux/Makefile pkgsrc/lang/gcc10-aux/buildlink3.mk \ pkgsrc/lang/gcc10-aux/distinfo pkgsrc/lang/gcc10-aux/options.mk \ pkgsrc/lang/gcc10-aux/version.mk cvs rdiff -u -r0 -r1.1 \ pkgsrc/lang/gcc10-aux/patches/patch-contrib_download__prerequisites \ pkgsrc/lang/gcc10-aux/patches/patch-fixincludes_inclhack.def \ pkgsrc/lang/gcc10-aux/patches/patch-gcc_Makefile.in \ pkgsrc/lang/gcc10-aux/patches/patch-gcc_ada_Makefile.rtl \ pkgsrc/lang/gcc10-aux/patches/patch-gcc_ada_adaint.c \ pkgsrc/lang/gcc10-aux/patches/patch-gcc_ada_adaint.h \ pkgsrc/lang/gcc10-aux/patches/patch-gcc_ada_cstreams.c \ pkgsrc/lang/gcc10-aux/patches/patch-gcc_ada_libgnarl_s-osinte____netbsd.adb \ pkgsrc/lang/gcc10-aux/patches/patch-gcc_ada_libgnarl_s-osinte____netbsd.ads \ pkgsrc/lang/gcc10-aux/patches/patch-gcc_ada_libgnarl_s-taprop____posix.adb \ pkgsrc/lang/gcc10-aux/patches/patch-gcc_ada_libgnat_g-socthi.ads \ pkgsrc/lang/gcc10-aux/patches/patch-gcc_ada_libgnat_g-socthi____bsd.adb \ pkgsrc/lang/gcc10-aux/patches/patch-gcc_ada_libgnat_s-osprim____posix.adb \ pkgsrc/lang/gcc10-aux/patches/patch-gcc_ada_s-oscons-tmplt.c \ pkgsrc/lang/gcc10-aux/patches/patch-gcc_ada_sysdep.c \ pkgsrc/lang/gcc10-aux/patches/patch-gcc_config.gcc \ pkgsrc/lang/gcc10-aux/patches/patch-gcc_config.host \ pkgsrc/lang/gcc10-aux/patches/patch-gcc_config_aarch64_aarch64-builtins.c \ pkgsrc/lang/gcc10-aux/patches/patch-gcc_config_aarch64_aarch64-netbsd.h \ pkgsrc/lang/gcc10-aux/patches/patch-gcc_config_aarch64_driver-aarch64.c \ pkgsrc/lang/gcc10-aux/patches/patch-gcc_config_darwin-driver.c \ pkgsrc/lang/gcc10-aux/patches/patch-gcc_config_sparc_sparc.c \ pkgsrc/lang/gcc10-aux/patches/patch-gcc_configure \ pkgsrc/lang/gcc10-aux/patches/patch-gcc_ggc-common.c \ pkgsrc/lang/gcc10-aux/patches/patch-gcc_lto_lto.c \ pkgsrc/lang/gcc10-aux/patches/patch-gcc_targhooks.c \ pkgsrc/lang/gcc10-aux/patches/patch-gnattools_configure \ pkgsrc/lang/gcc10-aux/patches/patch-isl_configure \ pkgsrc/lang/gcc10-aux/patches/patch-libffi_configure \ pkgsrc/lang/gcc10-aux/patches/patch-libffi_testsuite_libffi.call_float2.c \ pkgsrc/lang/gcc10-aux/patches/patch-libgcc_config.host \ pkgsrc/lang/gcc10-aux/patches/patch-libgcc_crtstuff.c \ pkgsrc/lang/gcc10-aux/patches/patch-libgfortran_io_format.c \ pkgsrc/lang/gcc10-aux/patches/patch-libgfortran_io_io.h \ pkgsrc/lang/gcc10-aux/patches/patch-libgfortran_io_list__read.c \ pkgsrc/lang/gcc10-aux/patches/patch-libgfortran_io_read.c \ pkgsrc/lang/gcc10-aux/patches/patch-libgfortran_runtime_environ.c \ pkgsrc/lang/gcc10-aux/patches/patch-libquadmath_printf_quadmath-printf.c \ pkgsrc/lang/gcc10-aux/patches/patch-libquadmath_strtod_strtod__l.c \ pkgsrc/lang/gcc10-aux/patches/patch-libstdc++-v3_libsupc++_new__opa.cc Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. --_----------=_1647160445211770 Content-Disposition: inline Content-Length: 127784 Content-Transfer-Encoding: binary Content-Type: text/x-diff; charset=us-ascii Modified files: Index: pkgsrc/lang/Makefile diff -u pkgsrc/lang/Makefile:1.639 pkgsrc/lang/Makefile:1.640 --- pkgsrc/lang/Makefile:1.639 Tue Mar 8 00:09:46 2022 +++ pkgsrc/lang/Makefile Sun Mar 13 08:34:04 2022 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.639 2022/03/08 00:09:46 wiz Exp $ +# $NetBSD: Makefile,v 1.640 2022/03/13 08:34:04 nia Exp $ # COMMENT= Programming languages @@ -66,6 +66,7 @@ SUBDIR+= gauche SUBDIR+= gawk SUBDIR+= gcc-aux SUBDIR+= gcc10 +SUBDIR+= gcc10-aux SUBDIR+= gcc10-libs SUBDIR+= gcc2 SUBDIR+= gcc5-aux Added files: Index: pkgsrc/lang/gcc10-aux/DESCR diff -u /dev/null pkgsrc/lang/gcc10-aux/DESCR:1.1 --- /dev/null Sun Mar 13 08:34:05 2022 +++ pkgsrc/lang/gcc10-aux/DESCR Sun Mar 13 08:34:04 2022 @@ -0,0 +1,2 @@ +The GNU Compiler Collection (GCC) with Ada support. Includes front ends for Ada, +C, C++ and Fortran. Index: pkgsrc/lang/gcc10-aux/Makefile diff -u /dev/null pkgsrc/lang/gcc10-aux/Makefile:1.1 --- /dev/null Sun Mar 13 08:34:05 2022 +++ pkgsrc/lang/gcc10-aux/Makefile Sun Mar 13 08:34:04 2022 @@ -0,0 +1,210 @@ +# $NetBSD: Makefile,v 1.1 2022/03/13 08:34:04 nia Exp $ + +GCC_PKGNAME= gcc10-aux +.include "version.mk" + +DISTNAME= gcc-${GCC10_DIST_VERSION} +PKGNAME= ${GCC_PKGNAME}-${GCC10_DIST_VERSION} +CATEGORIES= lang +MASTER_SITES= ${MASTER_SITE_GNU:=gcc/gcc-${GCC10_DIST_VERSION}/} +EXTRACT_SUFX= .tar.xz + +MAINTAINER= irvise@irvise.xyz +HOMEPAGE= https://gcc.gnu.org/ +COMMENT= The GNU Compiler Collection (GCC) with Ada support v10 +LICENSE= gnu-gpl-v2 AND gnu-gpl-v3 AND gnu-lgpl-v2 AND gnu-lgpl-v3 + +DISTFILES= ${DEFAULT_DISTFILES} +EXTRACT_ONLY= ${DEFAULT_DISTFILES} + +# Relocations result in a linker error on AArch64, but not x86. +MKPIE_SUPPORTED= no + +CHECK_RELRO_SKIP+= ${GCC_PKGNAME}/lib/* + +NOT_FOR_PLATFORM= Interix-*-* + +USE_TOOLS+= gmake makeinfo sed:run tar:build +USE_TOOLS.NetBSD+= gsed + +GNU_CONFIGURE= yes +GNU_CONFIGURE_STRICT= no +## Build outside ${WRKSRC} +OBJDIR= ../build +CONFIGURE_DIRS= ${OBJDIR} +CONFIGURE_SCRIPT= ../${DISTNAME}/configure +GCC_SUBPREFIX= ${GCC_PKGNAME} +GCC_PREFIX= ${PREFIX}/${GCC_SUBPREFIX} +GNU_CONFIGURE_PREFIX= ${GCC_PREFIX} +INFO_FILES= yes +CONFIGURE_ARGS+= --disable-libstdcxx-pch + +UNLIMIT_RESOURCES+= datasize +UNLIMIT_RESOURCES+= stacksize + +CHECK_PORTABILITY_SKIP+= contrib/* + +.include "../../mk/bsd.prefs.mk" + +LANGS= c + +# In some cases LINKER_RPATH_FLAG needs a trailing space. +LINKER_RPATH_FLAG:= ${LINKER_RPATH_FLAG:S/-rpath/& /} + +## The Library rpath to use in end programs. +LDFLAGS_FOR_TARGET= ${LDFLAGS:M${COMPILER_RPATH_FLAG}*:N*/usr/lib*} ${LDFLAGS:M-Wl,-z*} + +# The "-static-libstdc++ -static-libgcc" flags are normally added to the +# boot-ldflags by configure but because we are supply the boot-ldflags +# we mash supply them. +BOOT_LDFLAGS= -static-libstdc++ -static-libgcc ${LDFLAGS_FOR_TARGET} +# Needed on Darwin when LDFLAGS point to a SDK +BOOT_LDFLAGS+= ${LDFLAGS:M-Wl,-syslibroot*} +# GCC does not understand this option; remove it, or stage build will fail +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" +SUBST_CLASSES+= fixinc +SUBST_STAGE.fixinc= pre-configure +SUBST_FILES.fixinc= gcc/Makefile.in +SUBST_SED.fixinc= -e "s,\./fixinc.sh,-c true," +.endif + +.include "options.mk" + +## Make gcc6-aux the compiler for the package since we need ada support. +# This will allow the configure script to use the gnat* packages and gcc +# with ada support +PATH= /sbin:/bin:/usr/sbin:/usr/bin:${PREFIX}/gcc6-aux/bin:${PREFIX}/sbin:${PREFIX}/bin +CC= ${PREFIX}/gcc6-aux/bin/gcc +CXX= ${PREFIX}/gcc6-aux/bin/g++ + +## For graphite support. +.if !empty(PKG_OPTIONS:Mgcc-graphite) + +post-extract: + ${TAR} -jxf ${DISTDIR}/${ISL16}.tar.bz2 -C ${WRKSRC} + ${MV} ${WRKSRC}/${ISL16} ${WRKSRC}/isl +.endif + +.if !empty(MACHINE_PLATFORM:MNetBSD-*-*) +# on NetBSD, use the native SSP code in libc +CONFIGURE_ARGS+= --disable-libssp +# Match base libstdc++ major +SUBST_CLASSES+= libstdc +SUBST_STAGE.libstdc= pre-configure +SUBST_FILES.libstdc= libstdc++-v3/configure +SUBST_MESSAGE.libstdc= Bumping libstdc++ major to 7 +SUBST_SED.libstdc= -e 's,libtool_VERSION=6:,libtool_VERSION=7:,g' +.else +CONFIGURE_ARGS+= --enable-libssp +.endif + +## For target librarys and libjava programs. +CONFIGURE_ENV+= LDFLAGS_FOR_TARGET=${LDFLAGS_FOR_TARGET:Q} + +CONFIGURE_ARGS+= --enable-languages=${LANGS:Q} +CONFIGURE_ARGS+= --enable-shared +CONFIGURE_ARGS+= --enable-long-long +CONFIGURE_ARGS+= --with-local-prefix=${GCC_PREFIX:Q} +CONFIGURE_ARGS+= --enable-threads=posix +CONFIGURE_ARGS+= --with-boot-ldflags=${BOOT_LDFLAGS:Q} +CONFIGURE_ARGS+= --with-system-zlib +CONFIGURE_ARGS+= --without-zstd +# multilib on Darwin requires fat-binaries +CONFIGURE_ARGS.Darwin+= --disable-multilib +.if !empty(OSX_SDK_PATH) +CONFIGURE_ARGS.Darwin+= --with-sysroot=${OSX_SDK_PATH} +.endif +CONFIGURE_ARGS.NetBSD+= --with-gnu-ld --with-ld=/usr/bin/ld +CONFIGURE_ARGS.NetBSD+= --with-gnu-as --with-as=/usr/bin/as +MAKE_ENV.NetBSD+= ac_cv_func_clock_gettime=yes +MAKE_ENV.NetBSD+= ac_cv_func_gethostbyname_r=no +MAKE_ENV.NetBSD+= ac_cv_func_freelocale=no +MAKE_ENV.NetBSD+= ac_cv_func_newlocale=no +MAKE_ENV.NetBSD+= ac_cv_func_uselocale=no +MAKE_ENV.SunOS+= ac_cv_func_mkostemp=no + +.if !empty(PKGSRC_COMPILER:Mclang) || ${OPSYS} == "DragonFly" +CONFIGURE_ARGS+= --disable-bootstrap +.endif + +.if !empty(MACHINE_PLATFORM:MNetBSD-*-i386) || !empty(MACHINE_PLATFORM:MLinux-*-i386) +CONFIGURE_ARGS+= --with-arch=i486 --with-tune=i486 +.endif + +.if !empty(MACHINE_PLATFORM:MNetBSD-*-x86_64) || !empty(MACHINE_PLATFORM:MLinux-*-x86_64) +CONFIGURE_ARGS+= --with-arch=nocona --with-tune=nocona --with-fpmath=sse +.endif + +.if !empty(MACHINE_PLATFORM:MDarwin-[0-8].*-*) +CONFIGURE_ARGS+= --with-dwarf2 +.endif + +# ${WRKSRC}/fixincludes/ looks for sed and compiles the path to sed into +# a binary so we need to make sure we give it the installed sed and not +# the tool wrapped one. +MAKE_ENV+= ac_cv_path_SED=${TOOLS_SED} +MAKE_ENV+= lt_cv_path_SED=${TOOLS_SED} + +# Determine whether to use binutils +.if ${OPSYS} == "SunOS" +. if exists(/usr/sfw/bin/gobjdump) +CONFIGURE_ENV+= OBJDUMP=/usr/sfw/bin/gobjdump +. endif +. if exists(/usr/bin/ld) +CONFIGURE_ARGS+= --without-gnu-ld --with-ld=/usr/bin/ld +. else +CONFIGURE_ARGS+= --without-gnu-ld --with-ld=/usr/ccs/bin/ld +. endif +. if exists(/usr/sfw/bin/gas) +CONFIGURE_ARGS+= --with-gnu-as --with-as=/usr/sfw/bin/gas +. elif exists(/usr/ccs/bin/as) +CONFIGURE_ARGS+= --without-gnu-as --with-as=/usr/ccs/bin/as +. else +BUILDLINK_DEPMETHOD.binutils= full +. include "../../devel/binutils/buildlink3.mk" +CONFIGURE_ARGS+= --with-gnu-as --with-as=${PREFIX}/bin/gas +. endif +.endif + +.if ${OS_VARIANT} == "SmartOS" +SUBST_CLASSES+= ccs +SUBST_STAGE.ccs= pre-configure +SUBST_FILES.ccs= contrib/make_sunver.pl +SUBST_SED.ccs= -e 's,/usr/ccs/bin,/usr/bin,g' +.endif + +CTF_FILES_SKIP+= */gengtype # CPU limit exceeded + +pre-configure: + ${RUN} cd ${WRKSRC} && ${MKDIR} ${OBJDIR} + +TEST_TARGET= -j ${MAKE_JOBS} -k check || ${TRUE} +TEST_DEPENDS+= dejagnu-[0-9]*:../../devel/dejagnu + +post-test: + ${RUN} cd ${WRKSRC} && cd ${OBJDIR} && \ + ${SHELL} ${WRKSRC}/contrib/test_summary >${WRKDIR}/test_summary.log + ${INFO_MSG} "Test summary are available in ${WRKDIR}/test_summary.log" + +post-install: + ${TEST} -f ${DESTDIR}${GCC_PREFIX}/bin/cc || \ + ( cd ${DESTDIR}${GCC_PREFIX}/bin ; ${LN} -f gcc cc ) +.if !empty(MACHINE_PLATFORM:MSunOS-*-*86*) && ${OS_VERSION} != "5.11" + ${SH} files/values.c ${DESTDIR}${GCC_PREFIX}/bin/gcc -m32 || ${TRUE} + ${SH} files/values.c ${DESTDIR}${GCC_PREFIX}/bin/gcc -m64 || ${TRUE} +.endif + +GENERATE_PLIST+= \ + cd ${DESTDIR}${PREFIX} && \ + ${FIND} ${GCC_SUBPREFIX} \( -type f -o -type l \) -print | ${SORT}; + +# Add gcc6-aux as an explicit dependency. It is needed to bootstrap. +.include "../../lang/gcc6-aux/buildlink3.mk" +.include "../../devel/zlib/buildlink3.mk" +.include "../../mk/dlopen.buildlink3.mk" +.include "../../mk/pthread.buildlink3.mk" +.include "../../mk/bsd.pkg.mk" Index: pkgsrc/lang/gcc10-aux/buildlink3.mk diff -u /dev/null pkgsrc/lang/gcc10-aux/buildlink3.mk:1.1 --- /dev/null Sun Mar 13 08:34:05 2022 +++ pkgsrc/lang/gcc10-aux/buildlink3.mk Sun Mar 13 08:34:04 2022 @@ -0,0 +1,24 @@ +# $NetBSD: buildlink3.mk,v 1.1 2022/03/13 08:34:04 nia Exp $ + +BUILDLINK_TREE+= gcc10-aux + +.if !defined(GCC10_AUX_BUILDLINK3_MK) +GCC10_AUX_BUILDLINK3_MK:= + +BUILDLINK_API_DEPENDS.gcc10-aux+= gcc10-aux>=${_GCC_REQD} +BUILDLINK_ABI_DEPENDS.gcc10-aux+= gcc10-aux>=10.0 +BUILDLINK_PKGSRCDIR.gcc10-aux= ../../lang/gcc10-aux +BUILDLINK_DEPMETHOD.gcc10-aux?= build + +BUILDLINK_PASSTHRU_DIRS+= ${BUILDLINK_PREFIX.gcc10-aux}/gcc10-aux + +BUILDLINK_FILES.gcc10-aux= # empty +BUILDLINK_AUTO_VARS.gcc10-aux= no + +pkgbase := gcc10-aux +.include "../../mk/pkg-build-options.mk" +.include "../../mk/dlopen.buildlink3.mk" +.include "../../mk/pthread.buildlink3.mk" +.endif + +BUILDLINK_TREE+= -gcc10-aux Index: pkgsrc/lang/gcc10-aux/distinfo diff -u /dev/null pkgsrc/lang/gcc10-aux/distinfo:1.1 --- /dev/null Sun Mar 13 08:34:05 2022 +++ pkgsrc/lang/gcc10-aux/distinfo Sun Mar 13 08:34:04 2022 @@ -0,0 +1,48 @@ +$NetBSD: distinfo,v 1.1 2022/03/13 08:34:04 nia Exp $ + +BLAKE2s (gcc-10.3.0.tar.xz) = 6d7c42f9386e5e32a3148122471cb207e5f65d7b5f53b3c9adba2d45a4f28715 +SHA512 (gcc-10.3.0.tar.xz) = 2b2dd7453d48a398c29eaebd1422b70341001b8c90a62aee51e83344e7fdd8a8e45f82a4a9165bd7edc76dada912c932f4b6632c5636760fec4c5d7e402b3f86 +Size (gcc-10.3.0.tar.xz) = 76692288 bytes +BLAKE2s (isl-0.16.1.tar.bz2) = 01c3fc657326e81414986eb7ede6f73e540b97009745ced125cdf7f4a8d80f61 +SHA512 (isl-0.16.1.tar.bz2) = c188667a84dc5bdddb4ab7c35f89c91bf15a8171f4fcaf41301cf285fb7328846d9a367c096012fec4cc69d244f0bc9e95d84c09ec097394cd4093076f2a041b +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_ada_Makefile.rtl) = 1b6a18dce5ffe752be942f6e328d487692f3b33a +SHA1 (patch-gcc_ada_adaint.c) = 465b3e3d6db193b2729f1d4e1c74eefcc3dc85bf +SHA1 (patch-gcc_ada_adaint.h) = 57befa67b18f97345db05672f1e53e8ec70e1935 +SHA1 (patch-gcc_ada_cstreams.c) = 047746f1da085917082dafe8b87fdc5e757e1237 +SHA1 (patch-gcc_ada_libgnarl_s-osinte____netbsd.adb) = 84268061686b15a8ef9013242e3d258b82b9f13e +SHA1 (patch-gcc_ada_libgnarl_s-osinte____netbsd.ads) = 2d1179230289a243bb004b9f16c747cda9761b60 +SHA1 (patch-gcc_ada_libgnarl_s-taprop____posix.adb) = 505d0ba78a21a8a6cc6213a9809c44c284fe2334 +SHA1 (patch-gcc_ada_libgnat_g-socthi.ads) = e2fbc2589814aa630165d3cf4ddc15baf9dce1c9 +SHA1 (patch-gcc_ada_libgnat_g-socthi____bsd.adb) = cbc8aca2b0be1c183cffb0a93091a95b35d78abd +SHA1 (patch-gcc_ada_libgnat_s-osprim____posix.adb) = 018dce870dd06febeb83719149f10e469c4bcc00 +SHA1 (patch-gcc_ada_s-oscons-tmplt.c) = a48b5ae3c061144b8406e27cbbc084385fef5131 +SHA1 (patch-gcc_ada_sysdep.c) = 5b8705680ee1a2c9c2686d14d4cbbba8c5fb4fb2 +SHA1 (patch-gcc_config.gcc) = 4bf07441b6893e9b510f9ad775b4b95aa23e9791 +SHA1 (patch-gcc_config.host) = 8920ce841f6088b365c9b590e3ea9535bd880b40 +SHA1 (patch-gcc_config_aarch64_aarch64-builtins.c) = 87185f5c2e2dbe4195cb19fe6213d2d616d5519b +SHA1 (patch-gcc_config_aarch64_aarch64-netbsd.h) = abf19e2445bce1773162bddef16cd7f41eb36827 +SHA1 (patch-gcc_config_aarch64_driver-aarch64.c) = 7e17b49924ddd9ff33d049d6539e4df77d14d3e5 +SHA1 (patch-gcc_config_darwin-driver.c) = fd57dcca96ce5ddc330e7c7b3b811f64856d7611 +SHA1 (patch-gcc_config_sparc_sparc.c) = e9cb956f3769642bcd0ba4a477d16c73dea46014 +SHA1 (patch-gcc_configure) = 6a2d8eeeed2bf08c3c81291178e669dc91c913ce +SHA1 (patch-gcc_ggc-common.c) = 3e325767922ab7d2079fdb9a3d6b6aa531a2fea5 +SHA1 (patch-gcc_lto_lto.c) = 7bd85ac8ade76a28c394f6fbe5d495f91824f79f +SHA1 (patch-gcc_targhooks.c) = b28d8a9696d07bbfb00b7d8c55193ba99447ff1d +SHA1 (patch-gnattools_configure) = aa6181ee8723a1199d84acea1331645205b558cc +SHA1 (patch-isl_configure) = 5523c76d95b229b3cd25461b4c2b7af24bf2534e +SHA1 (patch-libffi_configure) = 22006b20d7f655e2455a7ad613d676703b6c1ccc +SHA1 (patch-libffi_testsuite_libffi.call_float2.c) = 27b84a11378fb648dfaad0c70abedd77a0a1c1a8 +SHA1 (patch-libgcc_config.host) = ca62e9ecba9e6efe8b18dfb0d73a2ea47a818bec +SHA1 (patch-libgcc_crtstuff.c) = a16d465039de00c195cf0694560140a9c38f3a25 +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-libstdc++-v3_libsupc++_new__opa.cc) = 4183b00a5ee6e61524da4755c825a0c08fd01ed6 Index: pkgsrc/lang/gcc10-aux/options.mk diff -u /dev/null pkgsrc/lang/gcc10-aux/options.mk:1.1 --- /dev/null Sun Mar 13 08:34:05 2022 +++ pkgsrc/lang/gcc10-aux/options.mk Sun Mar 13 08:34:04 2022 @@ -0,0 +1,166 @@ +# $NetBSD: options.mk,v 1.1 2022/03/13 08:34:04 nia Exp $ + +PKG_OPTIONS_VAR= PKG_OPTIONS.${GCC_PKGNAME} +PKG_SUPPORTED_OPTIONS= nls gcc-inplace-math gcc-c++ gcc-fortran gcc-ada \ + gcc-go gcc-objc gcc-objc++ gcc-graphite \ + always-libgcc +PKG_SUGGESTED_OPTIONS= gcc-ada gcc-c++ gcc-fortran \ + gcc-graphite gcc-inplace-math + +.if ${OPSYS} == "NetBSD" +PKG_SUGGESTED_OPTIONS+= nls +.elif ${OPSYS} == "Linux" +PKG_SUGGESTED_OPTIONS+= nls +.elif ${OPSYS} == "DragonFly" +PKG_SUGGESTED_OPTIONS+= nls +.elif ${OPSYS} == "SunOS" +PKG_SUGGESTED_OPTIONS+= gcc-inplace-math always-libgcc +.else +.endif + +.include "../../mk/compiler.mk" +.if empty(PKGSRC_COMPILER:Mgcc) +PKG_SUGGESTED_OPTIONS+= always-libgcc +.endif + +### +### Determine if multilib is avalible. +### +MULTILIB_SUPPORTED?= unknown +.if !empty(MACHINE_PLATFORM:MLinux-*-x86_64) +. if exists(/usr/include/x86_64-linux-gnu/gnu) +_GNU_INCLUDE_DIR= /usr/include/x86_64-linux-gnu/gnu +. else +_GNU_INCLUDE_DIR= /usr/include/gnu +. endif +. if exists(${_GNU_INCLUDE_DIR}/stubs-64.h) && \ + !exists(${_GNU_INCLUDE_DIR}/stubs-32.h) +MULTILIB_SUPPORTED= No +. else +MULTILIB_SUPPORTED= Yes +. endif +.endif +.if !empty(MULTILIB_SUPPORTED:M[Yy][Ee][Ss]) +PKG_SUPPORTED_OPTIONS+= gcc-multilib +PKG_SUGGESTED_OPTIONS+= gcc-multilib +.endif + +.include "../../mk/bsd.options.mk" + +### +### Don't install libgcc if it's older than the system one +### +.if empty(PKG_OPTIONS:Malways-libgcc) + +. for _libdir_ in ${_OPSYS_LIB_DIRS} +. if exists(${_libdir_}) +BASE_LIBGCC!= find ${_libdir_} -name libgcc_s.so +BASE_LIBGCC_MATCH_STRING!= ${ECHO} ${BASE_LIBGCC} ${GCC10_DIST_VERSION} | \ + ${AWK} -f ../../mk/scripts/larger_symbol_version.awk +. if ${BASE_LIBGCC_MATCH_STRING:Mnewer} +DELETE_INSTALLED_LIBGCC= yes +. endif +. endif +. endfor + +. if ${DELETE_INSTALLED_LIBGCC:Uno} +post-install: delete-installed-libgcc + +.PHONY: delete-installed-libgcc +delete-installed-libgcc: + ${FIND} ${DESTDIR} -name 'libgcc_s.so*' -delete + +. endif + +.endif + +### +### Native Language Support +### +.if !empty(PKG_OPTIONS:Mnls) +USE_TOOLS+= msgfmt +CONFIGURE_ARGS+= --enable-nls +CONFIGURE_ARGS+= --with-libiconv-prefix=${BUILDLINK_PREFIX.iconv} +MAKE_ENV+= ICONVPREFIX=${BUILDLINK_PREFIX.iconv} +.include "../../converters/libiconv/buildlink3.mk" +.include "../../devel/gettext-lib/buildlink3.mk" +.else +CONFIGURE_ARGS+= --disable-nls +.endif + +### +### Multilib Support +### +.if (!empty(MULTILIB_SUPPORTED:M[Yy][Ee][Ss]) && \ + empty(PKG_OPTIONS:Mgcc-multilib) ) || \ + !empty(MULTILIB_SUPPORTED:M[Nn][Oo]) +CONFIGURE_ARGS+= --disable-multilib +.endif + +### +### Build math libraries in place +### +.if !empty(PKG_OPTIONS:Mgcc-inplace-math) +. include "../../devel/gmp/inplace.mk" +. include "../../math/mpcomplex/inplace.mk" +. include "../../math/mpfr/inplace.mk" +.else +CONFIGURE_ARGS+= --with-gmp=${BUILDLINK_PREFIX.gmp} +CONFIGURE_ARGS+= --with-mpc=${BUILDLINK_PREFIX.mpcomplex} +CONFIGURE_ARGS+= --with-mpfr=${BUILDLINK_PREFIX.mpfr} +LIBS.SunOS+= -lgmp +. include "../../devel/gmp/buildlink3.mk" +. include "../../math/mpcomplex/buildlink3.mk" +. include "../../math/mpfr/buildlink3.mk" +.endif + + +### +### Graphite Support +### +.if !empty(PKG_OPTIONS:Mgcc-graphite) +ISL16= isl-0.16.1 +SITES.${ISL16}.tar.bz2= ${MASTER_SITE_GNU:=gcc/infrastructure/} +DISTFILES+= ${ISL16}.tar.bz2 +.endif + +### +### Optional languages +### + +.if !empty(PKG_OPTIONS:Mgcc-ada) +LANGS+= ada +USE_TOOLS+= perl +.endif + +.if !empty(PKG_OPTIONS:Mgcc-objc++) +. if empty(PKG_OPTIONS:Mgcc-c++) +PKG_OPTIONS+= gcc-c++ +. endif +. if empty(PKG_OPTIONS:Mgcc-objc) +PKG_OPTIONS+= gcc-objc +. endif +LANGS+= obj-c++ +.endif + +.if !empty(PKG_OPTIONS:Mgcc-objc) +LANGS+= objc +.endif + +.if !empty(PKG_OPTIONS:Mgcc-go) +LANGS+= go +.endif + +.if !empty(PKG_OPTIONS:Mgcc-fortran) +LANGS+= fortran +.endif + +.if !empty(PKG_OPTIONS:Mgcc-c++) +LANGS+= c++ +USE_TOOLS+= perl +CONFIGURE_ARGS+= --enable-__cxa_atexit +CONFIGURE_ARGS+= --with-gxx-include-dir=${GCC_PREFIX}/include/c++/ +.else +CONFIGURE_ARGS+= --disable-build-with-cxx +CONFIGURE_ARGS+= --disable-build-poststage1-with-cxx +.endif Index: pkgsrc/lang/gcc10-aux/version.mk diff -u /dev/null pkgsrc/lang/gcc10-aux/version.mk:1.1 --- /dev/null Sun Mar 13 08:34:05 2022 +++ pkgsrc/lang/gcc10-aux/version.mk Sun Mar 13 08:34:04 2022 @@ -0,0 +1,2 @@ +# $NetBSD: version.mk,v 1.1 2022/03/13 08:34:04 nia Exp $ +GCC10_DIST_VERSION:= 10.3.0 Index: pkgsrc/lang/gcc10-aux/patches/patch-contrib_download__prerequisites diff -u /dev/null pkgsrc/lang/gcc10-aux/patches/patch-contrib_download__prerequisites:1.1 --- /dev/null Sun Mar 13 08:34:05 2022 +++ pkgsrc/lang/gcc10-aux/patches/patch-contrib_download__prerequisites Sun Mar 13 08:34:04 2022 @@ -0,0 +1,17 @@ +$NetBSD: patch-contrib_download__prerequisites,v 1.1 2022/03/13 08:34:04 nia Exp $ + +Non-portable test + +https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90142 + +--- contrib/download_prerequisites.orig 2017-04-11 16:34:07.000000000 +0000 ++++ contrib/download_prerequisites +@@ -122,7 +122,7 @@ md5_check() { + md5_checksum_output=$(md5 -r "${file_to_check}") + # Grab the text before the first space + md5_checksum_detected="${md5_checksum_output%% *}" +- [ "${md5_checksum_expected}" == "${md5_checksum_detected}" ] \ ++ [ "${md5_checksum_expected}" = "${md5_checksum_detected}" ] \ + || die "Cannot verify integrity of possibly corrupted file ${file_to_check}" + echo "${file_to_check}: OK" + } Index: pkgsrc/lang/gcc10-aux/patches/patch-fixincludes_inclhack.def diff -u /dev/null pkgsrc/lang/gcc10-aux/patches/patch-fixincludes_inclhack.def:1.1 --- /dev/null Sun Mar 13 08:34:05 2022 +++ pkgsrc/lang/gcc10-aux/patches/patch-fixincludes_inclhack.def Sun Mar 13 08:34:04 2022 @@ -0,0 +1,36 @@ +$NetBSD: patch-fixincludes_inclhack.def,v 1.1 2022/03/13 08:34:04 nia Exp $ + +A workaround for Catalina SDK bug from +https://github.com/Homebrew/homebrew-core/pull/44762 + +--- fixincludes/inclhack.def.orig 2020-03-04 08:29:59.000000000 +0000 ++++ fixincludes/inclhack.def +@@ -1269,6 +1269,28 @@ fix = { + }; + + /* ++ * macOS 10.15 does not define __OSX_AVAILABLE_STARTING on ++ * non-clang compilers. ++ */ ++fix = { ++ hackname = darwin_availability; ++ mach = "*-*-darwin*"; ++ files = Availability.h; ++ select = "#endif /\\* __OSX_AVAILABLE_STARTING \\*/"; ++ c_fix = format; ++ c_fix_arg = <<- _EOFix_ ++ #endif /* __OSX_AVAILABLE_STARTING */ ++ #ifndef __OSX_AVAILABLE_STARTING ++ #define __OSX_AVAILABLE_STARTING(_osx, _ios) ++ #define __OSX_AVAILABLE_BUT_DEPRECATED(_osxIntro, _osxDep, _iosIntro, _iosDep) ++ #define __OSX_AVAILABLE_BUT_DEPRECATED_MSG(_osxIntro, _osxDep, _iosIntro, _iosDep, _msg) ++ #endif ++ _EOFix_; ++ ++ test_text = "#endif /* __OSX_AVAILABLE_STARTING */"; ++}; ++ ++/* + * macOS 10.12 uses __attribute__((availability)) + * unconditionally. + */ Index: pkgsrc/lang/gcc10-aux/patches/patch-gcc_Makefile.in diff -u /dev/null pkgsrc/lang/gcc10-aux/patches/patch-gcc_Makefile.in:1.1 --- /dev/null Sun Mar 13 08:34:05 2022 +++ pkgsrc/lang/gcc10-aux/patches/patch-gcc_Makefile.in Sun Mar 13 08:34:04 2022 @@ -0,0 +1,15 @@ +$NetBSD: patch-gcc_Makefile.in,v 1.1 2022/03/13 08:34:04 nia Exp $ + +Add gcc libdir to a programs rpath so that _this gcc's_ support libraries +are found. + +--- gcc/Makefile.in.orig 2017-04-18 18:10:27.000000000 +0000 ++++ gcc/Makefile.in +@@ -2112,6 +2112,7 @@ prefix.o: $(BASEVER) + # Language-independent files. + + DRIVER_DEFINES = \ ++ -DLINK_LIBGCC_SPEC="\"%D $(LINKER_RPATH_FLAG) $(prefix)//lib/%M $(LINKER_RPATH_FLAG) $(libdir)/%M \"" \ + -DSTANDARD_STARTFILE_PREFIX=\"$(unlibsubdir)/\" \ + -DSTANDARD_EXEC_PREFIX=\"$(libdir)/gcc/\" \ + -DSTANDARD_LIBEXEC_PREFIX=\"$(libexecdir)/gcc/\" \ Index: pkgsrc/lang/gcc10-aux/patches/patch-gcc_ada_Makefile.rtl diff -u /dev/null pkgsrc/lang/gcc10-aux/patches/patch-gcc_ada_Makefile.rtl:1.1 --- /dev/null Sun Mar 13 08:34:05 2022 +++ pkgsrc/lang/gcc10-aux/patches/patch-gcc_ada_Makefile.rtl Sun Mar 13 08:34:04 2022 @@ -0,0 +1,147 @@ +$NetBSD: patch-gcc_ada_Makefile.rtl,v 1.1 2022/03/13 08:34:04 nia Exp $ + +Add NetBSD as a target and generate the required files correctly. + +--- gcc/ada/Makefile.rtl.orig 2021-04-08 13:56:27.725736525 +0200 ++++ gcc/ada/Makefile.rtl 2021-10-09 18:43:45.974586137 +0200 +@@ -1739,6 +1739,131 @@ + MISCLIB = -lutil + endif + ++# x86 NetBSD ++ifeq ($(strip $(filter-out %86 netbsd%,$(target_cpu) $(target_os))),) ++ LIBGNAT_TARGET_PAIRS = \ ++ a-intnam.ads ++extern int __gnat_sigemptyset (sigset_t *); ++extern int __gnat_sigfillset (sigset_t *); ++extern int __gnat_sigaddset (sigset_t *, int); ++extern int __gnat_sigdelset (sigset_t *, int); ++extern int __gnat_sigismember (sigset_t *, int); ++extern int __gnat_sigaltstack (const stack_t *, stack_t *); ++extern int __gnat_sigaction (int, const struct sigaction *, struct sigaction *); ++#endif ++#include ++extern int __gnat_nanosleep (const struct timespec *, struct timespec *); ++extern int __gnat_gettimeofday (struct timeval *, struct timezone *); ++#include ++extern int __gnat_select (int, fd_set *, fd_set *, fd_set *, struct timeval *); ++#include ++extern int __gnat_socket (int, int, int); ++#if defined(__NetBSD__) ++extern int __gnat_clock_getres (clockid_t, struct timespec *); ++extern int __gnat_clock_gettime (clockid_t, struct timespec *); ++#endif ++ + #ifdef __cplusplus + } + #endif Index: pkgsrc/lang/gcc10-aux/patches/patch-gcc_ada_cstreams.c diff -u /dev/null pkgsrc/lang/gcc10-aux/patches/patch-gcc_ada_cstreams.c:1.1 --- /dev/null Sun Mar 13 08:34:05 2022 +++ pkgsrc/lang/gcc10-aux/patches/patch-gcc_ada_cstreams.c Sun Mar 13 08:34:04 2022 @@ -0,0 +1,25 @@ +$NetBSD: patch-gcc_ada_cstreams.c,v 1.1 2022/03/13 08:34:04 nia Exp $ + +Add missing defines + +--- gcc/ada/cstreams.c.orig 2021-08-28 18:42:21.323680378 +0000 ++++ gcc/ada/cstreams.c 2021-08-28 18:43:48.045445919 +0000 +@@ -188,7 +188,8 @@ + *p = '\\'; + } + +-#elif defined (__FreeBSD__) || defined (__DragonFly__) || defined (__OpenBSD__) ++#elif defined (__FreeBSD__) || defined (__DragonFly__) \ ++ || defined (__OpenBSD__) || defined (__NetBSD__) + + /* Use realpath function which resolves links and references to . and .. + on those Unix systems that support it. Note that GNU/Linux provides it but +@@ -270,7 +271,7 @@ + } + + #elif defined (__linux__) || defined (__sun__) || defined (__FreeBSD__) \ +- || defined (__APPLE__) ++ || defined (__APPLE__) || defined (__NetBSD__) + /* section for platforms having ftello/fseeko */ + + __int64 Index: pkgsrc/lang/gcc10-aux/patches/patch-gcc_ada_libgnarl_s-osinte____netbsd.adb diff -u /dev/null pkgsrc/lang/gcc10-aux/patches/patch-gcc_ada_libgnarl_s-osinte____netbsd.adb:1.1 --- /dev/null Sun Mar 13 08:34:05 2022 +++ pkgsrc/lang/gcc10-aux/patches/patch-gcc_ada_libgnarl_s-osinte____netbsd.adb Sun Mar 13 08:34:04 2022 @@ -0,0 +1,147 @@ +$NetBSD: patch-gcc_ada_libgnarl_s-osinte____netbsd.adb,v 1.1 2022/03/13 08:34:04 nia Exp $ + +Add NetBSD interface. + +--- gcc/ada/libgnarl/s-osinte__netbsd.adb.orig 2021-10-08 11:29:30.470090202 +0200 ++++ gcc/ada/libgnarl/s-osinte__netbsd.adb 2021-10-08 11:29:30.472274837 +0200 +@@ -0,0 +1,140 @@ ++------------------------------------------------------------------------------ ++-- -- ++-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS -- ++-- -- ++-- S Y S T E M . O S _ I N T E R F A C E -- ++-- -- ++-- B o d y -- ++-- -- ++-- Copyright (C) 1991-2015, Free Software Foundation, Inc. -- ++-- -- ++-- GNARL is free software; you can redistribute it and/or modify it under -- ++-- terms of the GNU General Public License as published by the Free Soft- -- ++-- ware Foundation; either version 3, or (at your option) any later ver- -- ++-- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- ++-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- ++-- or FITNESS FOR A PARTICULAR PURPOSE. -- ++-- -- ++-- As a special exception 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 -- ++-- . -- ++-- -- ++-- GNARL was developed by the GNARL team at Florida State University. It is -- ++-- now maintained by Ada Core Technologies Inc. in cooperation with Florida -- ++-- State University (http://www.gnat.com). -- ++-- -- ++------------------------------------------------------------------------------ ++ ++-- This is the NetBSD THREADS version of this package ++ ++with Interfaces.C; use Interfaces.C; ++ ++package body System.OS_Interface is ++ ++ ----------- ++ -- Errno -- ++ ----------- ++ ++ function Errno return int is ++ type int_ptr is access all int; ++ ++ function internal_errno return int_ptr; ++ pragma Import (C, internal_errno, "__errno"); ++ ++ begin ++ return (internal_errno.all); ++ end Errno; ++ ++ -------------------- ++ -- Get_Stack_Base -- ++ -------------------- ++ ++ function Get_Stack_Base (thread : pthread_t) return Address is ++ pragma Unreferenced (thread); ++ begin ++ return Null_Address; ++ end Get_Stack_Base; ++ ++ ------------------ ++ -- pthread_init -- ++ ------------------ ++ ++ procedure pthread_init is ++ begin ++ null; ++ end pthread_init; ++ ++ ----------------------------------- ++ -- pthread_mutexattr_setprotocol -- ++ ----------------------------------- ++ ++ function pthread_mutexattr_setprotocol ++ (attr : access pthread_mutexattr_t; ++ protocol : int) return int is ++ pragma Unreferenced (attr, protocol); ++ begin ++ return 0; ++ end pthread_mutexattr_setprotocol; ++ ++ -------------------------------------- ++ -- pthread_mutexattr_setprioceiling -- ++ -------------------------------------- ++ ++ function pthread_mutexattr_setprioceiling ++ (attr : access pthread_mutexattr_t; ++ prioceiling : int) return int is ++ pragma Unreferenced (attr, prioceiling); ++ begin ++ return 0; ++ end pthread_mutexattr_setprioceiling; ++ ++ ----------------- ++ -- To_Duration -- ++ ----------------- ++ ++ function To_Duration (TS : timespec) return Duration is ++ begin ++ return Duration (TS.ts_sec) + Duration (TS.ts_nsec) / 10#1#E9; ++ end To_Duration; ++ ++ ------------------------ ++ -- To_Target_Priority -- ++ ------------------------ ++ ++ function To_Target_Priority ++ (Prio : System.Any_Priority) return Interfaces.C.int ++ is ++ begin ++ return Interfaces.C.int (Prio); ++ end To_Target_Priority; ++ ++ ----------------- ++ -- To_Timespec -- ++ ----------------- ++ ++ function To_Timespec (D : Duration) return timespec is ++ S : time_t; ++ F : Duration; ++ ++ begin ++ S := time_t (Long_Long_Integer (D)); ++ F := D - Duration (S); ++ ++ -- If F has negative value due to a round-up, adjust for positive F ++ -- value. ++ ++ if F < 0.0 then ++ S := S - 1; ++ F := F + 1.0; ++ end if; ++ ++ return timespec'(ts_sec => S, ++ ts_nsec => long (Long_Long_Integer (F * 10#1#E9))); ++ end To_Timespec; ++ ++end System.OS_Interface; Index: pkgsrc/lang/gcc10-aux/patches/patch-gcc_ada_libgnarl_s-osinte____netbsd.ads diff -u /dev/null pkgsrc/lang/gcc10-aux/patches/patch-gcc_ada_libgnarl_s-osinte____netbsd.ads:1.1 --- /dev/null Sun Mar 13 08:34:05 2022 +++ pkgsrc/lang/gcc10-aux/patches/patch-gcc_ada_libgnarl_s-osinte____netbsd.ads Sun Mar 13 08:34:04 2022 @@ -0,0 +1,670 @@ +$NetBSD: patch-gcc_ada_libgnarl_s-osinte____netbsd.ads,v 1.1 2022/03/13 08:34:04 nia Exp $ + +Add NetBSD interface. + +--- gcc/ada/libgnarl/s-osinte__netbsd.ads.orig 2021-10-08 11:29:30.503927461 +0200 ++++ gcc/ada/libgnarl/s-osinte__netbsd.ads 2021-10-09 18:31:14.947869872 +0200 +@@ -0,0 +1,663 @@ ++------------------------------------------------------------------------------ ++-- -- ++-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS -- ++-- -- ++-- S Y S T E M . O S _ I N T E R F A C E -- ++-- -- ++-- S p e c -- ++-- -- ++-- Copyright (C) 1991-1994, Florida State University -- ++-- Copyright (C) 1995-2015, Free Software Foundation, Inc. -- ++-- -- ++-- GNAT is free software; you can redistribute it and/or modify it under -- ++-- terms of the GNU General Public License as published by the Free Soft- -- ++-- ware Foundation; either version 3, or (at your option) any later ver- -- ++-- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- ++-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- ++-- or FITNESS FOR A PARTICULAR PURPOSE. -- ++-- -- ++-- As a special exception 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 -- ++-- . -- ++-- -- ++-- GNARL was developed by the GNARL team at Florida State University. It is -- ++-- now maintained by Ada Core Technologies Inc. in cooperation with Florida -- ++-- State University (http://www.gnat.com). -- ++-- -- ++------------------------------------------------------------------------------ ++ ++-- This is the NetBSD PTHREADS version of this package. ++ ++-- This package encapsulates all direct interfaces to OS services ++-- that are needed by the tasking run-time (libgnarl). ++ ++-- PLEASE DO NOT add any with-clauses to this package or remove the pragma ++-- Preelaborate. This package is designed to be a bottom-level (leaf) package. ++ ++with Ada.Unchecked_Conversion; ++ ++with Interfaces.C; ++with System.OS_Constants; ++ ++package System.OS_Interface is ++ pragma Preelaborate; ++ ++ pragma Linker_Options ("-pthread"); ++ ++ subtype int is Interfaces.C.int; ++ subtype short is Interfaces.C.short; ++ subtype long is Interfaces.C.long; ++ subtype unsigned is Interfaces.C.unsigned; ++ subtype unsigned_short is Interfaces.C.unsigned_short; ++ subtype unsigned_long is Interfaces.C.unsigned_long; ++ subtype unsigned_char is Interfaces.C.unsigned_char; ++ subtype plain_char is Interfaces.C.plain_char; ++ subtype size_t is Interfaces.C.size_t; ++ subtype char_array is Interfaces.C.char_array; ++ subtype int64 is Interfaces.Integer_64; ++ ++ ----------- ++ -- Errno -- ++ ----------- ++ ++ function Errno return int; ++ pragma Inline (Errno); ++ ++ EAGAIN : constant := 35; ++ EINTR : constant := 4; ++ EINVAL : constant := 22; ++ ENOMEM : constant := 12; ++ ETIMEDOUT : constant := 60; ++ ++ ------------- ++ -- Signals -- ++ ------------- ++ ++ Max_Interrupt : constant := 31; ++ type Signal is new int range 0 .. Max_Interrupt; ++ for Signal'Size use int'Size; ++ ++ SIGHUP : constant := 1; -- hangup ++ SIGINT : constant := 2; -- interrupt (rubout) ++ SIGQUIT : constant := 3; -- quit (ASCD FS) ++ SIGILL : constant := 4; -- illegal instruction (not reset) ++ SIGTRAP : constant := 5; -- trace trap (not reset) ++ SIGIOT : constant := 6; -- IOT instruction ++ SIGABRT : constant := 6; -- used by abort, replace SIGIOT in the future ++ SIGEMT : constant := 7; -- EMT instruction ++ SIGFPE : constant := 8; -- floating point exception ++ SIGKILL : constant := 9; -- kill (cannot be caught or ignored) ++ SIGBUS : constant := 10; -- bus error ++ SIGSEGV : constant := 11; -- segmentation violation ++ SIGSYS : constant := 12; -- bad argument to system call ++ SIGPIPE : constant := 13; -- write on a pipe with no one to read it ++ SIGALRM : constant := 14; -- alarm clock ++ SIGTERM : constant := 15; -- software termination signal from kill ++ SIGURG : constant := 16; -- urgent condition on IO channel ++ SIGSTOP : constant := 17; -- stop (cannot be caught or ignored) ++ SIGTSTP : constant := 18; -- user stop requested from tty ++ SIGCONT : constant := 19; -- stopped process has been continued ++ SIGCLD : constant := 20; -- alias for SIGCHLD ++ SIGCHLD : constant := 20; -- child status change ++ SIGTTIN : constant := 21; -- background tty read attempted ++ SIGTTOU : constant := 22; -- background tty write attempted ++ SIGIO : constant := 23; -- I/O possible (Solaris SIGPOLL alias) ++ SIGXCPU : constant := 24; -- CPU time limit exceeded ++ SIGXFSZ : constant := 25; -- filesize limit exceeded ++ SIGVTALRM : constant := 26; -- virtual timer expired ++ SIGPROF : constant := 27; -- profiling time alarm ++ SIGWINCH : constant := 28; -- window size change ++ SIGINFO : constant := 29; -- information request (NetBSD/FreeBSD) ++ SIGUSR1 : constant := 30; -- user defined signal 1 ++ SIGUSR2 : constant := 31; -- user defined signal 2 ++ ++ SIGADAABORT : constant := SIGABRT; ++ -- Change this if you want to use another signal for task abort. ++ -- SIGTERM might be a good one. ++ ++ type Signal_Set is array (Natural range <>) of Signal; ++ ++ -- Interrupts that must be unmasked at all times. NetBSD ++ -- pthreads will not allow an application to mask out any ++ -- interrupt needed by the threads library. ++ Unmasked : constant Signal_Set := ++ (SIGTRAP, SIGBUS, SIGTTIN, SIGTTOU, SIGTSTP); ++ ++ -- NetBSD will uses SIGPROF for timing. Do not allow a ++ -- handler to attach to this signal. ++ Reserved : constant Signal_Set := (0 .. 0 => SIGPROF); ++ ++ type sigset_t is private; ++ ++ function sigaddset ++ (set : access sigset_t; ++ sig : Signal) return int; ++ pragma Import (C, sigaddset, "__gnat_sigaddset"); ++ ++ function sigdelset ++ (set : access sigset_t; ++ sig : Signal) return int; ++ pragma Import (C, sigdelset, "__gnat_sigdelset"); ++ ++ function sigfillset (set : access sigset_t) return int; ++ pragma Import (C, sigfillset, "__gnat_sigfillset"); ++ ++ function sigismember ++ (set : access sigset_t; ++ sig : Signal) return int; ++ pragma Import (C, sigismember, "__gnat_sigismember"); ++ ++ function sigemptyset (set : access sigset_t) return int; ++ pragma Import (C, sigemptyset, "__gnat_sigemptyset"); ++ ++ -- sigcontext is architecture dependent, so define it private ++ type struct_sigcontext is private; ++ ++ -- ??? This is the current definition of struct_sigaction ++ -- as of 2021/10/02 in signal.h ++ type old_struct_sigaction is record ++ sa_handler : System.Address; ++ sa_mask : sigset_t; ++ sa_flags : int; ++ end record; ++ pragma Convention (C, old_struct_sigaction); ++ ++ -- This is an incorrect struct as of 2021/10/02 ++ type new_struct_sigaction is record ++ sa_handler : System.Address; ++ sa_flags : int; ++ sa_mask : sigset_t; ++ end record; ++ pragma Convention (C, new_struct_sigaction); ++ ++ -- Corrected to use old_struct_sigaction 2021/10/02 ++ subtype struct_sigaction is old_struct_sigaction; ++ type struct_sigaction_ptr is access all struct_sigaction; ++ ++ SIG_BLOCK : constant := 1; ++ SIG_UNBLOCK : constant := 2; ++ SIG_SETMASK : constant := 3; ++ ++ SIG_DFL : constant := 0; ++ SIG_IGN : constant := 1; ++ -- Added for completeness ++ SIG_ERR : constant := -1; ++ SIG_HOLD : constant := 3; ++ ++ SA_SIGINFO : constant := 16#0040#; ++ SA_ONSTACK : constant := 16#0001#; ++ ++ function sigaction ++ (sig : Signal; ++ act : struct_sigaction_ptr; ++ oact : struct_sigaction_ptr) return int; ++ pragma Import (C, sigaction, "__gnat_sigaction"); ++ ++ ---------- ++ -- Time -- ++ ---------- ++ ++ Time_Slice_Supported : constant Boolean := True; ++ -- Indicates whether time slicing is supported (i.e SCHED_RR is supported) ++ ++ type timespec is private; ++ ++ function nanosleep (rqtp, rmtp : access timespec) return int; ++ pragma Import (C, nanosleep, "__gnat_nanosleep"); ++ ++ type clockid_t is new unsigned; ++ ++ function clock_getres ++ (clock_id : clockid_t; ++ res : access timespec) return int; ++ pragma Import (C, clock_getres, "__gnat_clock_getres"); ++ ++ function clock_gettime ++ (clock_id : clockid_t; ++ tp : access timespec) ++ return int; ++ pragma Import (C, clock_gettime, "__gnat_clock_gettime"); ++ ++ function To_Duration (TS : timespec) return Duration; ++ pragma Inline (To_Duration); ++ ++ function To_Timespec (D : Duration) return timespec; ++ pragma Inline (To_Timespec); ++ ++ type struct_timezone is record ++ tz_minuteswest : int; ++ tz_dsttime : int; ++ end record; ++ pragma Convention (C, struct_timezone); ++ ++ ------------------------- ++ -- Priority Scheduling -- ++ ------------------------- ++ ++ SCHED_OTHER : constant := 0; ++ SCHED_FIFO : constant := 1; ++ SCHED_RR : constant := 2; ++ ++ function To_Target_Priority ++ (Prio : System.Any_Priority) return Interfaces.C.int; ++ -- Maps System.Any_Priority to a POSIX priority ++ ++ ------------- ++ -- Process -- ++ ------------- ++ ++ type pid_t is private; ++ ++ function kill (pid : pid_t; sig : Signal) return int; ++ pragma Import (C, kill, "__gnat_kill"); ++ ++ function getpid return pid_t; ++ pragma Import (C, getpid, "getpid"); ++ ++ --------- ++ -- LWP -- ++ --------- ++ ++ function lwp_self return System.Address; ++ -- lwp_self does not exist on this thread library, revert to pthread_self ++ -- which is the closest approximation (with getpid). This function is ++ -- needed to share s-taprop.adb across POSIX-like targets. ++ pragma Import (C, lwp_self, "pthread_self"); ++ ++ ------------- ++ -- Threads -- ++ ------------- ++ ++ type Thread_Body is access ++ function (arg : System.Address) return System.Address; ++ pragma Convention (C, Thread_Body); ++ ++ function Thread_Body_Access is new ++ Ada.Unchecked_Conversion (System.Address, Thread_Body); ++ ++ type pthread_t is private; ++ subtype Thread_Id is pthread_t; ++ ++ type pthread_mutex_t is limited private; ++ type pthread_cond_t is limited private; ++ type pthread_attr_t is limited private; ++ type pthread_mutexattr_t is limited private; ++ type pthread_condattr_t is limited private; ++ type pthread_rwlock_t is limited private; ++ type pthread_rwlockattr_t is limited private; ++ type pthread_key_t is private; ++ ++ PTHREAD_CREATE_DETACHED : constant := 1; ++ PTHREAD_CREATE_JOINABLE : constant := 0; ++ ++ PTHREAD_SCOPE_PROCESS : constant := 0; ++ PTHREAD_SCOPE_SYSTEM : constant := 1; ++ ++ ----------- ++ -- Stack -- ++ ----------- ++ ++ type stack_t is record ++ ss_sp : System.Address; ++ ss_size : size_t; ++ ss_flags : int; ++ end record; ++ pragma Convention (C, stack_t); ++ ++ function sigaltstack ++ (ss : not null access stack_t; ++ oss : access stack_t) return int; ++ pragma Import (C, sigaltstack, "__gnat_sigaltstack"); ++ ++ Alternate_Stack : aliased System.Address; ++ -- This is a dummy definition, never used (Alternate_Stack_Size is null) ++ ++ Alternate_Stack_Size : constant := 0; ++ -- No alternate signal stack is used on this platform ++ ++ Stack_Base_Available : constant Boolean := False; ++ -- Indicates whether the stack base is available on this target. This ++ -- allows us to share s-osinte.adb between all the FSU run time. Note that ++ -- this value can only be true if pthread_t has a complete definition that ++ -- corresponds exactly to the C header files. ++ ++ function Get_Stack_Base (thread : pthread_t) return Address; ++ pragma Inline (Get_Stack_Base); ++ -- returns the stack base of the specified thread. Only call this function ++ -- when Stack_Base_Available is True. ++ ++ function Get_Page_Size return int; ++ pragma Import (C, Get_Page_Size, "_getpagesize"); ++ -- Returns the size of a page ++ ++ PROT_NONE : constant := 0; ++ PROT_READ : constant := 1; ++ PROT_WRITE : constant := 2; ++ PROT_EXEC : constant := 4; ++ PROT_ALL : constant := PROT_READ + PROT_WRITE + PROT_EXEC; ++ PROT_ON : constant := PROT_NONE; ++ PROT_OFF : constant := PROT_ALL; ++ ++ function mprotect (addr : Address; len : size_t; prot : int) return int; ++ pragma Import (C, mprotect); ++ ++ --------------------------------------- ++ -- Nonstandard Thread Initialization -- ++ --------------------------------------- ++ ++ -- FSU_THREADS requires pthread_init, which is nonstandard and this should ++ -- be invoked during the elaboration of s-taprop.adb. ++ ++ -- NetBSD does not require this so we provide an empty Ada body ++ ++ procedure pthread_init; ++ ++ ------------------------- ++ -- POSIX.1c Section 3 -- ++ ------------------------- ++ ++ function sigwait ++ (set : access sigset_t; ++ sig : access Signal) return int; ++ pragma Import (C, sigwait, "sigwait"); ++ ++ function pthread_kill ++ (thread : pthread_t; ++ sig : Signal) return int; ++ pragma Import (C, pthread_kill, "pthread_kill"); ++ ++ function pthread_sigmask ++ (how : int; ++ set : access sigset_t; ++ oset : access sigset_t) return int; ++ pragma Import (C, pthread_sigmask, "pthread_sigmask"); ++ ++ -------------------------- ++ -- POSIX.1c Section 11 -- ++ -------------------------- ++ ++ function pthread_mutexattr_init ++ (attr : access pthread_mutexattr_t) return int; ++ pragma Import (C, pthread_mutexattr_init, "pthread_mutexattr_init"); ++ ++ function pthread_mutexattr_destroy ++ (attr : access pthread_mutexattr_t) return int; ++ pragma Import (C, pthread_mutexattr_destroy, "pthread_mutexattr_destroy"); ++ ++ function pthread_mutex_init ++ (mutex : access pthread_mutex_t; ++ attr : access pthread_mutexattr_t) return int; ++ pragma Import (C, pthread_mutex_init, "pthread_mutex_init"); ++ ++ function pthread_mutex_destroy (mutex : access pthread_mutex_t) return int; ++ pragma Import (C, pthread_mutex_destroy, "pthread_mutex_destroy"); ++ ++ function pthread_mutex_lock (mutex : access pthread_mutex_t) return int; ++ pragma Import (C, pthread_mutex_lock, "pthread_mutex_lock"); ++ ++ function pthread_mutex_unlock (mutex : access pthread_mutex_t) return int; ++ pragma Import (C, pthread_mutex_unlock, "pthread_mutex_unlock"); ++ ++ function pthread_condattr_init ++ (attr : access pthread_condattr_t) return int; ++ pragma Import (C, pthread_condattr_init, "pthread_condattr_init"); ++ ++ function pthread_condattr_destroy ++ (attr : access pthread_condattr_t) return int; ++ pragma Import (C, pthread_condattr_destroy, "pthread_condattr_destroy"); ++ ++ function pthread_cond_init ++ (cond : access pthread_cond_t; ++ attr : access pthread_condattr_t) return int; ++ pragma Import (C, pthread_cond_init, "pthread_cond_init"); ++ ++ function pthread_cond_destroy (cond : access pthread_cond_t) return int; ++ pragma Import (C, pthread_cond_destroy, "pthread_cond_destroy"); ++ ++ function pthread_cond_signal (cond : access pthread_cond_t) return int; ++ pragma Import (C, pthread_cond_signal, "pthread_cond_signal"); ++ ++ function pthread_cond_wait ++ (cond : access pthread_cond_t; ++ mutex : access pthread_mutex_t) return int; ++ pragma Import (C, pthread_cond_wait, "pthread_cond_wait"); ++ ++ function pthread_cond_timedwait ++ (cond : access pthread_cond_t; ++ mutex : access pthread_mutex_t; ++ abstime : access timespec) return int; ++ pragma Import (C, pthread_cond_timedwait, "pthread_cond_timedwait"); ++ ++ Relative_Timed_Wait : constant Boolean := False; ++ -- pthread_cond_timedwait requires an absolute delay time ++ ++ -------------------------- ++ -- POSIX.1c Section 13 -- ++ -------------------------- ++ ++ PTHREAD_PRIO_NONE : constant := 0; ++ PTHREAD_PRIO_INHERIT : constant := 1; ++ PTHREAD_PRIO_PROTECT : constant := 2; ++ ++ function pthread_mutexattr_setprotocol ++ (attr : access pthread_mutexattr_t; ++ protocol : int) return int; ++ ++ function pthread_mutexattr_setprioceiling ++ (attr : access pthread_mutexattr_t; ++ prioceiling : int) return int; ++ ++ type struct_sched_param is record ++ sched_priority : int; ++ end record; ++ pragma Convention (C, struct_sched_param); ++ ++ function pthread_getschedparam ++ (thread : pthread_t; ++ policy : access int; ++ param : access struct_sched_param) return int; ++ pragma Import (C, pthread_getschedparam, "pthread_getschedparam"); ++ ++ function pthread_setschedparam ++ (thread : pthread_t; ++ policy : int; ++ param : access struct_sched_param) return int; ++ pragma Import (C, pthread_setschedparam, "pthread_setschedparam"); ++ ++ function pthread_attr_setscope ++ (attr : access pthread_attr_t; ++ contentionscope : int) return int; ++ pragma Import (C, pthread_attr_setscope, "pthread_attr_setscope"); ++ ++ function pthread_attr_getscope ++ (attr : access pthread_attr_t; ++ contentionscope : access int) return int; ++ pragma Import (C, pthread_attr_getscope, "pthread_attr_getscope"); ++ ++ function pthread_attr_setinheritsched ++ (attr : access pthread_attr_t; ++ inheritsched : int) return int; ++ pragma Import ++ (C, pthread_attr_setinheritsched, "pthread_attr_setinheritsched"); ++ ++ function pthread_attr_getinheritsched ++ (attr : access pthread_attr_t; ++ inheritsched : access int) return int; ++ pragma Import ++ (C, pthread_attr_getinheritsched, "pthread_attr_getinheritsched"); ++ ++ function pthread_attr_setschedpolicy ++ (attr : access pthread_attr_t; ++ policy : int) return int; ++ pragma Import (C, pthread_attr_setschedpolicy, ++ "pthread_attr_setschedpolicy"); ++ ++ function pthread_attr_getschedpolicy ++ (attr : access pthread_attr_t; ++ policy : access int) return int; ++ pragma Import (C, pthread_attr_getschedpolicy, ++ "pthread_attr_getschedpolicy"); ++ ++ function pthread_attr_setschedparam ++ (attr : access pthread_attr_t; ++ sched_param : int) return int; ++ pragma Import (C, pthread_attr_setschedparam, "pthread_attr_setschedparam"); ++ ++ function pthread_attr_getschedparam ++ (attr : access pthread_attr_t; ++ sched_param : access int) return int; ++ pragma Import (C, pthread_attr_getschedparam, "pthread_attr_getschedparam"); ++ ++ function sched_yield return int; ++ pragma Import (C, sched_yield, "sched_yield"); ++ ++ -------------------------- ++ -- P1003.1c Section 16 -- ++ -------------------------- ++ ++ function pthread_attr_init (attributes : access pthread_attr_t) return int; ++ pragma Import (C, pthread_attr_init, "pthread_attr_init"); ++ ++ function pthread_attr_destroy ++ (attributes : access pthread_attr_t) return int; ++ pragma Import (C, pthread_attr_destroy, "pthread_attr_destroy"); ++ ++ function pthread_attr_setdetachstate ++ (attr : access pthread_attr_t; ++ detachstate : int) return int; ++ pragma Import ++ (C, pthread_attr_setdetachstate, "pthread_attr_setdetachstate"); ++ ++ function pthread_attr_getdetachstate ++ (attr : access pthread_attr_t; ++ detachstate : access int) return int; ++ pragma Import ++ (C, pthread_attr_getdetachstate, "pthread_attr_getdetachstate"); ++ ++ function pthread_attr_getstacksize ++ (attr : access pthread_attr_t; ++ stacksize : access size_t) return int; ++ pragma Import ++ (C, pthread_attr_getstacksize, "pthread_attr_getstacksize"); ++ ++ function pthread_attr_setstacksize ++ (attr : access pthread_attr_t; ++ stacksize : size_t) return int; ++ pragma Import ++ (C, pthread_attr_setstacksize, "pthread_attr_setstacksize"); ++ ++ function pthread_create ++ (thread : access pthread_t; ++ attributes : access pthread_attr_t; ++ start_routine : Thread_Body; ++ arg : System.Address) return int; ++ pragma Import (C, pthread_create, "pthread_create"); ++ ++ function pthread_detach (thread : pthread_t) return int; ++ pragma Import (C, pthread_detach, "pthread_detach"); ++ ++ procedure pthread_exit (status : System.Address); ++ pragma Import (C, pthread_exit, "pthread_exit"); ++ ++ function pthread_self return pthread_t; ++ pragma Import (C, pthread_self, "pthread_self"); ++ ++ -------------------------- ++ -- POSIX.1c Section 17 -- ++ -------------------------- ++ ++ function pthread_setspecific ++ (key : pthread_key_t; ++ value : System.Address) return int; ++ pragma Import (C, pthread_setspecific, "pthread_setspecific"); ++ ++ function pthread_getspecific (key : pthread_key_t) return System.Address; ++ pragma Import (C, pthread_getspecific, "pthread_getspecific"); ++ ++ type destructor_pointer is access procedure (arg : System.Address); ++ pragma Convention (C, destructor_pointer); ++ ++ function pthread_key_create ++ (key : access pthread_key_t; ++ destructor : destructor_pointer) return int; ++ pragma Import (C, pthread_key_create, "pthread_key_create"); ++ ++private ++ ++ type sigset_t is array (1 .. 4) of unsigned; ++ ++ -- In NetBSD the component sa_handler turns out to ++ -- be one a union type, and the selector is a macro: ++ -- #define sa_handler __sigaction_u._handler ++ -- #define sa_sigaction __sigaction_u._sigaction ++ ++ -- Should we add a signal_context type here ??? ++ -- How could it be done independent of the CPU architecture ??? ++ -- sigcontext type is opaque, so it is architecturally neutral. ++ -- It is always passed as an access type, so define it as an empty record ++ -- since the contents are not used anywhere. ++ ++ type struct_sigcontext is null record; ++ pragma Convention (C, struct_sigcontext); ++ ++ type pid_t is new int; ++ ++ type time_t is new int64; ++ ++ type timespec is record ++ ts_sec : time_t; ++ ts_nsec : long; ++ end record; ++ pragma Convention (C, timespec); ++ ++ type pthread_t is new System.Address; ++ type pthread_key_t is new int; ++ ++ type pthread_attr_t is record ++ Data : char_array (1 .. System.OS_Constants.PTHREAD_ATTR_SIZE); ++ end record; ++ pragma Convention (C, pthread_attr_t); ++ for pthread_attr_t'Alignment use size_t'Alignment; ++ ++ type pthread_mutex_t is record ++ Data : char_array (1 .. System.OS_Constants.PTHREAD_MUTEX_SIZE); ++ end record; ++ pragma Convention (C, pthread_mutex_t); ++ for pthread_mutex_t'Alignment use size_t'Alignment; ++ ++ type pthread_mutexattr_t is record ++ Data : char_array (1 .. System.OS_Constants.PTHREAD_MUTEXATTR_SIZE); ++ end record; ++ pragma Convention (C, pthread_mutexattr_t); ++ for pthread_mutexattr_t'Alignment use size_t'Alignment; ++ ++ type pthread_cond_t is record ++ Data : char_array (1 .. System.OS_Constants.PTHREAD_COND_SIZE); ++ end record; ++ pragma Convention (C, pthread_cond_t); ++ for pthread_cond_t'Alignment use size_t'Alignment; ++ ++ type pthread_condattr_t is record ++ Data : char_array (1 .. System.OS_Constants.PTHREAD_CONDATTR_SIZE); ++ end record; ++ pragma Convention (C, pthread_condattr_t); ++ for pthread_condattr_t'Alignment use size_t'Alignment; ++ ++ type pthread_rwlock_t is record ++ Data : char_array (1 .. System.OS_Constants.PTHREAD_RWLOCK_SIZE); ++ end record; ++ pragma Convention (C, pthread_rwlock_t); ++ for pthread_rwlock_t'Alignment use size_t'Alignment; ++ ++ type pthread_rwlockattr_t is record ++ Data : char_array (1 .. System.OS_Constants.PTHREAD_RWLOCKATTR_SIZE); ++ end record; ++ pragma Convention (C, pthread_rwlockattr_t); ++ for pthread_rwlockattr_t'Alignment use size_t'Alignment; ++ ++end System.OS_Interface; Index: pkgsrc/lang/gcc10-aux/patches/patch-gcc_ada_libgnarl_s-taprop____posix.adb diff -u /dev/null pkgsrc/lang/gcc10-aux/patches/patch-gcc_ada_libgnarl_s-taprop____posix.adb:1.1 --- /dev/null Sun Mar 13 08:34:05 2022 +++ pkgsrc/lang/gcc10-aux/patches/patch-gcc_ada_libgnarl_s-taprop____posix.adb Sun Mar 13 08:34:04 2022 @@ -0,0 +1,27 @@ +$NetBSD: patch-gcc_ada_libgnarl_s-taprop____posix.adb,v 1.1 2022/03/13 08:34:04 nia Exp $ + +When using SCHED_OTHER, the minimum and maximum in NetBSD is -1. +In most other OSs it is 0. Change the behaviour to try to set the +params using the default priority, if that fails, use 0, otherwise +use -1. If none are valid, the tasking system will fail if assertions +are on. + +--- gcc/ada/libgnarl/s-taprop__posix.adb.orig 2021-09-23 19:55:24.471842046 +0000 ++++ gcc/ada/libgnarl/s-taprop__posix.adb 2021-09-23 20:01:31.689253592 +0000 +@@ -654,6 +654,16 @@ + else + Result := pthread_setschedparam + (T.Common.LL.Thread, SCHED_OTHER, Param'Access); ++ if Result /= 0 then ++ Param.sched_priority := 0; ++ Result := pthread_setschedparam ++ (T.Common.LL.Thread, SCHED_OTHER, Param'Access); ++ if Result /= 0 then ++ Param.sched_priority := -1; ++ Result := pthread_setschedparam ++ (T.Common.LL.Thread, SCHED_OTHER, Param'Access); ++ end if; ++ end if; + end if; + + pragma Assert (Result = 0); Index: pkgsrc/lang/gcc10-aux/patches/patch-gcc_ada_libgnat_g-socthi.ads diff -u /dev/null pkgsrc/lang/gcc10-aux/patches/patch-gcc_ada_libgnat_g-socthi.ads:1.1 --- /dev/null Sun Mar 13 08:34:05 2022 +++ pkgsrc/lang/gcc10-aux/patches/patch-gcc_ada_libgnat_g-socthi.ads Sun Mar 13 08:34:04 2022 @@ -0,0 +1,24 @@ +$NetBSD: patch-gcc_ada_libgnat_g-socthi.ads,v 1.1 2022/03/13 08:34:04 nia Exp $ + +Fix symbol to make it use the C processed one. + +--- gcc/ada/libgnat/g-socthi.ads.orig 2021-10-09 18:09:40.607907149 +0200 ++++ gcc/ada/libgnat/g-socthi.ads 2021-10-09 18:24:39.373733909 +0200 +@@ -53,8 +53,6 @@ + + package C renames Interfaces.C; + +- use type System.CRTL.ssize_t; +- + function Socket_Errno return Integer renames GNAT.OS_Lib.Errno; + -- Returns last socket error number + +@@ -256,7 +254,7 @@ + pragma Import (C, C_Getsockname, "getsockname"); + pragma Import (C, C_Getsockopt, "getsockopt"); + pragma Import (C, C_Listen, "listen"); +- pragma Import (C, C_Select, "select"); ++ pragma Import (C, C_Select, "__gnat_select"); + pragma Import (C, C_Setsockopt, "setsockopt"); + pragma Import (C, C_Shutdown, "shutdown"); + pragma Import (C, C_Socketpair, "socketpair"); Index: pkgsrc/lang/gcc10-aux/patches/patch-gcc_ada_libgnat_g-socthi____bsd.adb diff -u /dev/null pkgsrc/lang/gcc10-aux/patches/patch-gcc_ada_libgnat_g-socthi____bsd.adb:1.1 --- /dev/null Sun Mar 13 08:34:05 2022 +++ pkgsrc/lang/gcc10-aux/patches/patch-gcc_ada_libgnat_g-socthi____bsd.adb Sun Mar 13 08:34:04 2022 @@ -0,0 +1,363 @@ +$NetBSD: patch-gcc_ada_libgnat_g-socthi____bsd.adb,v 1.1 2022/03/13 08:34:04 nia Exp $ + +Create a g-socthi package that is common to all *BSD systems. + +--- /dev/null 2021-10-09 18:50:23.845256363 +0200 ++++ gcc/ada/libgnat/g-socthi__bsd.adb 2021-10-09 18:07:08.069557825 +0200 +@@ -0,0 +1,356 @@ ++------------------------------------------------------------------------------ ++-- -- ++-- GNAT COMPILER COMPONENTS -- ++-- -- ++-- G N A T . S O C K E T S . T H I N -- ++-- -- ++-- B o d y -- ++-- -- ++-- Copyright (C) 2001-2018, AdaCore -- ++-- -- ++-- GNAT is free software; you can redistribute it and/or modify it under -- ++-- terms of the GNU General Public License as published by the Free Soft- -- ++-- ware Foundation; either version 3, or (at your option) any later ver- -- ++-- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- ++-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- ++-- or FITNESS FOR A PARTICULAR PURPOSE. -- ++-- -- ++-- As a special exception 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 -- ++-- . -- ++-- -- ++-- GNAT was originally developed by the GNAT team at New York University. -- ++-- Extensive contributions were provided by Ada Core Technologies Inc. -- ++-- -- ++------------------------------------------------------------------------------ ++ ++-- This package provides a target dependent thin interface to the sockets ++-- layer for use by the GNAT.Sockets package (g-socket.ads). This package ++-- should not be directly with'ed by an applications program. ++ ++-- This is the *BSD version which uses fcntl rather than ioctl ++-- The constant SCON.Thread_Blocking_IO is always true (for all platforms, not ++-- just *BSD), so this binding is significantly simpler than the standard ++-- one it replaces. ++ ++with GNAT.OS_Lib; use GNAT.OS_Lib; ++ ++with Interfaces.C; use Interfaces.C; ++ ++package body GNAT.Sockets.Thin is ++ ++ function Syscall_Accept ++ (S : C.int; ++ Addr : System.Address; ++ Addrlen : not null access C.int) return C.int; ++ pragma Import (C, Syscall_Accept, "accept"); ++ -- The accept() function accepts a connection on a socket. An incoming ++ -- connection is acknowledged and associated with an immediately created ++ -- socket. The original socket is returned to the listening state. ++ ++ function Syscall_Connect ++ (S : C.int; ++ Name : System.Address; ++ Namelen : C.int) return C.int; ++ pragma Import (C, Syscall_Connect, "connect"); ++ -- The connect() system call initiates a connection on a socket. If the ++ -- parameter S is of type SOCK_DGRAM then connect() permanently specifies ++ -- the peer to which datagrams are to be sent. If S is type SOCK_STREAM ++ -- then connect() attempts to make a connection with another socket, which ++ -- is identified by the parameter Name. ++ ++ function Syscall_Recv ++ (S : C.int; ++ Msg : System.Address; ++ Len : C.int; ++ Flags : C.int) return C.int; ++ pragma Import (C, Syscall_Recv, "recv"); ++ -- The recv() function receives a message from a socket. The call can be ++ -- used on a connection mode socket or a bound, connectionless socket. If ++ -- no messages are available at the socket, the recv() call waits for a ++ -- message to arrive unless the socket is non-blocking. If a socket is ++ -- non-blocking, the call returns a -1 and ERRNO is set to EWOULDBLOCK. ++ ++ function Syscall_Recvfrom ++ (S : C.int; ++ Msg : System.Address; ++ Len : C.int; ++ Flags : C.int; ++ From : System.Address; ++ Fromlen : not null access C.int) return C.int; ++ pragma Import (C, Syscall_Recvfrom, "recvfrom"); ++ -- The recvfrom() system call receives a message from a socket and captures ++ -- the address from which the data was sent. It can be used to receive ++ -- data on an unconnected socket as well. If no messages are available, ++ -- the call waits for a message to arrive on blocking sockets. For ++ -- non-blocking sockets without messages, -1 is returned and ERRNO is set ++ -- to EAGAIN or EWOULDBLOCK. ++ ++ function Syscall_Recvmsg ++ (S : C.int; ++ Msg : System.Address; ++ Flags : C.int) return System.CRTL.ssize_t; ++ pragma Import (C, Syscall_Recvmsg, "recvmsg"); ++ -- The recvmsg call receives a message from a socket, and can be used to ++ -- receive data on an unconnected socket as well. If no messages are ++ -- available, the call waits for a message to arrive on blocking sockets. ++ -- For non-blocking sockets without messages, -1 is returned and ERRNO is ++ -- set to EAGAIN or EWOULDBLOCK. ++ ++ function Syscall_Sendmsg ++ (S : C.int; ++ Msg : System.Address; ++ Flags : C.int) return System.CRTL.ssize_t; ++ pragma Import (C, Syscall_Sendmsg, "sendmsg"); ++ -- The sendmsg() function sends a message to a socket, and can be used with ++ -- unconnected sockets as well (the msg is ignored in this case). The ++ -- function returns the number of bytes sent when successful, otherwise it ++ -- returns -1 and ERRNO is set (many possible values). ++ ++ function Syscall_Sendto ++ (S : C.int; ++ Msg : System.Address; ++ Len : C.int; ++ Flags : C.int; ++ To : System.Address; ++ Tolen : C.int) return C.int; ++ pragma Import (C, Syscall_Sendto, "sendto"); ++ -- The sendto() function only works for connected sockets and it initiates ++ -- the transmission of a message. A successful call returns the numbers of ++ -- bytes sent, and a failure returns a -1 and ERRNO is set. ++ ++ function Syscall_Socket ++ (Domain : C.int; ++ Typ : C.int; ++ Protocol : C.int) return C.int; ++ pragma Import (C, Syscall_Socket, "__gnat_socket"); ++ -- The socket() function is used to create an unbound socket and returns a ++ -- file descriptor that can be used with other socket functions. Upon ++ -- failure, a -1 is returned and ERRNO is set. ++ ++ procedure Disable_SIGPIPE (S : C.int); ++ pragma Import (C, Disable_SIGPIPE, "__gnat_disable_sigpipe"); ++ ++ procedure Disable_All_SIGPIPEs; ++ pragma Import (C, Disable_All_SIGPIPEs, "__gnat_disable_all_sigpipes"); ++ -- Sets the process to ignore all SIGPIPE signals on platforms that ++ -- don't support Disable_SIGPIPE for particular streams. ++ ++ function C_Fcntl ++ (Fd : C.int; ++ Cmd : C.int; ++ Val : C.int) return C.int; ++ pragma Import (C, C_Fcntl, "fcntl"); ++ -- The ioctl of 64-bit DragonFlyBSD, OpenBSD, and NetBSD does not support ++ -- setting a socket in non-blocking mode. fcntl must be used instead. ++ ++ -------------- ++ -- C_Accept -- ++ -------------- ++ ++ function C_Accept ++ (S : C.int; ++ Addr : System.Address; ++ Addrlen : not null access C.int) return C.int ++ is ++ R : constant C.int := Syscall_Accept (S, Addr, Addrlen); ++ begin ++ ++ Disable_SIGPIPE (R); ++ return R; ++ end C_Accept; ++ ++ --------------- ++ -- C_Connect -- ++ --------------- ++ ++ function C_Connect ++ (S : C.int; ++ Name : System.Address; ++ Namelen : C.int) return C.int ++ is ++ begin ++ return Syscall_Connect (S, Name, Namelen); ++ end C_Connect; ++ ++ ------------------ ++ -- Socket_Ioctl -- ++ ------------------ ++ ++ function Socket_Ioctl ++ (S : C.int; ++ Req : SOSC.IOCTL_Req_T; ++ Arg : access C.int) return C.int ++ is ++ begin ++ if Req = SOSC.FIONBIO then ++ declare ++ use Interfaces; ++ flags : constant Unsigned_32 := ++ Unsigned_32 (C_Fcntl (S, SOSC.F_GETFL, 0)); ++ nonblock : constant Unsigned_32 := Unsigned_32 (SOSC.O_NDELAY); ++ enabled : constant Boolean := Arg.all = 1; ++ newval : C.int := C.int (flags); ++ begin ++ if enabled then ++ newval := C.int (flags or nonblock); ++ elsif (flags and nonblock) > 0 then ++ newval := C.int (flags - nonblock); ++ end if; ++ return C_Fcntl (Fd => S, Cmd => SOSC.F_SETFL, Val => newval); ++ end; ++ end if; ++ ++ return C_Ioctl (S, Req, Arg); ++ end Socket_Ioctl; ++ ++ ------------ ++ -- C_Recv -- ++ ------------ ++ ++ function C_Recv ++ (S : C.int; ++ Msg : System.Address; ++ Len : C.int; ++ Flags : C.int) return C.int ++ is ++ begin ++ return Syscall_Recv (S, Msg, Len, Flags); ++ end C_Recv; ++ ++ ---------------- ++ -- C_Recvfrom -- ++ ---------------- ++ ++ function C_Recvfrom ++ (S : C.int; ++ Msg : System.Address; ++ Len : C.int; ++ Flags : C.int; ++ From : System.Address; ++ Fromlen : not null access C.int) return C.int ++ is ++ begin ++ return Syscall_Recvfrom (S, Msg, Len, Flags, From, Fromlen); ++ end C_Recvfrom; ++ ++ --------------- ++ -- C_Recvmsg -- ++ --------------- ++ ++ function C_Recvmsg ++ (S : C.int; ++ Msg : System.Address; ++ Flags : C.int) return System.CRTL.ssize_t ++ is ++ begin ++ return Syscall_Recvmsg (S, Msg, Flags); ++ end C_Recvmsg; ++ ++ --------------- ++ -- C_Sendmsg -- ++ --------------- ++ ++ function C_Sendmsg ++ (S : C.int; ++ Msg : System.Address; ++ Flags : C.int) return System.CRTL.ssize_t ++ is ++ begin ++ return Syscall_Sendmsg (S, Msg, Flags); ++ end C_Sendmsg; ++ ++ -------------- ++ -- C_Sendto -- ++ -------------- ++ ++ function C_Sendto ++ (S : C.int; ++ Msg : System.Address; ++ Len : C.int; ++ Flags : C.int; ++ To : System.Address; ++ Tolen : C.int) return C.int ++ is ++ begin ++ return Syscall_Sendto (S, Msg, Len, Flags, To, Tolen); ++ end C_Sendto; ++ ++ -------------- ++ -- C_Socket -- ++ -------------- ++ ++ function C_Socket ++ (Domain : C.int; ++ Typ : C.int; ++ Protocol : C.int) return C.int ++ is ++ R : constant C.int := Syscall_Socket (Domain, Typ, Protocol); ++ begin ++ Disable_SIGPIPE (R); ++ return R; ++ end C_Socket; ++ ++ -------------- ++ -- Finalize -- ++ -------------- ++ ++ procedure Finalize is ++ begin ++ null; ++ end Finalize; ++ ++ ------------------------- ++ -- Host_Error_Messages -- ++ ------------------------- ++ ++ package body Host_Error_Messages is separate; ++ ++ ---------------- ++ -- Initialize -- ++ ---------------- ++ ++ procedure Initialize is ++ begin ++ Disable_All_SIGPIPEs; ++ end Initialize; ++ ++ -------------------- ++ -- Signalling_Fds -- ++ -------------------- ++ ++ package body Signalling_Fds is ++ ++ -- In this default implementation, we use a C version of these ++ -- subprograms provided by socket.c. ++ ++ function C_Create (Fds : not null access Fd_Pair) return C.int; ++ function C_Read (Rsig : C.int) return C.int; ++ function C_Write (Wsig : C.int) return C.int; ++ procedure C_Close (Sig : C.int); ++ ++ pragma Import (C, C_Create, "__gnat_create_signalling_fds"); ++ pragma Import (C, C_Read, "__gnat_read_signalling_fd"); ++ pragma Import (C, C_Write, "__gnat_write_signalling_fd"); ++ pragma Import (C, C_Close, "__gnat_close_signalling_fd"); ++ ++ function Create ++ (Fds : not null access Fd_Pair) return C.int renames C_Create; ++ function Read (Rsig : C.int) return C.int renames C_Read; ++ function Write (Wsig : C.int) return C.int renames C_Write; ++ procedure Close (Sig : C.int) renames C_Close; ++ ++ end Signalling_Fds; ++ ++ -------------------------- ++ -- Socket_Error_Message -- ++ -------------------------- ++ ++ function Socket_Error_Message (Errno : Integer) return String is separate; ++ ++end GNAT.Sockets.Thin; Index: pkgsrc/lang/gcc10-aux/patches/patch-gcc_ada_libgnat_s-osprim____posix.adb diff -u /dev/null pkgsrc/lang/gcc10-aux/patches/patch-gcc_ada_libgnat_s-osprim____posix.adb:1.1 --- /dev/null Sun Mar 13 08:34:05 2022 +++ pkgsrc/lang/gcc10-aux/patches/patch-gcc_ada_libgnat_s-osprim____posix.adb Sun Mar 13 08:34:04 2022 @@ -0,0 +1,24 @@ +$NetBSD: patch-gcc_ada_libgnat_s-osprim____posix.adb,v 1.1 2022/03/13 08:34:04 nia Exp $ + +Use C preprocessed symbols. + +--- gcc/ada/libgnat/s-osprim__posix.adb.orig 2021-10-09 19:24:46.671910328 +0200 ++++ gcc/ada/libgnat/s-osprim__posix.adb 2021-10-09 19:28:33.938823233 +0200 +@@ -47,7 +47,7 @@ + pragma Convention (C, timespec); + + function nanosleep (rqtp, rmtp : not null access timespec) return Integer; +- pragma Import (C, nanosleep, "nanosleep"); ++ pragma Import (C, nanosleep, "__gnat_nanosleep"); + + ----------- + -- Clock -- +@@ -77,7 +77,7 @@ + function gettimeofday + (Tv : access timeval; + Tz : System.Address := System.Null_Address) return Integer; +- pragma Import (C, gettimeofday, "gettimeofday"); ++ pragma Import (C, gettimeofday, "__gnat_gettimeofday"); + + begin + -- The return codes for gettimeofday are as follows (from man pages): Index: pkgsrc/lang/gcc10-aux/patches/patch-gcc_ada_s-oscons-tmplt.c diff -u /dev/null pkgsrc/lang/gcc10-aux/patches/patch-gcc_ada_s-oscons-tmplt.c:1.1 --- /dev/null Sun Mar 13 08:34:05 2022 +++ pkgsrc/lang/gcc10-aux/patches/patch-gcc_ada_s-oscons-tmplt.c Sun Mar 13 08:34:04 2022 @@ -0,0 +1,94 @@ +$NetBSD: patch-gcc_ada_s-oscons-tmplt.c,v 1.1 2022/03/13 08:34:04 nia Exp $ + +Add NetBSD to some defined parts and bump the version of +_XOPEN_SOURCE and add _NETBSD_SOURCE. + +--- gcc/ada/s-oscons-tmplt.c.orig 2021-04-08 13:56:27.913738795 +0200 ++++ gcc/ada/s-oscons-tmplt.c 2021-10-09 18:26:07.630440685 +0200 +@@ -86,16 +86,25 @@ + ** a number of non-POSIX but useful/required features. + **/ + +-#if defined (__linux__) || defined (__ANDROID__) ++#if defined (__linux__) || defined (__ANDROID__) \ ++ || defined (__FreeBSD__) || defined (__NetBSD__) \ ++ || defined (__DragonFly__) || defined (__OpenBSD__) + + /* Define _XOPEN_SOURCE to get IOV_MAX */ ++/* We use 520 since NetBSD does not include getaddrinfo flags with only 500 */ + # if !defined (_XOPEN_SOURCE) +-# define _XOPEN_SOURCE 500 ++# define _XOPEN_SOURCE 520 + # endif + + /* Define _BSD_SOURCE to get CRTSCTS */ + # define _BSD_SOURCE + ++/* NetBSD requires _NETBSD_SOURCE to be defined in order to include */ ++/* NI_MAX{HOST,SERV} correctly */ ++# if defined (__NetBSD__) ++# define _NETBSD_SOURCE ++# endif ++ + #endif /* defined (__linux__) */ + + /* Include gsocket.h before any system header so it can redefine FD_SETSIZE */ +@@ -158,7 +167,8 @@ + #endif + + #if defined (__linux__) || defined (__ANDROID__) || defined (__QNX__) \ +- || defined (__rtems__) ++ || defined (__rtems__) || defined (__FreeBSD__) || defined (__NetBSD__) \ ++ || defined (__OpenBSD__) || defined (__DragonFly__) + # include + # include + #endif +@@ -406,11 +416,14 @@ + + */ + +-/* ioctl(2) requests are "int" in UNIX, but "unsigned long" on FreeBSD */ ++/* ioctl(2) requests are "int" in UNIX, but "unsigned long" on FreeBSD ++ and NetBSD ++*/ + +-#if defined (__FreeBSD__) || defined (__DragonFly__) ++#if defined (__FreeBSD__) || defined (__DragonFly__) || defined (__NetBSD__) \ ++ || defined (__OpenBSD__) + # define CNI CNU +-# define IOCTL_Req_T "Interfaces.C.unsigned" ++# define IOCTL_Req_T "Interfaces.C.unsigned_long" + #else + # define CNI CND + # define IOCTL_Req_T "Interfaces.C.int" +@@ -1020,7 +1033,8 @@ + + */ + +-#if defined (__FreeBSD__) || defined (__linux__) || defined (__DragonFly__) ++#if defined (__FreeBSD__) || defined (__linux__) || defined (__DragonFly__) \ ++ || defined (__NetBSD__) || defined (__OpenBSD__) + # define PTY_Library "-lutil" + #else + # define PTY_Library "" +@@ -1833,7 +1847,8 @@ + + #if defined(__linux__) || defined(__FreeBSD__) \ + || (defined(_AIX) && defined(_AIXVERSION_530)) \ +- || defined(__DragonFly__) || defined(__QNX__) ++ || defined(__DragonFly__) || defined(__QNX__) \ ++ || defined (__NetBSD__) || defined (__OpenBSD__) + /** On these platforms use system provided monotonic clock instead of + ** the default CLOCK_REALTIME. We then need to set up cond var attributes + ** appropriately (see thread.c). +@@ -1855,7 +1870,9 @@ + #endif + + #if defined (__APPLE__) || defined (__linux__) || defined (__ANDROID__) \ +- || defined (__QNX__) || defined (__rtems__) || defined (DUMMY) ++ || defined (__QNX__) || defined (__rtems__) || defined (DUMMY) \ ++ || defined (__FreeBSD__) || defined (__DragonFly__) \ ++ || defined (__NetBSD__) || defined (__OpenBSD__) + /* + + -- Sizes of pthread data types Index: pkgsrc/lang/gcc10-aux/patches/patch-gcc_ada_sysdep.c diff -u /dev/null pkgsrc/lang/gcc10-aux/patches/patch-gcc_ada_sysdep.c:1.1 --- /dev/null Sun Mar 13 08:34:05 2022 +++ pkgsrc/lang/gcc10-aux/patches/patch-gcc_ada_sysdep.c Sun Mar 13 08:34:04 2022 @@ -0,0 +1,42 @@ +$NetBSD: patch-gcc_ada_sysdep.c,v 1.1 2022/03/13 08:34:04 nia Exp $ + +Add NetBSD to some defined sections. + +--- gcc/ada/sysdep.c.orig 2021-08-28 13:11:25.681014624 +0000 ++++ gcc/ada/sysdep.c 2021-08-28 13:21:14.748176113 +0000 +@@ -320,7 +320,7 @@ + || (defined (__svr4__) && defined (__i386__)) || defined (__Lynx__) \ + || defined (__CYGWIN__) || defined (__FreeBSD__) || defined (__OpenBSD__) \ + || defined (__GLIBC__) || defined (__APPLE__) || defined (__DragonFly__) \ +- || defined (__QNX__) ++ || defined (__QNX__) || defined (__NetBSD__) + + # ifdef __MINGW32__ + # if OLD_MINGW +@@ -373,7 +373,7 @@ + || defined (_AIX) || (defined (__svr4__) && defined (__i386__)) \ + || defined (__Lynx__) || defined (__FreeBSD__) || defined (__OpenBSD__) \ + || defined (__GLIBC__) || defined (__APPLE__) || defined (__DragonFly__) \ +- || defined (__QNX__) ++ || defined (__QNX__) || defined (__NetBSD__) + char c; + int nread; + int good_one = 0; +@@ -394,7 +394,7 @@ + || defined (_AIX) || (defined (__svr4__) && defined (__i386__)) \ + || defined (__Lynx__) || defined (__FreeBSD__) || defined (__OpenBSD__) \ + || defined (__GLIBC__) || defined (__APPLE__) || defined (__DragonFly__) \ +- || defined (__QNX__) ++ || defined (__QNX__) || defined (__NetBSD__) + eof_ch = termios_rec.c_cc[VEOF]; + + /* If waiting (i.e. Get_Immediate (Char)), set MIN = 1 and wait for +@@ -831,7 +831,7 @@ + + #elif defined (__APPLE__) || defined (__FreeBSD__) || defined (__linux__) \ + || defined (__GLIBC__) || defined (__DragonFly__) || defined (__OpenBSD__) \ +- || defined (__DJGPP__) || defined (__QNX__) ++ || defined (__DJGPP__) || defined (__QNX__) || defined (__NetBSD__) + { + localtime_r (timer, &tp); + *off = tp.tm_gmtoff; Index: pkgsrc/lang/gcc10-aux/patches/patch-gcc_config.gcc diff -u /dev/null pkgsrc/lang/gcc10-aux/patches/patch-gcc_config.gcc:1.1 --- /dev/null Sun Mar 13 08:34:05 2022 +++ pkgsrc/lang/gcc10-aux/patches/patch-gcc_config.gcc Sun Mar 13 08:34:04 2022 @@ -0,0 +1,247 @@ +$NetBSD: patch-gcc_config.gcc,v 1.1 2022/03/13 08:34:04 nia 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 11:56:28.000000000 +0000 ++++ gcc/config.gcc +@@ -462,6 +462,16 @@ m32r*-*-*) + cpu_type=m32r + extra_options="${extra_options} g.opt" + ;; ++m5200-*-*|m5407-*-*) ++ cpu_type=m68k ++ extra_headers=math-68881.h ++ extra_options="${extra_options} m68k/m68k-tables.opt" ++ ;; ++m680[012]0-*-*) ++ cpu_type=m68k ++ extra_headers=math-68881.h ++ extra_options="${extra_options} m68k/m68k-tables.opt" ++ ;; + m68k-*-*) + extra_headers=math-68881.h + extra_options="${extra_options} m68k/m68k-tables.opt" +@@ -691,7 +701,7 @@ case ${target} in + *-*-darwin[4-9]* | *-*-darwin1[0-9]*) + macos_min=`expr $darwin_maj - 4` + ;; +- *-*-darwin20*) ++ *-*-darwin2[01]*) + # Darwin 20 corresponds to macOS 11. + macos_maj=11 + def_ld64=609.0 +@@ -877,6 +887,11 @@ case ${target} in + case ${enable_threads} in + "" | yes | posix) thread_file='posix' ;; + esac ++ case ${target} in ++ arm*-* | i[34567]86-* | powerpc*-* | sparc*-* | x86_64-*) ++ default_gnu_indirect_function=yes ++ ;; ++ esac + nbsd_tm_file="netbsd.h netbsd-stdint.h netbsd-elf.h" + default_use_cxa_atexit=yes + target_has_targetdm=yes +@@ -1111,6 +1126,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" ++ case $target in ++ aarch64_be-*) ++ tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1" ++ ;; ++ esac + ;; + aarch64*-*-linux*) + tm_file="${tm_file} dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h" +@@ -1252,7 +1272,6 @@ arm*-*-freebsd*) # ARM Fr + with_tls=${with_tls:-gnu} + ;; + arm*-*-netbsdelf*) +- target_cpu_cname="strongarm" + 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,33 @@ arm*-*-netbsdelf*) + esac + case ${target} in + arm*-*-netbsdelf-*eabi*) +- tm_file="$tm_file arm/bpabi.h arm/netbsd-elf.h arm/netbsd-eabi.h" +- tmake_file="$tmake_file arm/t-bpabi arm/t-netbsdeabi" ++ tm_file="${tm_file} arm/bpabi.h arm/netbsd-elf.h arm/netbsd-eabi.h" ++ # GCC 7 vs NetBSD/eabi -> avoid arm unwinder ++ #tmake_file="$tmake_file arm/t-bpabi" ++ tmake_file="$tmake_file arm/t-netbsdeabi" ++ # The EABI requires the use of __cxa_atexit. ++ default_use_cxa_atexit=yes + ;; + *) +- tm_file="$tm_file arm/netbsd-elf.h" ++ tm_file="$tm_file arm/bpabi.h arm/netbsd-elf.h" ++ #tmake_file="$tmake_file arm/t-bpabi arm/t-netbsdeabi" + tmake_file="$tmake_file arm/t-netbsd" + ;; + esac + tm_file="${tm_file} arm/aout.h arm/arm.h" + case ${target} in + arm*-*-netbsdelf-*eabihf*) +- # Hard-float requires at least Arm v5te +- target_cpu_cname="arm10e" + tm_defines="${tm_defines} TARGET_DEFAULT_FLOAT_ABI=ARM_FLOAT_ABI_HARD" + ;; + esac + case ${target} in +- armv6*) target_cpu_cname="arm1176jzf-s";; +- armv7*) target_cpu_cname="generic-armv7-a";; ++ armv4*) with_cpu=${with_cpu:-strongarm};; ++ armv6*) with_cpu=${with_cpu:-arm1176jzf-s};; ++ armv7*) with_cpu=${with_cpu:-cortex-a8};; ++ arm*eabihf*) with_cpu=${with_cpu:-arm10e};; ++ arm*) with_cpu=${with_cpu:-arm9e};; + esac ++ target_cpu_cname="$with_cpu" + ;; + 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 +1954,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" ++ tmake_file="${tmake_file} i386/t-netbsd64" + extra_options="${extra_options} netbsd.opt netbsd-elf.opt" + ;; + i[34567]86-*-openbsd*) +@@ -2250,6 +2277,16 @@ ia64*-*-elf*) + target_cpu_default="${target_cpu_default}|MASK_GNU_LD" + fi + ;; ++ia64*-*-netbsd*) ++ tm_file="${tm_file} dbxelf.h elfos.h ${nbsd_tm_file} ia64/sysv4.h ia64/netbsd.h" ++ target_cpu_default="MASK_GNU_AS|MASK_GNU_LD" ++ tmake_file="${tmake_file} ia64/t-ia64" ++ if test x$with_system_libunwind != xyes ; then ++ tmake_file="${tmake_file} t-libunwind-elf ia64/t-glibc-libunwind" ++ fi ++ extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o crtfastmath.o" ++ extra_options="${extra_options} netbsd.opt netbsd-elf.opt" ++ ;; + 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 +2399,25 @@ m68k-*-elf* | fido-*-elf*) + ;; + esac + ;; +-m68k*-*-netbsdelf*) ++m68010-*-netbsdelf* | m68k-*-netbsdelf* | m5407-*-netbsdelf*) + default_m68k_cpu=68020 ++ case ${target} in ++ m5407*) ++ with_arch=${with_arch:-cf} ++ target_cpu_default="mcf5475" ++# target="`echo ${target} | sed 's/m68kcf/m68k/'`" ++ ;; ++ m68010*) ++ target_cpu_default="m68010" ++ tmake_file="${tmake_file} m68k/t-m68kelf m68k/t-m68010-netbsd" ++ default_m68k_cpu=68010 ++ tmake_file="${tmake_file} m68k/t-floatlib" ++ ;; ++ *) ++ with_arch=${with_arch:-m68k} ++ tmake_file="${tmake_file} m68k/t-floatlib" ++ ;; ++ esac + 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 +2557,26 @@ riscv*-*-freebsd*) + # automatically detect that GAS supports it, yet we require it. + gcc_cv_initfini_array=yes + ;; ++riscv*-*-netbsd*) # NetBSD RISC-V ++ tm_file="elfos.h ${tm_file} ${nbsd_tm_file} riscv/netbsd.h" ++ tm_defines="${tm_defines} CHAR_FAST8=1 SHORT_FAST16=1" ++ case ${target} in ++ riscv32*) tm_defines="${tm_defines} TARGET_64BIT_DEFAULT=0" ;; ++ *) tmake_file="${tmake_file} riscv/t-netbsd64" ;; ++ esac ++ extra_options="${extra_options} netbsd.opt netbsd-elf.opt" ++ tmake_file="${tmake_file} riscv/t-riscv" ++ gnu_ld=yes ++ gas=yes ++ gcc_cv_initfini_array=yes ++ ;; ++mips64*-*-netbsd*) # NetBSD/mips64, either endian. ++ target_cpu_default="MASK_ABICALLS|MASK_FLOAT64|MASK_SOFT_FLOAT_ABI" ++ tm_file="elfos.h ${tm_file} mips/elf.h ${nbsd_tm_file} mips/netbsd.h mips/netbsd64.h" ++ tmake_file="${tmake_file} mips/t-netbsd64" ++ tm_defines="${tm_defines} MIPS_ABI_DEFAULT=ABI_N32" ++ extra_options="${extra_options} netbsd.opt netbsd-elf.opt" ++ ;; + 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 +2992,24 @@ powerpc*-*-freebsd*) + ;; + esac + ;; +-powerpc-*-netbsd*) +- tm_file="${tm_file} dbxelf.h elfos.h gnu-user.h ${nbsd_tm_file} freebsd-spec.h rs6000/sysv4.h rs6000/netbsd.h" ++powerpc*-*-netbsd*) ++ tm_file="${tm_file} dbxelf.h elfos.h gnu-user.h ${nbsd_tm_file} freebsd-spec.h" ++ case ${target} in ++ powerpc64*) ++ tm_file="rs6000/biarch64.h ${tm_file}" ++ tm_file="${tm_file} rs6000/sysv4.h rs6000/default64.h rs6000/netbsd64.h" ++ tmake_file="${tmake_file} rs6000/t-netbsd64" ++ ;; ++ *) ++ tm_file="${tm_file} rs6000/sysv4.h rs6000/netbsd.h" ++ tmake_file="${tmake_file} rs6000/t-netbsd" ++ ;; ++ esac + extra_options="${extra_options} netbsd.opt netbsd-elf.opt" +- tmake_file="${tmake_file} rs6000/t-netbsd" +- extra_options="${extra_options} rs6000/sysv4.opt" ++ extra_options="${extra_options} rs6000/sysv4.opt rs6000/linux64.opt" ++ if test x${enable_secureplt} != xno; then ++ tm_file="rs6000/secureplt.h ${tm_file}" ++ fi + ;; + 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 +3481,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" ++ tm_file="${tm_file} sparc/default64.h" + extra_options="${extra_options} netbsd.opt netbsd-elf.opt" + extra_options="${extra_options} sparc/long-double-switch.opt" + tmake_file="${tmake_file} sparc/t-sparc sparc/t-netbsd64" ++ with_cpu=ultrasparc + ;; + sparc64-*-openbsd*) + tm_file="sparc/openbsd1-64.h ${tm_file} dbxelf.h elfos.h sparc/sysv4.h sparc/sp64-elf.h" +@@ -3911,6 +4000,9 @@ if test x$with_cpu = x ; then + frv550-*-*linux*) + with_cpu=fr550 + ;; ++ m5200-*-*|m5407-*-*) ++ with_cpu=${default_cf_cpu} ++ ;; + m68k*-*-*) + case "$with_arch" in + "cf") +@@ -4421,7 +4513,7 @@ case "${target}" in + esac + ;; + +- fido-*-* | m68k*-*-*) ++ fido-*-* | m68k*-*-* | m5200-*-* | m5407-*-*) + supported_defaults="arch cpu" + case "$with_arch" in + "" | "m68k"| "cf") Index: pkgsrc/lang/gcc10-aux/patches/patch-gcc_config.host diff -u /dev/null pkgsrc/lang/gcc10-aux/patches/patch-gcc_config.host:1.1 --- /dev/null Sun Mar 13 08:34:05 2022 +++ pkgsrc/lang/gcc10-aux/patches/patch-gcc_config.host Sun Mar 13 08:34:04 2022 @@ -0,0 +1,15 @@ +$NetBSD: patch-gcc_config.host,v 1.1 2022/03/13 08:34:04 nia Exp $ + +Add aarch64*-*-netbsd*. + +--- gcc/config.host.orig 2020-07-23 06:35:17.316384243 +0000 ++++ gcc/config.host +@@ -99,7 +99,7 @@ case ${host} in + esac + + case ${host} in +- aarch64*-*-freebsd* | aarch64*-*-linux* | aarch64*-*-fuchsia*) ++ aarch64*-*-freebsd* | aarch64*-*-netbsd* | aarch64*-*-linux* | aarch64*-*-fuchsia*) + case ${target} in + aarch64*-*-*) + host_extra_gcc_objs="driver-aarch64.o" Index: pkgsrc/lang/gcc10-aux/patches/patch-gcc_config_aarch64_aarch64-builtins.c diff -u /dev/null pkgsrc/lang/gcc10-aux/patches/patch-gcc_config_aarch64_aarch64-builtins.c:1.1 --- /dev/null Sun Mar 13 08:34:05 2022 +++ pkgsrc/lang/gcc10-aux/patches/patch-gcc_config_aarch64_aarch64-builtins.c Sun Mar 13 08:34:04 2022 @@ -0,0 +1,18 @@ +$NetBSD: patch-gcc_config_aarch64_aarch64-builtins.c,v 1.1 2022/03/13 08:34:04 nia Exp $ + +initialise subtarget builtins so cabs*() are renamed. +https://gcc.gnu.org/pipermail/gcc-patches/2021-February/565289.html + +--- gcc/config/aarch64/aarch64-builtins.c.orig 2017-01-20 21:03:41.000000000 +0000 ++++ gcc/config/aarch64/aarch64-builtins.c 2018-11-10 00:44:41.905576216 +0000 +@@ -1303,6 +1303,10 @@ aarch64_general_init_builtins (void) + + if (TARGET_MEMTAG) + aarch64_init_memtag_builtins (); ++ ++#ifdef SUBTARGET_INIT_BUILTINS ++ SUBTARGET_INIT_BUILTINS; ++#endif + } + + /* Implement TARGET_BUILTIN_DECL for the AARCH64_BUILTIN_GENERAL group. */ Index: pkgsrc/lang/gcc10-aux/patches/patch-gcc_config_aarch64_aarch64-netbsd.h diff -u /dev/null pkgsrc/lang/gcc10-aux/patches/patch-gcc_config_aarch64_aarch64-netbsd.h:1.1 --- /dev/null Sun Mar 13 08:34:05 2022 +++ pkgsrc/lang/gcc10-aux/patches/patch-gcc_config_aarch64_aarch64-netbsd.h Sun Mar 13 08:34:04 2022 @@ -0,0 +1,18 @@ +$NetBSD: patch-gcc_config_aarch64_aarch64-netbsd.h,v 1.1 2022/03/13 08:34:04 nia Exp $ + +Match what is in NetBSD src. Fixes at least aarch64eb, and +probably several others. + +--- gcc/config/aarch64/aarch64-netbsd.h.orig 2021-04-08 04:56:28.033740243 -0700 ++++ gcc/config/aarch64/aarch64-netbsd.h 2021-04-24 00:16:41.451665444 -0700 +@@ -20,6 +20,10 @@ + #ifndef GCC_AARCH64_NETBSD_H + #define GCC_AARCH64_NETBSD_H + ++/* NetBSD malloc(3) does 64, not 128 bytes. */ ++#undef MALLOC_ABI_ALIGNMENT ++#define MALLOC_ABI_ALIGNMENT 64 ++ + #define TARGET_LINKER_BIG_EMULATION "aarch64nbsdb" + #define TARGET_LINKER_LITTLE_EMULATION "aarch64nbsd" + Index: pkgsrc/lang/gcc10-aux/patches/patch-gcc_config_aarch64_driver-aarch64.c diff -u /dev/null pkgsrc/lang/gcc10-aux/patches/patch-gcc_config_aarch64_driver-aarch64.c:1.1 --- /dev/null Sun Mar 13 08:34:05 2022 +++ pkgsrc/lang/gcc10-aux/patches/patch-gcc_config_aarch64_driver-aarch64.c Sun Mar 13 08:34:04 2022 @@ -0,0 +1,184 @@ +$NetBSD: patch-gcc_config_aarch64_driver-aarch64.c,v 1.1 2022/03/13 08:34:04 nia Exp $ + +Match what is in NetBSD src. Fixes at least aarch64eb, and +probably several others. + +--- gcc/config/aarch64/driver-aarch64.c.orig 2021-04-08 04:56:28.041740341 -0700 ++++ gcc/config/aarch64/driver-aarch64.c 2021-04-24 00:16:45.471750258 -0700 +@@ -25,6 +25,7 @@ + #include "system.h" + #include "coretypes.h" + #include "tm.h" ++#include "diagnostic-core.h" + + /* Defined in common/config/aarch64/aarch64-common.c. */ + std::string aarch64_get_extension_string_for_isa_flags (uint64_t, uint64_t); +@@ -244,6 +245,14 @@ + ARGC and ARGV are set depending on the actual arguments given + in the spec. */ + ++#ifdef __NetBSD__ ++/* The NetBSD/arm64 platform may not export linux-style /proc/cpuinfo, ++ but the data is available via a sysctl(3) interface. */ ++#include ++#include ++#include ++#endif ++ + const char * + host_detect_local_cpu (int argc, const char **argv) + { +@@ -282,6 +291,7 @@ + if (!arch && !tune && !cpu) + goto not_found; + ++#ifndef __NetBSD__ + fcpu_info = getenv ("GCC_CPUINFO"); + if (fcpu_info) + f = fopen (fcpu_info, "r"); +@@ -374,6 +384,145 @@ + + fclose (f); + f = NULL; ++#else ++ unsigned int curcpu; ++ size_t len; ++ char impl_buf[8]; ++ int mib[2], ncpu; ++ ++ mib[0] = CTL_HW; ++ mib[1] = HW_NCPU; ++ len = sizeof(ncpu); ++ if (sysctl(mib, 2, &ncpu, &len, NULL, 0) == -1) ++ goto not_found; ++ ++ for (curcpu = 0; curcpu < ncpu; curcpu++) ++ { ++ char path[128]; ++ struct aarch64_sysctl_cpu_id id; ++ ++ len = sizeof id; ++ snprintf(path, sizeof path, "machdep.cpu%d.cpu_id", curcpu); ++ if (sysctlbyname(path, &id, &len, NULL, 0) != 0) ++ goto not_found; ++ ++ unsigned cimp = __SHIFTOUT(id.ac_midr, MIDR_EL1_IMPL); ++ if (cimp == INVALID_IMP) ++ goto not_found; ++ ++ if (imp == INVALID_IMP) ++ imp = cimp; ++ /* FIXME: BIG.little implementers are always equal. */ ++ else if (imp != cimp) ++ goto not_found; ++ ++ unsigned cvariant = __SHIFTOUT(id.ac_midr, MIDR_EL1_VARIANT); ++ if (!contains_core_p (variants, cvariant)) ++ { ++ if (n_variants == 2) ++ goto not_found; ++ ++ variants[n_variants++] = cvariant; ++ } ++ ++ unsigned ccore = __SHIFTOUT(id.ac_midr, MIDR_EL1_PARTNUM); ++ if (!contains_core_p (cores, ccore)) ++ { ++ if (n_cores == 2) ++ goto not_found; ++ ++ cores[n_cores++] = ccore; ++ } ++ ++ if (!tune && !processed_exts) ++ { ++ std::string exts; ++ ++ /* These are all the extensions from aarch64-option-extensions.def. */ ++ if (__SHIFTOUT(id.ac_aa64pfr0, ID_AA64PFR0_EL1_FP) == ID_AA64PFR0_EL1_FP_IMPL) ++ exts += "fp "; ++ if (__SHIFTOUT(id.ac_aa64pfr0, ID_AA64PFR0_EL1_ADVSIMD) == ID_AA64PFR0_EL1_ADV_SIMD_IMPL) ++ exts += "asimd "; ++#ifdef ID_AA64ISAR0_EL1_RDM ++ if (__SHIFTOUT(id.ac_aa64isar0, ID_AA64ISAR0_EL1_RDM) == ID_AA64ISAR0_EL1_RDM_SQRDML) ++ exts += "asimdrdm "; ++ if (__SHIFTOUT(id.ac_aa64isar0, ID_AA64ISAR0_EL1_DP) == ID_AA64ISAR0_EL1_DP_UDOT) ++ exts += "asimddp "; ++ if (__SHIFTOUT(id.ac_aa64isar0, ID_AA64ISAR0_EL1_FHM) == ID_AA64ISAR0_EL1_FHM_FMLAL) ++ exts += "asimdfml "; ++#endif ++ if (__SHIFTOUT(id.ac_aa64isar0, ID_AA64ISAR0_EL1_AES) == ID_AA64ISAR0_EL1_AES_AES) ++ exts += "aes "; ++ if (__SHIFTOUT(id.ac_aa64isar0, ID_AA64ISAR0_EL1_AES) == ID_AA64ISAR0_EL1_AES_PMUL) ++ exts += "aes pmull "; ++ if (__SHIFTOUT(id.ac_aa64isar0, ID_AA64ISAR0_EL1_CRC32) == ID_AA64ISAR0_EL1_CRC32_CRC32X) ++ exts += "crc32 "; ++#ifdef ID_AA64ISAR0_EL1_ATOMIC ++ if (__SHIFTOUT(id.ac_aa64isar0, ID_AA64ISAR0_EL1_ATOMIC) == ID_AA64ISAR0_EL1_ATOMIC_SWP) ++ exts += "atomics "; ++#endif ++ if ((__SHIFTOUT(id.ac_aa64isar0, ID_AA64ISAR0_EL1_SHA1) & ID_AA64ISAR0_EL1_SHA1_SHA1CPMHSU) != 0) ++ exts += "sha1 "; ++ if ((__SHIFTOUT(id.ac_aa64isar0, ID_AA64ISAR0_EL1_SHA2) & ID_AA64ISAR0_EL1_SHA2_SHA256HSU) != 0) ++ exts += "sha2 "; ++#ifdef ID_AA64ISAR0_EL1_SHA2_SHA512HSU ++ if ((__SHIFTOUT(id.ac_aa64isar0, ID_AA64ISAR0_EL1_SHA2) & ID_AA64ISAR0_EL1_SHA2_SHA512HSU) != 0) ++ exts += "sha512 "; ++ if ((__SHIFTOUT(id.ac_aa64isar0, ID_AA64ISAR0_EL1_SHA3) & ID_AA64ISAR0_EL1_SHA3_EOR3) != 0) ++ exts += "sha3 "; ++ if (__SHIFTOUT(id.ac_aa64isar0, ID_AA64ISAR0_EL1_SM3) == ID_AA64ISAR0_EL1_SM3_SM3) ++ exts += "sm3 "; ++ if (__SHIFTOUT(id.ac_aa64isar0, ID_AA64ISAR0_EL1_SM4) == ID_AA64ISAR0_EL1_SM4_SM4) ++ exts += "sm4 "; ++ if (__SHIFTOUT(id.ac_aa64pfr0, ID_AA64PFR0_EL1_SVE) == ID_AA64PFR0_EL1_SVE_IMPL) ++ exts += "sve "; ++ if (__SHIFTOUT(id.ac_aa64isar1, ID_AA64ISAR1_EL1_LRCPC) == ID_AA64ISAR1_EL1_LRCPC_PR) ++ exts += "lrcpc "; ++#endif ++ ++ for (i = 0; i < num_exts; i++) ++ { ++ const char *p = aarch64_extensions[i].feat_string; ++ ++ /* If the feature contains no HWCAPS string then ignore it for the ++ auto detection. */ ++ if (*p == '\0') ++ continue; ++ ++ bool enabled = true; ++ ++ /* This may be a multi-token feature string. We need ++ to match all parts, which could be in any order. */ ++ size_t len = strlen (exts.c_str()); ++ do ++ { ++ const char *end = strchr (p, ' '); ++ if (end == NULL) ++ end = strchr (p, '\0'); ++ if (memmem (exts.c_str(), len, p, end - p) == NULL) ++ { ++ /* Failed to match this token. Turn off the ++ features we'd otherwise enable. */ ++ enabled = false; ++ break; ++ } ++ if (*end == '\0') ++ break; ++ p = end + 1; ++ } ++ while (1); ++ ++ if (enabled) ++ extension_flags |= aarch64_extensions[i].flag; ++ else ++ extension_flags &= ~(aarch64_extensions[i].flag); ++ } ++ ++ processed_exts = true; ++ } ++ } ++ /* End of NetBSD specific section. */ ++#endif + + /* Weird cpuinfo format that we don't know how to handle. */ + if (n_cores == 0 Index: pkgsrc/lang/gcc10-aux/patches/patch-gcc_config_darwin-driver.c diff -u /dev/null pkgsrc/lang/gcc10-aux/patches/patch-gcc_config_darwin-driver.c:1.1 --- /dev/null Sun Mar 13 08:34:05 2022 +++ pkgsrc/lang/gcc10-aux/patches/patch-gcc_config_darwin-driver.c Sun Mar 13 08:34:04 2022 @@ -0,0 +1,15 @@ +$NetBSD: patch-gcc_config_darwin-driver.c,v 1.1 2022/03/13 08:34:04 nia Exp $ + +Allow macOS 12. + +--- gcc/config/darwin-driver.c.orig 2021-10-13 11:50:13.000000000 +0000 ++++ gcc/config/darwin-driver.c +@@ -64,7 +64,7 @@ validate_macosx_version_min (const char + + major = strtoul (version_str, &end, 10); + +- if (major < 10 || major > 11 ) /* MacOS 10 and 11 are known. */ ++ if (major < 10 || major > 12 ) /* MacOS 10 and 11 and 12 are known. */ + return NULL; + + /* Skip a separating period, if there's one. */ Index: pkgsrc/lang/gcc10-aux/patches/patch-gcc_config_sparc_sparc.c diff -u /dev/null pkgsrc/lang/gcc10-aux/patches/patch-gcc_config_sparc_sparc.c:1.1 --- /dev/null Sun Mar 13 08:34:05 2022 +++ pkgsrc/lang/gcc10-aux/patches/patch-gcc_config_sparc_sparc.c Sun Mar 13 08:34:04 2022 @@ -0,0 +1,18 @@ +$NetBSD: patch-gcc_config_sparc_sparc.c,v 1.1 2022/03/13 08:34:04 nia Exp $ + +Invoke subtarget-specific code for replacing builtin functions. +Causes "cabsl" to be converted to _c99_cabsl on NetBSD. +https://gcc.gnu.org/pipermail/gcc-patches/2021-February/565290.html + +--- gcc/config/sparc/sparc.c.orig 2020-07-23 06:35:17.480386051 +0000 ++++ gcc/config/sparc/sparc.c +@@ -10993,6 +10993,9 @@ sparc_init_builtins (void) + + if (TARGET_VIS) + sparc_vis_init_builtins (); ++#ifdef SUBTARGET_INIT_BUILTINS ++ SUBTARGET_INIT_BUILTINS; ++#endif + } + + /* Create builtin functions for FPU instructions. */ Index: pkgsrc/lang/gcc10-aux/patches/patch-gcc_configure diff -u /dev/null pkgsrc/lang/gcc10-aux/patches/patch-gcc_configure:1.1 --- /dev/null Sun Mar 13 08:34:05 2022 +++ pkgsrc/lang/gcc10-aux/patches/patch-gcc_configure Sun Mar 13 08:34:04 2022 @@ -0,0 +1,15 @@ +$NetBSD: patch-gcc_configure,v 1.1 2022/03/13 08:34:04 nia Exp $ + +https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90143 + +--- gcc/configure.orig 2015-09-30 23:06:11.000000000 +0000 ++++ gcc/configure +@@ -28321,7 +28321,7 @@ case "$target" in + gcc_cv_target_dl_iterate_phdr=no + fi + ;; +- *-*-dragonfly* | *-*-freebsd*) ++ *-*-dragonfly* | *-*-freebsd* | *-*-netbsd* ) + if grep dl_iterate_phdr $target_header_dir/sys/link_elf.h > /dev/null 2>&1; then + gcc_cv_target_dl_iterate_phdr=yes + else Index: pkgsrc/lang/gcc10-aux/patches/patch-gcc_ggc-common.c diff -u /dev/null pkgsrc/lang/gcc10-aux/patches/patch-gcc_ggc-common.c:1.1 --- /dev/null Sun Mar 13 08:34:05 2022 +++ pkgsrc/lang/gcc10-aux/patches/patch-gcc_ggc-common.c Sun Mar 13 08:34:04 2022 @@ -0,0 +1,51 @@ +$NetBSD: patch-gcc_ggc-common.c,v 1.1 2022/03/13 08:34:04 nia Exp $ + +--- gcc/ggc-common.c.orig 2014-12-10 03:45:40.000000000 +0000 ++++ gcc/ggc-common.c +@@ -591,6 +591,8 @@ gt_pch_restore (FILE *f) + size_t i; + struct mmap_info mmi; + int result; ++ struct line_maps * old_line_table = line_table; ++ location_t old_input_loc = input_location; + + /* Delete any deletable objects. This makes ggc_pch_read much + faster, as it can be sure that no GCable objects remain other +@@ -603,7 +605,7 @@ gt_pch_restore (FILE *f) + for (rt = gt_pch_scalar_rtab; *rt; rt++) + for (rti = *rt; rti->base != NULL; rti++) + if (fread (rti->base, rti->stride, 1, f) != 1) +- fatal_error (input_location, "cannot read PCH file: %m"); ++ { line_table = old_line_table; input_location = old_input_loc; fatal_error (input_location, "cannot read PCH file: %m"); } + + /* Read in all the global pointers, in 6 easy loops. */ + for (rt = gt_ggc_rtab; *rt; rt++) +@@ -611,23 +613,23 @@ gt_pch_restore (FILE *f) + for (i = 0; i < rti->nelt; i++) + if (fread ((char *)rti->base + rti->stride * i, + sizeof (void *), 1, f) != 1) +- fatal_error (input_location, "cannot read PCH file: %m"); ++ { line_table = old_line_table; input_location = old_input_loc; fatal_error (input_location, "cannot read PCH file: %m"); } + + if (fread (&mmi, sizeof (mmi), 1, f) != 1) +- fatal_error (input_location, "cannot read PCH file: %m"); ++ { line_table = old_line_table; input_location = old_input_loc; fatal_error (input_location, "cannot read PCH file: %m"); } + + result = host_hooks.gt_pch_use_address (mmi.preferred_base, mmi.size, + fileno (f), mmi.offset); + if (result < 0) +- fatal_error (input_location, "had to relocate PCH"); ++ { line_table = old_line_table; input_location = old_input_loc; fatal_error (input_location, "had to relocate PCH"); } + if (result == 0) + { + if (fseek (f, mmi.offset, SEEK_SET) != 0 + || fread (mmi.preferred_base, mmi.size, 1, f) != 1) +- fatal_error (input_location, "cannot read PCH file: %m"); ++ { line_table = old_line_table; input_location = old_input_loc; fatal_error (input_location, "cannot read PCH file: %m"); } + } + else if (fseek (f, mmi.offset + mmi.size, SEEK_SET) != 0) +- fatal_error (input_location, "cannot read PCH file: %m"); ++ { line_table = old_line_table; input_location = old_input_loc; fatal_error (input_location, "cannot read PCH file: %m"); } + + ggc_pch_read (f, mmi.preferred_base); + Index: pkgsrc/lang/gcc10-aux/patches/patch-gcc_lto_lto.c diff -u /dev/null pkgsrc/lang/gcc10-aux/patches/patch-gcc_lto_lto.c:1.1 --- /dev/null Sun Mar 13 08:34:05 2022 +++ pkgsrc/lang/gcc10-aux/patches/patch-gcc_lto_lto.c Sun Mar 13 08:34:04 2022 @@ -0,0 +1,19 @@ +$NetBSD: patch-gcc_lto_lto.c,v 1.1 2022/03/13 08:34:04 nia Exp $ + +Better fallback for netbsd<8 lacking WALLSIG. + +--- gcc/lto/lto.c.orig 2018-01-03 21:42:12.000000000 +0000 ++++ gcc/lto/lto.c +@@ -2321,7 +2321,11 @@ wait_for_child () + do + { + #ifndef WCONTINUED +-#define WCONTINUED 0 ++# ifdef WALLSIG ++# define WCONTINUED WALLSIG ++# else ++# define WCONTINUED 0 ++# endif + #endif + int w = waitpid (0, &status, WUNTRACED | WCONTINUED); + if (w == -1) Index: pkgsrc/lang/gcc10-aux/patches/patch-gcc_targhooks.c diff -u /dev/null pkgsrc/lang/gcc10-aux/patches/patch-gcc_targhooks.c:1.1 --- /dev/null Sun Mar 13 08:34:05 2022 +++ pkgsrc/lang/gcc10-aux/patches/patch-gcc_targhooks.c Sun Mar 13 08:34:04 2022 @@ -0,0 +1,17 @@ +$NetBSD: patch-gcc_targhooks.c,v 1.1 2022/03/13 08:34:04 nia Exp $ + +PR pkg/53436 +netbsd can't handle hidden reference to stack_chk_fail_local. +(note: this code is only happening if targeting i386) + +--- gcc/targhooks.c.orig 2018-01-13 18:00:59.000000000 +0000 ++++ gcc/targhooks.c +@@ -919,7 +919,7 @@ default_external_stack_protect_fail (voi + tree + default_hidden_stack_protect_fail (void) + { +-#ifndef HAVE_GAS_HIDDEN ++#if !defined(HAVE_GAS_HIDDEN) || defined(__NetBSD__) || defined(__sun) + return default_external_stack_protect_fail (); + #else + tree t = stack_chk_fail_decl; Index: pkgsrc/lang/gcc10-aux/patches/patch-gnattools_configure diff -u /dev/null pkgsrc/lang/gcc10-aux/patches/patch-gnattools_configure:1.1 --- /dev/null Sun Mar 13 08:34:05 2022 +++ pkgsrc/lang/gcc10-aux/patches/patch-gnattools_configure Sun Mar 13 08:34:04 2022 @@ -0,0 +1,18 @@ +$NetBSD: patch-gnattools_configure,v 1.1 2022/03/13 08:34:04 nia Exp $ + +Include NetBSD in the gnat tools configure. + +--- gnattools/configure.orig 2021-08-28 14:19:25.404806918 +0000 ++++ gnattools/configure 2021-08-28 14:25:51.208977452 +0000 +@@ -2079,6 +2079,11 @@ + mlib-tgt-specific.adb>confdefs.h Index: pkgsrc/lang/gcc10-aux/patches/patch-libffi_configure diff -u /dev/null pkgsrc/lang/gcc10-aux/patches/patch-libffi_configure:1.1 --- /dev/null Sun Mar 13 08:34:05 2022 +++ pkgsrc/lang/gcc10-aux/patches/patch-libffi_configure Sun Mar 13 08:34:04 2022 @@ -0,0 +1,16 @@ +$NetBSD: patch-libffi_configure,v 1.1 2022/03/13 08:34:04 nia Exp $ + +https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90146 +https://github.com/libffi/libffi/issues/485 + +--- libffi/configure.orig 2013-06-01 17:03:49.000000000 +0000 ++++ libffi/configure +@@ -12689,7 +12689,7 @@ case "$target" in + $as_echo "#define FFI_EXEC_TRAMPOLINE_TABLE 1" >>confdefs.h + + ;; +- *-apple-darwin1* | *-*-freebsd* | *-*-kfreebsd* | *-*-openbsd* | *-pc-solaris*) ++ *-apple-darwin1* | *-*-freebsd* | *-*-kfreebsd* | *-*-netbsd* | *-*-openbsd* | *-pc-solaris*) + + $as_echo "#define FFI_MMAP_EXEC_WRIT 1" >>confdefs.h + Index: pkgsrc/lang/gcc10-aux/patches/patch-libffi_testsuite_libffi.call_float2.c diff -u /dev/null pkgsrc/lang/gcc10-aux/patches/patch-libffi_testsuite_libffi.call_float2.c:1.1 --- /dev/null Sun Mar 13 08:34:05 2022 +++ pkgsrc/lang/gcc10-aux/patches/patch-libffi_testsuite_libffi.call_float2.c Sun Mar 13 08:34:04 2022 @@ -0,0 +1,15 @@ +$NetBSD: patch-libffi_testsuite_libffi.call_float2.c,v 1.1 2022/03/13 08:34:04 nia Exp $ + +https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90146 + +--- libffi/testsuite/libffi.call/float2.c.orig 2013-06-01 17:08:18.000000000 +0000 ++++ libffi/testsuite/libffi.call/float2.c +@@ -45,7 +45,7 @@ int main (void) + /* This is ifdef'd out for now. long double support under SunOS/gcc + is pretty much non-existent. You'll get the odd bus error in library + routines like printf(). */ +- printf ("%Lf, %Lf, %Lf, %Lf\n", ld, ldblit(f), ld - ldblit(f), LDBL_EPSILON); ++ printf ("%Lf, %Lf, %Lf, %Lf\n", (long double)ld, (long double)ldblit(f), (long double)(ld - ldblit(f)), (long double)LDBL_EPSILON); + #endif + + /* These are not always the same!! Check for a reasonable delta */ Index: pkgsrc/lang/gcc10-aux/patches/patch-libgcc_config.host diff -u /dev/null pkgsrc/lang/gcc10-aux/patches/patch-libgcc_config.host:1.1 --- /dev/null Sun Mar 13 08:34:05 2022 +++ pkgsrc/lang/gcc10-aux/patches/patch-libgcc_config.host Sun Mar 13 08:34:04 2022 @@ -0,0 +1,15 @@ +$NetBSD: patch-libgcc_config.host,v 1.1 2022/03/13 08:34:04 nia Exp $ + +This is needed to get Out-of-line LSE atomics linked into libgcc. +libsupc++ fails to link without this. + +--- libgcc/config.host.orig 2020-07-23 06:35:18.752400064 +0000 ++++ libgcc/config.host +@@ -377,6 +377,7 @@ aarch64*-*-freebsd*) + aarch64*-*-netbsd*) + extra_parts="$extra_parts crtfastmath.o" + tmake_file="${tmake_file} ${cpu_type}/t-aarch64" ++ tmake_file="${tmake_file} ${cpu_type}/t-lse" + tmake_file="${tmake_file} ${cpu_type}/t-softfp t-softfp t-crtfm" + md_unwind_header=aarch64/aarch64-unwind.h + ;; Index: pkgsrc/lang/gcc10-aux/patches/patch-libgcc_crtstuff.c diff -u /dev/null pkgsrc/lang/gcc10-aux/patches/patch-libgcc_crtstuff.c:1.1 --- /dev/null Sun Mar 13 08:34:05 2022 +++ pkgsrc/lang/gcc10-aux/patches/patch-libgcc_crtstuff.c Sun Mar 13 08:34:04 2022 @@ -0,0 +1,15 @@ +$NetBSD: patch-libgcc_crtstuff.c,v 1.1 2022/03/13 08:34:04 nia Exp $ + +https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90147 + +--- libgcc/crtstuff.c.orig 2017-01-01 12:07:43.000000000 +0000 ++++ libgcc/crtstuff.c +@@ -81,7 +81,7 @@ call_ ## FUNC (void) \ + #endif + + #if defined(TARGET_DL_ITERATE_PHDR) && \ +- (defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__)) ++ (defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)) + #define BSD_DL_ITERATE_PHDR_AVAILABLE + #endif + Index: pkgsrc/lang/gcc10-aux/patches/patch-libgfortran_io_format.c diff -u /dev/null pkgsrc/lang/gcc10-aux/patches/patch-libgfortran_io_format.c:1.1 --- /dev/null Sun Mar 13 08:34:05 2022 +++ pkgsrc/lang/gcc10-aux/patches/patch-libgfortran_io_format.c Sun Mar 13 08:34:04 2022 @@ -0,0 +1,17 @@ +$NetBSD: patch-libgfortran_io_format.c,v 1.1 2022/03/13 08:34:04 nia Exp $ + +Fix -Werror=char-subscripts. + +https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95177 + +--- libgfortran/io/format.c.orig 2020-05-07 10:50:02.000000000 +0000 ++++ libgfortran/io/format.c +@@ -193,7 +193,7 @@ next_char (format_data *fmt, int literal + return -1; + + fmt->format_string_len--; +- c = toupper (*fmt->format_string++); ++ c = toupper ((unsigned char) *fmt->format_string++); + fmt->error_element = c; + } + while ((c == ' ' || c == '\t') && !literal); Index: pkgsrc/lang/gcc10-aux/patches/patch-libgfortran_io_io.h diff -u /dev/null pkgsrc/lang/gcc10-aux/patches/patch-libgfortran_io_io.h:1.1 --- /dev/null Sun Mar 13 08:34:05 2022 +++ pkgsrc/lang/gcc10-aux/patches/patch-libgfortran_io_io.h Sun Mar 13 08:34:04 2022 @@ -0,0 +1,18 @@ +$NetBSD: patch-libgfortran_io_io.h,v 1.1 2022/03/13 08:34:04 nia Exp $ + +Don't declare old_locale* an internal_proto to avoid linking problems + +--- libgfortran/io/io.h.orig 2018-01-07 10:17:52.000000000 +0000 ++++ libgfortran/io/io.h +@@ -57,11 +57,8 @@ extern locale_t c_locale; + internal_proto(c_locale); + #else + extern char* old_locale; +-internal_proto(old_locale); + extern int old_locale_ctr; +-internal_proto(old_locale_ctr); + extern __gthread_mutex_t old_locale_lock; +-internal_proto(old_locale_lock); + #endif + + Index: pkgsrc/lang/gcc10-aux/patches/patch-libgfortran_io_list__read.c diff -u /dev/null pkgsrc/lang/gcc10-aux/patches/patch-libgfortran_io_list__read.c:1.1 --- /dev/null Sun Mar 13 08:34:05 2022 +++ pkgsrc/lang/gcc10-aux/patches/patch-libgfortran_io_list__read.c Sun Mar 13 08:34:04 2022 @@ -0,0 +1,17 @@ +$NetBSD: patch-libgfortran_io_list__read.c,v 1.1 2022/03/13 08:34:04 nia Exp $ + +Fix -Werror=char-subscripts. + +https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95177 + +--- libgfortran/io/list_read.c.orig 2020-05-07 10:50:02.000000000 +0000 ++++ libgfortran/io/list_read.c +@@ -2757,7 +2757,7 @@ nml_match_name (st_parameter_dt *dtp, co + for (i = 0; i < len; i++) + { + c = next_char (dtp); +- if (c == EOF || (tolower (c) != tolower (name[i]))) ++ if (c == EOF || (tolower (c) != tolower ((unsigned char) name[i]))) + { + dtp->u.p.nml_read_error = 1; + break; Index: pkgsrc/lang/gcc10-aux/patches/patch-libgfortran_io_read.c diff -u /dev/null pkgsrc/lang/gcc10-aux/patches/patch-libgfortran_io_read.c:1.1 --- /dev/null Sun Mar 13 08:34:05 2022 +++ pkgsrc/lang/gcc10-aux/patches/patch-libgfortran_io_read.c Sun Mar 13 08:34:04 2022 @@ -0,0 +1,44 @@ +$NetBSD: patch-libgfortran_io_read.c,v 1.1 2022/03/13 08:34:04 nia Exp $ + +Fix -Werror=char-subscripts. + +https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95177 + +--- libgfortran/io/read.c.orig 2020-05-07 10:50:02.000000000 +0000 ++++ libgfortran/io/read.c +@@ -959,7 +959,7 @@ read_f (st_parameter_dt *dtp, const fnod + between "NaN" and the optional perenthesis is not permitted. */ + while (w > 0) + { +- *out = tolower (*p); ++ *out = tolower ((unsigned char) *p); + switch (*p) + { + case ' ': +@@ -981,7 +981,7 @@ read_f (st_parameter_dt *dtp, const fnod + goto bad_float; + break; + default: +- if (!isalnum (*out)) ++ if (!isalnum ((unsigned char) *out)) + goto bad_float; + } + --w; +@@ -1109,7 +1109,7 @@ exponent: + + if (dtp->u.p.blank_status == BLANK_UNSPECIFIED) + { +- while (w > 0 && isdigit (*p)) ++ while (w > 0 && isdigit ((unsigned char) *p)) + { + exponent *= 10; + exponent += *p - '0'; +@@ -1137,7 +1137,7 @@ exponent: + else + assert (dtp->u.p.blank_status == BLANK_NULL); + } +- else if (!isdigit (*p)) ++ else if (!isdigit ((unsigned char) *p)) + goto bad_float; + else + { Index: pkgsrc/lang/gcc10-aux/patches/patch-libgfortran_runtime_environ.c diff -u /dev/null pkgsrc/lang/gcc10-aux/patches/patch-libgfortran_runtime_environ.c:1.1 --- /dev/null Sun Mar 13 08:34:05 2022 +++ pkgsrc/lang/gcc10-aux/patches/patch-libgfortran_runtime_environ.c Sun Mar 13 08:34:04 2022 @@ -0,0 +1,26 @@ +$NetBSD: patch-libgfortran_runtime_environ.c,v 1.1 2022/03/13 08:34:04 nia Exp $ + +Fix -Werror=char-subscripts. + +https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95177 + +--- libgfortran/runtime/environ.c.orig 2020-05-07 10:50:02.000000000 +0000 ++++ libgfortran/runtime/environ.c +@@ -91,7 +91,7 @@ init_integer (variable * v) + return; + + for (q = p; *q; q++) +- if (!isdigit (*q) && (p != q || *q != '-')) ++ if (!isdigit ((unsigned char) *q) && (p != q || *q != '-')) + return; + + *v->var = atoi (p); +@@ -344,7 +344,7 @@ static int + match_integer (void) + { + unit_num = 0; +- while (isdigit (*p)) ++ while (isdigit ((unsigned char) *p)) + unit_num = unit_num * 10 + (*p++ - '0'); + return INTEGER; + } Index: pkgsrc/lang/gcc10-aux/patches/patch-libquadmath_printf_quadmath-printf.c diff -u /dev/null pkgsrc/lang/gcc10-aux/patches/patch-libquadmath_printf_quadmath-printf.c:1.1 --- /dev/null Sun Mar 13 08:34:05 2022 +++ pkgsrc/lang/gcc10-aux/patches/patch-libquadmath_printf_quadmath-printf.c Sun Mar 13 08:34:04 2022 @@ -0,0 +1,26 @@ +$NetBSD: patch-libquadmath_printf_quadmath-printf.c,v 1.1 2022/03/13 08:34:04 nia 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 +@@ -189,7 +189,7 @@ quadmath_snprintf (char *str, size_t siz + ++format; + info.width = va_arg (ap, int); + } +- else if (isdigit (*format)) ++ else if (isdigit ((unsigned char) *format)) + /* Constant width specification. */ + info.width = read_int (&format); + +@@ -206,7 +206,7 @@ quadmath_snprintf (char *str, size_t siz + + info.prec = va_arg (ap, int); + } +- else if (isdigit (*format)) ++ else if (isdigit ((unsigned char) *format)) + info.prec = read_int (&format); + else + /* "%.?" is treated like "%.0?". */ Index: pkgsrc/lang/gcc10-aux/patches/patch-libquadmath_strtod_strtod__l.c diff -u /dev/null pkgsrc/lang/gcc10-aux/patches/patch-libquadmath_strtod_strtod__l.c:1.1 --- /dev/null Sun Mar 13 08:34:05 2022 +++ pkgsrc/lang/gcc10-aux/patches/patch-libquadmath_strtod_strtod__l.c Sun Mar 13 08:34:04 2022 @@ -0,0 +1,23 @@ +$NetBSD: patch-libquadmath_strtod_strtod__l.c,v 1.1 2022/03/13 08:34:04 nia 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 ++++ libquadmath/strtod/strtod_l.c +@@ -57,10 +57,10 @@ + # define STRING_TYPE char + # define CHAR_TYPE char + # define L_(Ch) Ch +-# define ISSPACE(Ch) isspace (Ch) +-# define ISDIGIT(Ch) isdigit (Ch) +-# define ISXDIGIT(Ch) isxdigit (Ch) +-# define TOLOWER(Ch) tolower (Ch) ++# define ISSPACE(Ch) isspace ((unsigned char) Ch) ++# define ISDIGIT(Ch) isdigit ((unsigned char) Ch) ++# define ISXDIGIT(Ch) isxdigit ((unsigned char) Ch) ++# define TOLOWER(Ch) tolower ((unsigned char) Ch) + # define TOLOWER_C(Ch) \ + ({__typeof(Ch) __tlc = (Ch); \ + (__tlc >= 'A' && __tlc <= 'Z') ? __tlc - 'A' + 'a' : __tlc; }) Index: pkgsrc/lang/gcc10-aux/patches/patch-libstdc++-v3_libsupc++_new__opa.cc diff -u /dev/null pkgsrc/lang/gcc10-aux/patches/patch-libstdc++-v3_libsupc++_new__opa.cc:1.1 --- /dev/null Sun Mar 13 08:34:05 2022 +++ pkgsrc/lang/gcc10-aux/patches/patch-libstdc++-v3_libsupc++_new__opa.cc Sun Mar 13 08:34:04 2022 @@ -0,0 +1,17 @@ +$NetBSD: patch-libstdc++-v3_libsupc++_new__opa.cc,v 1.1 2022/03/13 08:34:04 nia Exp $ + +Ensure we can find SunOS std::aligned_alloc if using it. + +--- libstdc++-v3/libsupc++/new_opa.cc.orig 2020-03-04 08:30:03.000000000 +0000 ++++ libstdc++-v3/libsupc++/new_opa.cc +@@ -57,6 +57,10 @@ extern "C" + } + #endif + ++#if defined(__sun) && _GLIBCXX_HAVE_ALIGNED_ALLOC ++using std::aligned_alloc; ++#endif ++ + namespace __gnu_cxx { + #if _GLIBCXX_HAVE_ALIGNED_ALLOC + using ::aligned_alloc; --_----------=_1647160445211770--