From 75e1abafd68c2eb6ded0d311facd918a7e0b8517 Mon Sep 17 00:00:00 2001 From: Santurysim Date: Sun, 18 Jul 2021 21:49:21 +0300 Subject: [PATCH 1/2] Fix GCC 10+ cross-compiling issues Current master cannot be cross-compiled due to gcc breaking changes. This patchset is a workaround for this problem until source tree is synchronized with current NetBSD. There is a binutils patch which I cannot add to pull request, so I link it here: https://gist.github.com/Santurysim/1973b8f723fb36242c9558a23408d469 --- bin/pax/extern.h | 1 - bin/pax/options.c | 2 ++ external/bsd/llvm/dist/llvm/include/llvm/IR/ValueMap.h | 2 +- sbin/newfs_udf/newfs_udf.h | 4 ++-- sbin/newfs_udf/udf_create.c | 4 ++++ usr.bin/make/main.c | 2 ++ usr.bin/make/make.h | 2 +- usr.sbin/installboot/machines.c | 2 -- 8 files changed, 12 insertions(+), 7 deletions(-) diff --git a/bin/pax/extern.h b/bin/pax/extern.h index 298600c2d..94ee13911 100644 --- a/bin/pax/extern.h +++ b/bin/pax/extern.h @@ -204,7 +204,6 @@ void options(int, char **); OPLIST * opt_next(void); int bad_opt(void); int mkpath(char *); -char *chdname; #if !HAVE_NBTOOL_CONFIG_H int do_chroot; #endif diff --git a/bin/pax/options.c b/bin/pax/options.c index 1af5fe4b7..5c5109ce3 100644 --- a/bin/pax/options.c +++ b/bin/pax/options.c @@ -214,6 +214,8 @@ int havechd = 0; * parser */ +char *chdname; + void options(int argc, char **argv) { diff --git a/external/bsd/llvm/dist/llvm/include/llvm/IR/ValueMap.h b/external/bsd/llvm/dist/llvm/include/llvm/IR/ValueMap.h index f2ea405f1..45ae7e784 100644 --- a/external/bsd/llvm/dist/llvm/include/llvm/IR/ValueMap.h +++ b/external/bsd/llvm/dist/llvm/include/llvm/IR/ValueMap.h @@ -101,7 +101,7 @@ public: ~ValueMap() {} - bool hasMD() const { return MDMap; } + bool hasMD() const { return (bool)MDMap; } MDMapT &MD() { if (!MDMap) MDMap.reset(new MDMapT); diff --git a/sbin/newfs_udf/newfs_udf.h b/sbin/newfs_udf/newfs_udf.h index 1c21a0b48..e9ff149a5 100644 --- a/sbin/newfs_udf/newfs_udf.h +++ b/sbin/newfs_udf/newfs_udf.h @@ -53,8 +53,8 @@ extern float meta_fract; /* shared structure between udf_create.c users */ -struct udf_create_context context; -struct udf_disclayout layout; +extern struct udf_create_context context; +extern struct udf_disclayout layout; /* prototypes */ int udf_write_sector(void *sector, uint64_t location); diff --git a/sbin/newfs_udf/udf_create.c b/sbin/newfs_udf/udf_create.c index ef92874af..6d95a2bf8 100644 --- a/sbin/newfs_udf/udf_create.c +++ b/sbin/newfs_udf/udf_create.c @@ -52,6 +52,10 @@ __RCSID("$NetBSD: udf_create.c,v 1.25 2015/06/16 23:18:55 christos Exp $"); # endif #endif +/* shared structure between udf_create.c users */ +struct udf_create_context context; +struct udf_disclayout layout; + /* * NOTE that there is some overlap between this code and the udf kernel fs. * This is intentially though it might better be factored out one day. diff --git a/usr.bin/make/main.c b/usr.bin/make/main.c index 73f4aaa9c..72a71f722 100644 --- a/usr.bin/make/main.c +++ b/usr.bin/make/main.c @@ -192,6 +192,8 @@ char *makeDependfile; pid_t myPid; int makelevel; +FILE *debug_file; + Boolean forceJobs = FALSE; extern Lst parseIncPath; diff --git a/usr.bin/make/make.h b/usr.bin/make/make.h index f162ef670..e07bba3cc 100644 --- a/usr.bin/make/make.h +++ b/usr.bin/make/make.h @@ -440,7 +440,7 @@ extern pid_t myPid; * There is one bit per module. It is up to the module what debug * information to print. */ -FILE *debug_file; /* Output written here - default stdout */ +extern FILE *debug_file; /* Output written here - default stdout */ extern int debug; #define DEBUG_ARCH 0x00001 #define DEBUG_COND 0x00002 diff --git a/usr.sbin/installboot/machines.c b/usr.sbin/installboot/machines.c index 357652b83..18ab832d3 100644 --- a/usr.sbin/installboot/machines.c +++ b/usr.sbin/installboot/machines.c @@ -48,13 +48,11 @@ __RCSID("$NetBSD: machines.c,v 1.39 2014/02/24 07:23:44 skrll Exp $"); */ struct ib_mach ib_mach_alpha, - ib_mach_amd64, ib_mach_amiga, ib_mach_emips, ib_mach_ews4800mips, ib_mach_hp300, ib_mach_hppa, - ib_mach_i386, ib_mach_landisk, ib_mach_macppc, ib_mach_news68k, From d83e5260a1511f4e2791f119ca08ebbe0a92a33b Mon Sep 17 00:00:00 2001 From: bvlgah Date: Mon, 4 Mar 2024 10:52:16 +0000 Subject: [PATCH 2/2] Improve fetching external projects and building speed, and fix compiling with more recent version of GCC --- external/gpl3/binutils/fetch.sh | 4 ++-- .../patches/0011-fix-gold-errors-header.patch | 10 ++++++++++ external/gpl3/gcc/fetch.sh | 5 +++-- .../gpl3/gcc/patches/0005-fix-gcc-reloads.patch | 16 ++++++++++++++++ releasetools/arm_sdimage.sh | 2 ++ 5 files changed, 33 insertions(+), 4 deletions(-) create mode 100644 external/gpl3/binutils/patches/0011-fix-gold-errors-header.patch create mode 100644 external/gpl3/gcc/patches/0005-fix-gcc-reloads.patch diff --git a/external/gpl3/binutils/fetch.sh b/external/gpl3/binutils/fetch.sh index 89100de5c..9f5d7fda1 100755 --- a/external/gpl3/binutils/fetch.sh +++ b/external/gpl3/binutils/fetch.sh @@ -5,8 +5,8 @@ echo $0 cd `dirname $0` # Configure fetch method -URL="http://www.minix3.org/pkgsrc/distfiles/minix/3.4.0/binutils-2.23.2.tar.bz2" -BACKUP_URL="http://ftp.gnu.org/gnu/binutils/binutils-2.23.2.tar.bz2" +URL="https://ftpmirror.gnu.org/gnu/binutils/binutils-2.23.2.tar.bz2" +BACKUP_URL="http://www.minix3.org/pkgsrc/distfiles/minix/3.4.0/binutils-2.23.2.tar.bz2" FETCH=ftp which curl >/dev/null if [ $? -eq 0 ]; then diff --git a/external/gpl3/binutils/patches/0011-fix-gold-errors-header.patch b/external/gpl3/binutils/patches/0011-fix-gold-errors-header.patch new file mode 100644 index 000000000..9254447a8 --- /dev/null +++ b/external/gpl3/binutils/patches/0011-fix-gold-errors-header.patch @@ -0,0 +1,10 @@ +--- dist.orig/gold/errors.h 2011-06-08 04:43:28.000000000 +0000 ++++ dist/gold/errors.h 2024-03-04 06:53:40.580217099 +0000 +@@ -24,6 +24,7 @@ + #define GOLD_ERRORS_H + + #include ++#include + + #include "gold-threads.h" + diff --git a/external/gpl3/gcc/fetch.sh b/external/gpl3/gcc/fetch.sh index d3d7eec39..a2ea5e0f4 100755 --- a/external/gpl3/gcc/fetch.sh +++ b/external/gpl3/gcc/fetch.sh @@ -9,8 +9,9 @@ cd `dirname $0` : ${SED=sed} # Configure fetch method -URL="http://www.minix3.org/pkgsrc/distfiles/minix/3.4.0/gcc-4.8.5.tar.bz2" -BACKUP_URL="ftp://ftp.gwdg.de/pub/misc/gcc/releases/gcc-4.8.5/gcc-4.8.5.tar.bz2" +# URL="http://www.minix3.org/pkgsrc/distfiles/minix/3.4.0/gcc-4.8.5.tar.bz2" +URL="https://ftpmirror.gnu.org/gnu/gcc/gcc-4.8.5/gcc-4.8.5.tar.bz2" +BACKUP_URL="http://www.minix3.org/pkgsrc/distfiles/minix/3.4.0/gcc-4.8.5.tar.bz2" FETCH=ftp if which curl >/dev/null then diff --git a/external/gpl3/gcc/patches/0005-fix-gcc-reloads.patch b/external/gpl3/gcc/patches/0005-fix-gcc-reloads.patch new file mode 100644 index 000000000..6d5eddce7 --- /dev/null +++ b/external/gpl3/gcc/patches/0005-fix-gcc-reloads.patch @@ -0,0 +1,16 @@ +--- dist.orig/gcc/reload1.c 2013-01-21 14:55:05.000000000 +0000 ++++ dist/gcc/reload1.c 2024-03-04 09:27:54.119538490 +0000 +@@ -436,11 +436,11 @@ + gen_rtx_REG (Pmode, + LAST_VIRTUAL_REGISTER + 1), + GEN_INT (4))); +- spill_indirect_levels = 0; ++ spill_indirect_levels = false; + + while (memory_address_p (QImode, tem)) + { +- spill_indirect_levels++; ++ spill_indirect_levels = true; + tem = gen_rtx_MEM (Pmode, tem); + } + diff --git a/releasetools/arm_sdimage.sh b/releasetools/arm_sdimage.sh index 94d107695..5340bb8a7 100755 --- a/releasetools/arm_sdimage.sh +++ b/releasetools/arm_sdimage.sh @@ -23,6 +23,8 @@ fi : ${OBJ=../obj.${ARCH}} : ${TOOLCHAIN_TRIPLET=arm-elf32-minix-} : ${BUILDSH=build.sh} +# Set the number of parallel build jobs the same number of CPU cores. +: ${JOBS=$(nproc)} : ${SETS="minix-base minix-comp minix-games minix-man minix-tests tests"} : ${IMG=minix_arm_sd.img}