pkgsrc-WIP-changes archive

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

Add riscv64-none-elf-xuantie-gcc-10.2.0



Module Name:	pkgsrc-wip
Committed By:	Rui-Xiang Guo <rxg%lavabit.com@localhost>
Pushed By:	rxg
Date:		Mon Nov 18 09:10:01 2024 +0800
Changeset:	7f4c5c9229868c590a9c3b64b0e67fd908f51bd9

Modified Files:
	Makefile
Added Files:
	riscv64-none-elf-xuantie-gcc/DESCR
	riscv64-none-elf-xuantie-gcc/Makefile
	riscv64-none-elf-xuantie-gcc/TODO
	riscv64-none-elf-xuantie-gcc/distinfo
	riscv64-none-elf-xuantie-gcc/patches/patch-fixincludes_inclhack.def
	riscv64-none-elf-xuantie-gcc/patches/patch-gcc_Makefile.in
	riscv64-none-elf-xuantie-gcc/patches/patch-gcc_system.h
	riscv64-none-elf-xuantie-gcc/patches/patch-libcc1_configure
	riscv64-none-elf-xuantie-gcc/patches/patch-libcc1_connection.cc
	riscv64-none-elf-xuantie-gcc/patches/patch-libffi_configure
	riscv64-none-elf-xuantie-gcc/patches/patch-libffi_testsuite_libffi.call_float2.c
	riscv64-none-elf-xuantie-gcc/patches/patch-libgcc_config.host
	riscv64-none-elf-xuantie-gcc/patches/patch-libgcc_crtstuff.c
	riscv64-none-elf-xuantie-gcc/patches/patch-libgfortran_io_io.h
	riscv64-none-elf-xuantie-gcc/patches/patch-libiberty_Makefile.in
	riscv64-none-elf-xuantie-gcc/patches/patch-libquadmath_printf_quadmath-printf.c
	riscv64-none-elf-xuantie-gcc/patches/patch-libquadmath_strtod_strtod__l.c
	riscv64-none-elf-xuantie-gcc/patches/patch-libstdc++-v3_libsupc++_new__opa.cc

Log Message:
Add riscv64-none-elf-xuantie-gcc-10.2.0

XuanTie GCC for bare metal RISC-V 64-bit ELF environment with newlib.

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=7f4c5c9229868c590a9c3b64b0e67fd908f51bd9

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

diffstat:
 Makefile                                           |  1 +
 riscv64-none-elf-xuantie-gcc/DESCR                 |  1 +
 riscv64-none-elf-xuantie-gcc/Makefile              | 75 ++++++++++++++++++++++
 riscv64-none-elf-xuantie-gcc/TODO                  |  4 ++
 riscv64-none-elf-xuantie-gcc/distinfo              | 22 +++++++
 .../patches/patch-fixincludes_inclhack.def         | 36 +++++++++++
 .../patches/patch-gcc_Makefile.in                  | 13 ++++
 .../patches/patch-gcc_system.h                     | 14 ++++
 .../patches/patch-libcc1_configure                 | 16 +++++
 .../patches/patch-libcc1_connection.cc             | 12 ++++
 .../patches/patch-libffi_configure                 | 13 ++++
 .../patch-libffi_testsuite_libffi.call_float2.c    | 13 ++++
 .../patches/patch-libgcc_config.host               | 25 ++++++++
 .../patches/patch-libgcc_crtstuff.c                | 15 +++++
 .../patches/patch-libgfortran_io_io.h              | 18 ++++++
 .../patches/patch-libiberty_Makefile.in            | 37 +++++++++++
 .../patch-libquadmath_printf_quadmath-printf.c     | 26 ++++++++
 .../patches/patch-libquadmath_strtod_strtod__l.c   | 23 +++++++
 .../patch-libstdc++-v3_libsupc++_new__opa.cc       | 17 +++++
 19 files changed, 381 insertions(+)

diffs:
diff --git a/Makefile b/Makefile
index 30adb56c76..ab28b19160 100644
--- a/Makefile
+++ b/Makefile
@@ -5005,6 +5005,7 @@ SUBDIR+=	ripole
 SUBDIR+=	rippled
 SUBDIR+=	riscv64-none-elf-binutils
 SUBDIR+=	riscv64-none-elf-gcc
+SUBDIR+=	riscv64-none-elf-xuantie-gcc
 SUBDIR+=	rk
 SUBDIR+=	rlottie
 SUBDIR+=	rmilter
diff --git a/riscv64-none-elf-xuantie-gcc/DESCR b/riscv64-none-elf-xuantie-gcc/DESCR
new file mode 100644
index 0000000000..ebc4c9a961
--- /dev/null
+++ b/riscv64-none-elf-xuantie-gcc/DESCR
@@ -0,0 +1 @@
+XuanTie GCC for bare metal RISC-V 64-bit ELF environment with newlib.
diff --git a/riscv64-none-elf-xuantie-gcc/Makefile b/riscv64-none-elf-xuantie-gcc/Makefile
new file mode 100644
index 0000000000..55f5591582
--- /dev/null
+++ b/riscv64-none-elf-xuantie-gcc/Makefile
@@ -0,0 +1,75 @@
+# $NetBSD: Makefile,v 1.3 2024/05/13 23:08:56 gutteridge Exp $
+
+GIT_BRANCH=		xuantie-gcc-10.2.0
+DISTNAME=		gcc-${THEADVER}
+PKGNAME=		cross-riscv64-none-elf-${GIT_BRANCH}
+CATEGORIES=		cross
+THEADVER=		THead-2.6.1
+#NEWLIBVER=		3.2.0
+MASTER_SITES=		${MASTER_SITE_GITHUB:=XUANTIE-RV/}
+GITHUB_PROJECT=		gcc
+GITHUB_TAG=		refs/tags/${THEADVER}
+DIST_SUBDIR=		xuantie-gcc
+DISTFILES=		${DEFAULT_DISTFILES} \
+			${THEADVER}.tar.gz
+SITES.${THEADVER}.tar.gz=	https://github.com/XUANTIE-RV/newlib/archive/refs/tags/
+
+MAINTAINER=		port-riscv%NetBSD.org@localhost
+HOMEPAGE=		# none
+COMMENT=		XuanTie GCC for bare metal RISC-V 64-bit little-endian ELF
+LICENSE=		gnu-gpl-v2 AND gnu-gpl-v3 AND gnu-lgpl-v2 AND gnu-lgpl-v3
+
+EXTRACT_USING=		bsdtar
+
+# Relocations result in a linker error.
+MKPIE_SUPPORTED=	no
+
+# for http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33549
+# use makeinfo from pkgsrc/devel/gtexinfo.
+TOOL_DEPENDS+=			gtexinfo>=5.1:../../devel/gtexinfo
+_TOOLS_USE_PKGSRC.makeinfo=	yes
+TOOL_DEPENDS+=			coreutils>=0:../../sysutils/coreutils
+
+DEPENDS+=		cross-riscv64-none-elf-binutils-[0-9]*:../../cross/riscv64-none-elf-binutils
+
+USE_LANGUAGES+=		c c++
+
+CHECK_PORTABILITY_SKIP+=	contrib/*
+CHECK_PORTABILITY_SKIP+=	gcc/config/nvptx/gen-opt.sh
+
+RISCV64ELF_PREFIX=	${PREFIX}/cross-riscv64-none-elf-xuantie
+OBJDIR=			../build
+CONFIGURE_DIRS=		${OBJDIR}
+CONFIGURE_SCRIPT=	${WRKSRC}/configure
+
+CONFIG_SHELL=		${TOOLS_PATH.bash}
+WRAPPER_SHELL=		${TOOLS_PATH.bash}
+USE_TOOLS+=		bash gmake gsed makeinfo perl
+
+GNU_CONFIGURE=		yes
+GNU_CONFIGURE_STRICT=	no # has sub-configures
+GNU_CONFIGURE_PREFIX=	${RISCV64ELF_PREFIX}
+
+CONFIGURE_ARGS+=	--target=riscv64-none-elf
+CONFIGURE_ARGS+=	--enable-languages=c,c++
+CONFIGURE_ARGS+=	--with-newlib
+CONFIGURE_ARGS+=	--disable-multilib
+CONFIGURE_ARGS+=	--disable-nls
+CONFIGURE_ARGS+=	--disable-libstdcxx-pch
+CONFIGURE_ARGS+=	--disable-gcov
+
+INFO_FILES=		yes
+
+WRKSRC=			${WRKDIR}/${DISTNAME}
+
+post-extract:
+	${LN} -s ${WRKDIR}/newlib-${THEADVER}/newlib ${WRKSRC}/newlib
+	${LN} -s ${WRKDIR}/newlib-${THEADVER}/libgloss ${WRKSRC}/libgloss
+
+pre-configure:
+	${RUN} cd ${WRKSRC} && ${MKDIR} ${OBJDIR}
+
+.include "../../devel/gmp/buildlink3.mk"
+.include "../../math/mpfr/buildlink3.mk"
+.include "../../math/mpcomplex/buildlink3.mk"
+.include "../../mk/bsd.pkg.mk"
diff --git a/riscv64-none-elf-xuantie-gcc/TODO b/riscv64-none-elf-xuantie-gcc/TODO
new file mode 100644
index 0000000000..22793e9b28
--- /dev/null
+++ b/riscv64-none-elf-xuantie-gcc/TODO
@@ -0,0 +1,4 @@
+fix:
+checking for suffix of object files... configure: error: in `/usr/builds/work/wip/riscv64-none-elf-xuantie-gcc/work.x86_64/build/riscv64-none-elf/libgcc':
+configure: error: cannot compute suffix of object files: cannot compile
+See `config.log' for more details
diff --git a/riscv64-none-elf-xuantie-gcc/distinfo b/riscv64-none-elf-xuantie-gcc/distinfo
new file mode 100644
index 0000000000..429d8748ea
--- /dev/null
+++ b/riscv64-none-elf-xuantie-gcc/distinfo
@@ -0,0 +1,22 @@
+$NetBSD: distinfo,v 1.1 2024/03/18 17:39:35 dogcow Exp $
+
+BLAKE2s (xuantie-gcc/THead-2.6.1.tar.gz) = ce1bac3ed2b4fa48bf1d2fde65809e2ecf9388ac878b4f0477c8bd8e526aeb11
+SHA512 (xuantie-gcc/THead-2.6.1.tar.gz) = 2346560798061827a56c4c86006e4f59765b506ea7d40925680921022960a59cb6d5074956ad442fe8e94bc27ef5c10b2d109fb78a685faa57bb757cdced6679
+Size (xuantie-gcc/THead-2.6.1.tar.gz) = 21804604 bytes
+BLAKE2s (xuantie-gcc/gcc-THead-2.6.1.tar.gz) = b3f1736909c214832cd962f084993028bff11b6179b52d2cfbcc907e02f1342a
+SHA512 (xuantie-gcc/gcc-THead-2.6.1.tar.gz) = 7338e6f89008fa77a0caedae15f7c02829838376e67c52a9ce93157fbcf640526828c32941bcd23f227dfdc919e39a9917950b36809ea9a63392af9d87da2fa8
+Size (xuantie-gcc/gcc-THead-2.6.1.tar.gz) = 119069178 bytes
+SHA1 (patch-fixincludes_inclhack.def) = 7b00974d3f52a8364190a607f52a5d7e8a6db41a
+SHA1 (patch-gcc_Makefile.in) = 008bb4b0ca644e7bb5cb78ec4a6b54b849816a8d
+SHA1 (patch-gcc_system.h) = 72a75ff773b9b5f3d2f16f4ec7d29e032aba5f53
+SHA1 (patch-libcc1_configure) = 0368733ddf79b109fcc7146b0baeb37ab31e634a
+SHA1 (patch-libcc1_connection.cc) = 2acd56a6f62b29ed3f02eecb7bf103e4564a442c
+SHA1 (patch-libffi_configure) = 4be83b5c6a0efbea44d44f9e22fa22a2e7ff1c29
+SHA1 (patch-libffi_testsuite_libffi.call_float2.c) = a4ebc2541ab664fbc6fd489e64dc134f47ab4c46
+SHA1 (patch-libgcc_config.host) = d40d4d08c807eeff98cc246d1ea756b5b2c749b0
+SHA1 (patch-libgcc_crtstuff.c) = a16d465039de00c195cf0694560140a9c38f3a25
+SHA1 (patch-libgfortran_io_io.h) = d44676239a7f45e42054d24bd5224f43c20055c0
+SHA1 (patch-libiberty_Makefile.in) = 7ea2578b5b77cb4adcd4afe3d63739efc68a1540
+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
diff --git a/riscv64-none-elf-xuantie-gcc/patches/patch-fixincludes_inclhack.def b/riscv64-none-elf-xuantie-gcc/patches/patch-fixincludes_inclhack.def
new file mode 100644
index 0000000000..39d247c70f
--- /dev/null
+++ b/riscv64-none-elf-xuantie-gcc/patches/patch-fixincludes_inclhack.def
@@ -0,0 +1,36 @@
+$NetBSD: patch-fixincludes_inclhack.def,v 1.1 2022/06/16 15:43:55 adam 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 <Availability.h> 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 <AvailabilityInternal.h> uses __attribute__((availability))
+  *  unconditionally.
+  */
diff --git a/riscv64-none-elf-xuantie-gcc/patches/patch-gcc_Makefile.in b/riscv64-none-elf-xuantie-gcc/patches/patch-gcc_Makefile.in
new file mode 100644
index 0000000000..f7cb50f46f
--- /dev/null
+++ b/riscv64-none-elf-xuantie-gcc/patches/patch-gcc_Makefile.in
@@ -0,0 +1,13 @@
+$NetBSD$
+
+--- gcc/Makefile.in.orig	2022-12-04 15:58:07.000000000 +0000
++++ gcc/Makefile.in
+@@ -2387,7 +2387,7 @@ $(simple_generated_c:insn-%.c=s-%): s-%:
+ 	$(RUN_GEN) build/gen$*$(build_exeext) $(md_file) \
+ 	  $(filter insn-conditions.md,$^) > tmp-$*.c
+ 	$(SHELL) $(srcdir)/../move-if-change tmp-$*.c insn-$*.c
+-	$*v=$$(echo $$(csplit insn-$*.c /parallel\ compilation/ -k -s {$(INSN-GENERATED-SPLIT-NUM)} -f insn-$* -b "%d.c" 2>&1));\
++	$*v=$$(echo $$(gcsplit insn-$*.c /parallel\ compilation/ -k -s {$(INSN-GENERATED-SPLIT-NUM)} -f insn-$* -b "%d.c" 2>&1));\
+ 	[ ! "$$$*v" ] || grep "match not found" <<< $$$*v
+ 	[ -s insn-$*0.c ] || (for i in $(insn-generated-split-num); do touch insn-$*$$i.c; done && echo "" > insn-$*.c)
+ 	$(STAMP) s-$*
diff --git a/riscv64-none-elf-xuantie-gcc/patches/patch-gcc_system.h b/riscv64-none-elf-xuantie-gcc/patches/patch-gcc_system.h
new file mode 100644
index 0000000000..063f000f47
--- /dev/null
+++ b/riscv64-none-elf-xuantie-gcc/patches/patch-gcc_system.h
@@ -0,0 +1,14 @@
+$NetBSD: patch-gcc_system.h,v 1.1 2024/03/18 17:39:35 dogcow Exp $
+
+--- gcc/system.h.orig	2015-01-05 12:33:28.000000000 +0000
++++ gcc/system.h
+@@ -44,6 +44,9 @@ along with GCC; see the file COPYING3.  
+ #endif
+ 
+ #include <stdio.h>
++#ifdef __cplusplus
++# include <cstdio>
++#endif
+ 
+ /* Define a generic NULL if one hasn't already been defined.  */
+ #ifndef NULL
diff --git a/riscv64-none-elf-xuantie-gcc/patches/patch-libcc1_configure b/riscv64-none-elf-xuantie-gcc/patches/patch-libcc1_configure
new file mode 100644
index 0000000000..ac304064a9
--- /dev/null
+++ b/riscv64-none-elf-xuantie-gcc/patches/patch-libcc1_configure
@@ -0,0 +1,16 @@
+$NetBSD: patch-libcc1_configure,v 1.1 2024/03/18 17:39:35 dogcow Exp $
+
+Disable multi-os install dir for libcc1
+
+--- libcc1/configure.orig	2014-11-21 16:49:17.000000000 +0000
++++ libcc1/configure
+@@ -14366,9 +14366,6 @@ fi
+ 
+ 
+ libsuffix=
+-if test "$GXX" = yes; then
+-  libsuffix=`$CXX -print-multi-os-directory`
+-fi
+ 
+ 
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for socket libraries" >&5
diff --git a/riscv64-none-elf-xuantie-gcc/patches/patch-libcc1_connection.cc b/riscv64-none-elf-xuantie-gcc/patches/patch-libcc1_connection.cc
new file mode 100644
index 0000000000..cb760122cc
--- /dev/null
+++ b/riscv64-none-elf-xuantie-gcc/patches/patch-libcc1_connection.cc
@@ -0,0 +1,12 @@
+$NetBSD: patch-libcc1_connection.cc,v 1.1 2024/03/18 17:39:35 dogcow Exp $
+
+--- libcc1/connection.cc.orig	2014-11-13 10:22:22.000000000 +0000
++++ libcc1/connection.cc
+@@ -23,6 +23,7 @@ along with GCC; see the file COPYING3.  
+ #include <sys/types.h>
+ #include <string.h>
+ #include <errno.h>
++#include <sys/select.h>
+ #include "marshall.hh"
+ #include "connection.hh"
+ #include "rpc.hh"
diff --git a/riscv64-none-elf-xuantie-gcc/patches/patch-libffi_configure b/riscv64-none-elf-xuantie-gcc/patches/patch-libffi_configure
new file mode 100644
index 0000000000..99565b744b
--- /dev/null
+++ b/riscv64-none-elf-xuantie-gcc/patches/patch-libffi_configure
@@ -0,0 +1,13 @@
+$NetBSD$
+
+--- libffi/configure.orig	2024-10-28 04:25:57.945292593 +0000
++++ libffi/configure
+@@ -15992,7 +15992,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
+ 
diff --git a/riscv64-none-elf-xuantie-gcc/patches/patch-libffi_testsuite_libffi.call_float2.c b/riscv64-none-elf-xuantie-gcc/patches/patch-libffi_testsuite_libffi.call_float2.c
new file mode 100644
index 0000000000..3451257835
--- /dev/null
+++ b/riscv64-none-elf-xuantie-gcc/patches/patch-libffi_testsuite_libffi.call_float2.c
@@ -0,0 +1,13 @@
+$NetBSD$
+
+--- libffi/testsuite/libffi.call/float2.c.orig	2024-10-28 05:14:44.230561111 +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 */
diff --git a/riscv64-none-elf-xuantie-gcc/patches/patch-libgcc_config.host b/riscv64-none-elf-xuantie-gcc/patches/patch-libgcc_config.host
new file mode 100644
index 0000000000..0a008f19ba
--- /dev/null
+++ b/riscv64-none-elf-xuantie-gcc/patches/patch-libgcc_config.host
@@ -0,0 +1,25 @@
+$NetBSD: patch-libgcc_config.host,v 1.1 2022/06/16 15:43:55 adam Exp $
+
+This is needed for arm64 to get Out-of-line LSE atomics linked into libgcc.
+libsupc++ fails to link without this, and for arm to build.
+
+--- libgcc/config.host.orig	2021-04-08 04:56:29.805761640 -0700
++++ libgcc/config.host	2022-02-02 04:08:51.653635705 -0800
+@@ -377,6 +377,7 @@
+ 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
+ 	;;
+@@ -463,7 +464,8 @@
+ 	case ${host} in
+ 	  arm*-*-netbsdelf-*eabi*)
+ 	    tmake_file="${tmake_file} arm/t-netbsd-eabi"
+-	    unwind_header=config/arm/unwind-arm.h
++	    # GCC 7 vs NetBSD/eabi -> avoid arm unwinder
++	    #unwind_header=config/arm/unwind-arm.h
+ 	    ;;
+ 	  *)
+ 	    tmake_file="${tmake_file} arm/t-netbsd t-slibgcc-gld-nover"
diff --git a/riscv64-none-elf-xuantie-gcc/patches/patch-libgcc_crtstuff.c b/riscv64-none-elf-xuantie-gcc/patches/patch-libgcc_crtstuff.c
new file mode 100644
index 0000000000..286348b88d
--- /dev/null
+++ b/riscv64-none-elf-xuantie-gcc/patches/patch-libgcc_crtstuff.c
@@ -0,0 +1,15 @@
+$NetBSD: patch-libgcc_crtstuff.c,v 1.1 2022/06/16 15:43:55 adam 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
+  
diff --git a/riscv64-none-elf-xuantie-gcc/patches/patch-libgfortran_io_io.h b/riscv64-none-elf-xuantie-gcc/patches/patch-libgfortran_io_io.h
new file mode 100644
index 0000000000..77d3b2a599
--- /dev/null
+++ b/riscv64-none-elf-xuantie-gcc/patches/patch-libgfortran_io_io.h
@@ -0,0 +1,18 @@
+$NetBSD: patch-libgfortran_io_io.h,v 1.1 2022/06/16 15:43:55 adam 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
+ 
+ 
diff --git a/riscv64-none-elf-xuantie-gcc/patches/patch-libiberty_Makefile.in b/riscv64-none-elf-xuantie-gcc/patches/patch-libiberty_Makefile.in
new file mode 100644
index 0000000000..9aecf150cd
--- /dev/null
+++ b/riscv64-none-elf-xuantie-gcc/patches/patch-libiberty_Makefile.in
@@ -0,0 +1,37 @@
+$NetBSD: patch-libiberty_Makefile.in,v 1.1 2024/03/18 17:39:35 dogcow Exp $
+
+--- libiberty/Makefile.in.orig	2014-12-24 16:22:51.000000000 +0000
++++ libiberty/Makefile.in
+@@ -363,13 +363,12 @@ install-strip: install
+ # multilib-specific flags, it's overridden by FLAGS_TO_PASS from the
+ # default multilib, so we have to take CFLAGS into account as well,
+ # since it will be passed the multilib flags.
+-MULTIOSDIR = `$(CC) $(CFLAGS) -print-multi-os-directory`
+ install_to_libdir: all
+ 	if test -n "${target_header_dir}"; then \
+-		${mkinstalldirs} $(DESTDIR)$(libdir)/$(MULTIOSDIR); \
+-		$(INSTALL_DATA) $(TARGETLIB) $(DESTDIR)$(libdir)/$(MULTIOSDIR)/$(TARGETLIB)n; \
+-		( cd $(DESTDIR)$(libdir)/$(MULTIOSDIR) ; chmod 644 $(TARGETLIB)n ;$(RANLIB) $(TARGETLIB)n ); \
+-		mv -f $(DESTDIR)$(libdir)/$(MULTIOSDIR)/$(TARGETLIB)n $(DESTDIR)$(libdir)/$(MULTIOSDIR)/$(TARGETLIB); \
++		${mkinstalldirs} $(DESTDIR)$(libdir); \
++		$(INSTALL_DATA) $(TARGETLIB) $(DESTDIR)$(libdir)/$(TARGETLIB)n; \
++		( cd $(DESTDIR)$(libdir) ; chmod 644 $(TARGETLIB)n ;$(RANLIB) $(TARGETLIB)n ); \
++		mv -f $(DESTDIR)$(libdir)/$(TARGETLIB)n $(DESTDIR)$(libdir)/$(TARGETLIB); \
+ 		case "${target_header_dir}" in \
+ 		  /*)    thd=${target_header_dir};; \
+ 		  *)     thd=${includedir}/${target_header_dir};; \
+@@ -382,10 +381,10 @@ install_to_libdir: all
+ 	@$(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=install
+ 
+ install_to_tooldir: all
+-	${mkinstalldirs} $(DESTDIR)$(tooldir)/lib/$(MULTIOSDIR)
+-	$(INSTALL_DATA) $(TARGETLIB) $(DESTDIR)$(tooldir)/lib/$(MULTIOSDIR)/$(TARGETLIB)n
+-	( cd $(DESTDIR)$(tooldir)/lib/$(MULTIOSDIR) ; chmod 644 $(TARGETLIB)n; $(RANLIB) $(TARGETLIB)n )
+-	mv -f $(DESTDIR)$(tooldir)/lib/$(MULTIOSDIR)/$(TARGETLIB)n $(DESTDIR)$(tooldir)/lib/$(MULTIOSDIR)/$(TARGETLIB)
++	${mkinstalldirs} $(DESTDIR)$(tooldir)/lib
++	$(INSTALL_DATA) $(TARGETLIB) $(DESTDIR)$(tooldir)/lib/$(TARGETLIB)n
++	( cd $(DESTDIR)$(tooldir)/lib ; chmod 644 $(TARGETLIB)n; $(RANLIB) $(TARGETLIB)n )
++	mv -f $(DESTDIR)$(tooldir)/lib/$(TARGETLIB)n $(DESTDIR)$(tooldir)/lib/$(TARGETLIB)
+ 	@$(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=install
+ 
+ # required-list was used when building a shared bfd/opcodes/libiberty
diff --git a/riscv64-none-elf-xuantie-gcc/patches/patch-libquadmath_printf_quadmath-printf.c b/riscv64-none-elf-xuantie-gcc/patches/patch-libquadmath_printf_quadmath-printf.c
new file mode 100644
index 0000000000..6a165c7e25
--- /dev/null
+++ b/riscv64-none-elf-xuantie-gcc/patches/patch-libquadmath_printf_quadmath-printf.c
@@ -0,0 +1,26 @@
+$NetBSD: patch-libquadmath_printf_quadmath-printf.c,v 1.1 2022/06/16 15:43:55 adam 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?".  */
diff --git a/riscv64-none-elf-xuantie-gcc/patches/patch-libquadmath_strtod_strtod__l.c b/riscv64-none-elf-xuantie-gcc/patches/patch-libquadmath_strtod_strtod__l.c
new file mode 100644
index 0000000000..8f5e8751c2
--- /dev/null
+++ b/riscv64-none-elf-xuantie-gcc/patches/patch-libquadmath_strtod_strtod__l.c
@@ -0,0 +1,23 @@
+$NetBSD: patch-libquadmath_strtod_strtod__l.c,v 1.1 2022/06/16 15:43:55 adam 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; })
diff --git a/riscv64-none-elf-xuantie-gcc/patches/patch-libstdc++-v3_libsupc++_new__opa.cc b/riscv64-none-elf-xuantie-gcc/patches/patch-libstdc++-v3_libsupc++_new__opa.cc
new file mode 100644
index 0000000000..4d3b01d2d2
--- /dev/null
+++ b/riscv64-none-elf-xuantie-gcc/patches/patch-libstdc++-v3_libsupc++_new__opa.cc
@@ -0,0 +1,17 @@
+$NetBSD: patch-libstdc++-v3_libsupc++_new__opa.cc,v 1.1 2022/06/16 15:43:55 adam 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;


Home | Main Index | Thread Index | Old Index