1diff -rNU3 dist.nbsd/gcc/config.gcc dist/gcc/config.gcc
2--- dist.nbsd/gcc/config.gcc	2015-10-16 12:40:18.000000000 +0200
3+++ dist/gcc/config.gcc	2015-10-16 13:35:51.000000000 +0200
4@@ -704,6 +704,12 @@
5   tmake_file="${tmake_file} t-glibc"
6   target_has_targetcm=yes
7   ;;
8+*-*-minix*)
9+  tmake_file="t-slibgcc"
10+  gas=yes
11+  gnu_ld=yes
12+  default_use_cxa_atexit=yes
13+  ;;
14 *-*-netbsd*)
15   tmake_file="t-slibgcc"
16   gas=yes
17@@ -887,6 +893,34 @@
18 	extra_options="${extra_options} arm/vxworks.opt"
19 	tmake_file="${tmake_file} arm/t-arm arm/t-vxworks"
20 	;;
21+arm*-*-minix*)
22+	tmake_file="${tmake_file} arm/t-arm arm/t-arm-elf"
23+	tm_file="dbxelf.h elfos.h arm/unknown-elf.h arm/elf.h arm/aout.h arm/arm.h"
24+	extra_options="${extra_options} netbsd.opt netbsd-elf.opt"
25+
26+	    tm_file="$tm_file arm/bpabi.h"
27+	    tmake_file="$tmake_file arm/t-bpabi t-minix"
28+
29+	    # The BPABI long long divmod functions return a 128-bit value in
30+	    # registers r0-r3.  Correctly modeling that requires the use of
31+	    # TImode.
32+	    need_64bit_hwint=yes
33+	    # The EABI requires the use of __cxa_atexit.
34+	    default_use_cxa_atexit=yes
35+
36+	case ${target} in
37+	arm*-*-minix-*hf*)
38+	    tm_defines="${tm_defines} TARGET_DEFAULT_FLOAT_ABI=ARM_FLOAT_ABI_HARD"
39+	    ;;
40+	esac
41+	case ${target} in
42+	armv4*) with_cpu=${with_cpu:-strongarm};;
43+	armv6*) with_cpu=${with_cpu:-arm1176jzf-s};;
44+	armv7*) with_cpu=${with_cpu:-cortex-a8};;
45+	esac
46+	tm_file="$tm_file arm/eabi.h newlib-stdint.h minix-spec.h arm/minix.h minix.h"
47+	tmake_file="$tmake_file arm/t-arm-softfp soft-fp/t-softfp"
48+	;;
49 arm*-*-netbsdelf*)
50 	tmake_file="${tmake_file} arm/t-arm"
51 	tm_file="dbxelf.h elfos.h ${nbsd_tm_file} arm/elf.h arm/aout.h arm/arm.h"
52@@ -1287,6 +1321,11 @@
53 x86_64-*-freebsd*)
54 	tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h ${fbsd_tm_file} i386/x86-64.h i386/freebsd.h i386/freebsd64.h"
55 	;;
56+i[34567]86-*-minix)
57+	tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h minix-spec.h i386/minix.h minix.h"
58+	tmake_file="${tmake_file} i386/t-crtstuff"
59+	extra_options="${extra_options} netbsd.opt netbsd-elf.opt"
60+	;;
61 i[34567]86-*-netbsdelf*)
62 	tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h ${nbsd_tm_file} i386/netbsd-elf.h"
63 	tmake_file="${tmake_file} i386/t-crtstuff"
64diff -rNU3 dist.nbsd/gcc/gcov.c dist/gcc/gcov.c
65--- dist.nbsd/gcc/gcov.c	2015-10-16 12:40:18.000000000 +0200
66+++ dist/gcc/gcov.c	2015-10-16 13:36:18.000000000 +0200
67@@ -62,6 +62,10 @@
68
69 /* This is the size of the buffer used to read in source file lines.  */
70
71+#if defined(__minix)
72+#define block_t gcc_block_t
73+#endif
74+
75 struct function_info;
76 struct block_info;
77 struct source_info;
78diff -rNU3 dist.nbsd/gcc/ginclude/stddef.h dist/gcc/ginclude/stddef.h
79--- dist.nbsd/gcc/ginclude/stddef.h	2015-10-16 12:40:18.000000000 +0200
80+++ dist/gcc/ginclude/stddef.h	2015-10-16 13:35:25.000000000 +0200
81@@ -48,7 +48,7 @@
82
83 /* On 4.3bsd-net2, make sure ansi.h is included, so we have
84    one less case to deal with in the following.  */
85-#if defined (__BSD_NET2__) || defined (____386BSD____) || (defined (__FreeBSD__) && (__FreeBSD__ < 5)) || defined(__NetBSD__)
86+#if defined (__BSD_NET2__) || defined (____386BSD____) || (defined (__FreeBSD__) && (__FreeBSD__ < 5)) || defined(__NetBSD__) || defined(__minix)
87 #ifndef inhibit_libc
88 #include <machine/ansi.h>
89 #endif
90diff -rNU3 dist.nbsd/libgcc/config.host dist/libgcc/config.host
91--- dist.nbsd/libgcc/config.host	2015-10-16 12:40:19.000000000 +0200
92+++ dist/libgcc/config.host	2015-10-16 13:36:44.000000000 +0200
93@@ -325,6 +325,10 @@
94 	tmake_file="$tmake_file arm/t-arm arm/t-vxworks t-softfp-sfdf t-softfp-excl arm/t-softfp t-softfp"
95 	extra_parts="$extra_parts crti.o crtn.o"
96 	;;
97+arm*-*-minix*)
98+	tmake_file="$tmake_file arm/t-arm"
99+	unwind_header=config/arm/unwind-arm.h
100+	;;
101 arm*-*-netbsdelf*)
102 	tmake_file="$tmake_file arm/t-arm"
103 	case ${host} in
104@@ -525,6 +529,8 @@
105 x86_64-*-freebsd*)
106 	tmake_file="${tmake_file} i386/t-freebsd i386/t-crtstuff"
107 	;;
108+i[34567]86-*-minix*)
109+	;;
110 i[34567]86-*-netbsdelf*)
111 	;;
112 x86_64-*-netbsd*)
113