Browse Source

gcc: Add GCC 4.6 patches from official openwrt.git toolchain directory.

Signed-off-by: Christian Beier <dontmind@freeshell.org>
Christian Beier 10 years ago
parent
commit
e1be3f55d8

+ 23
- 0
devel/gcc/patches/010-documentation.patch View File

@@ -0,0 +1,23 @@
1
+--- a/gcc/Makefile.in
2
++++ b/gcc/Makefile.in
3
+@@ -4251,18 +4251,10 @@
4
+ doc/gccint.info: $(TEXI_GCCINT_FILES)
5
+ doc/cppinternals.info: $(TEXI_CPPINT_FILES)
6
+ 
7
+-doc/%.info: %.texi
8
+-	if [ x$(BUILD_INFO) = xinfo ]; then \
9
+-		$(MAKEINFO) $(MAKEINFOFLAGS) -I . -I $(gcc_docdir) \
10
+-			-I $(gcc_docdir)/include -o $@ $<; \
11
+-	fi
12
++doc/%.info:
13
+ 
14
+ # Duplicate entry to handle renaming of gccinstall.info
15
+-doc/gccinstall.info: $(TEXI_GCCINSTALL_FILES)
16
+-	if [ x$(BUILD_INFO) = xinfo ]; then \
17
+-		$(MAKEINFO) $(MAKEINFOFLAGS) -I $(gcc_docdir) \
18
+-			-I $(gcc_docdir)/include -o $@ $<; \
19
+-	fi
20
++doc/gccinstall.info:
21
+ 
22
+ doc/cpp.dvi: $(TEXI_CPP_FILES)
23
+ doc/gcc.dvi: $(TEXI_GCC_FILES)

+ 70
- 0
devel/gcc/patches/020-gcc_bug_54295.patch View File

@@ -0,0 +1,70 @@
1
+diff -urN a/gcc/tree-ssa-math-opts.c b/gcc/tree-ssa-math-opts.c
2
+--- a/gcc/tree-ssa-math-opts.c	2012-12-12 18:05:23.000000000 +0100
3
++++ b/gcc/tree-ssa-math-opts.c	2013-04-29 15:54:00.051998936 +0200
4
+@@ -1280,6 +1280,47 @@
5
+   return result;
6
+ }
7
+ 
8
++/* Return true if stmt is a type conversion operation that can be stripped
9
++   when used in a widening multiply operation.  */
10
++static bool
11
++widening_mult_conversion_strippable_p (tree result_type, gimple stmt)
12
++{
13
++  enum tree_code rhs_code = gimple_assign_rhs_code (stmt);
14
++
15
++  if (TREE_CODE (result_type) == INTEGER_TYPE)
16
++    {
17
++      tree op_type;
18
++      tree inner_op_type;
19
++
20
++      if (!CONVERT_EXPR_CODE_P (rhs_code))
21
++	return false;
22
++
23
++      op_type = TREE_TYPE (gimple_assign_lhs (stmt));
24
++
25
++      /* If the type of OP has the same precision as the result, then
26
++	 we can strip this conversion.  The multiply operation will be
27
++	 selected to create the correct extension as a by-product.  */
28
++      if (TYPE_PRECISION (result_type) == TYPE_PRECISION (op_type))
29
++	return true;
30
++
31
++      /* We can also strip a conversion if it preserves the signed-ness of
32
++	 the operation and doesn't narrow the range.  */
33
++      inner_op_type = TREE_TYPE (gimple_assign_rhs1 (stmt));
34
++
35
++      /* If the inner-most type is unsigned, then we can strip any
36
++	 intermediate widening operation.  If it's signed, then the
37
++	 intermediate widening operation must also be signed.  */
38
++      if ((TYPE_UNSIGNED (inner_op_type)
39
++	   || TYPE_UNSIGNED (op_type) == TYPE_UNSIGNED (inner_op_type))
40
++	  && TYPE_PRECISION (op_type) > TYPE_PRECISION (inner_op_type))
41
++	return true;
42
++
43
++      return false;
44
++    }
45
++
46
++  return rhs_code == FIXED_CONVERT_EXPR;
47
++}
48
++
49
+ /* Return true if RHS is a suitable operand for a widening multiplication,
50
+    assuming a target type of TYPE.
51
+    There are two cases:
52
+@@ -1296,17 +1337,13 @@
53
+ {
54
+   gimple stmt;
55
+   tree type1, rhs1;
56
+-  enum tree_code rhs_code;
57
+ 
58
+   if (TREE_CODE (rhs) == SSA_NAME)
59
+     {
60
+       stmt = SSA_NAME_DEF_STMT (rhs);
61
+       if (is_gimple_assign (stmt))
62
+ 	{
63
+-	  rhs_code = gimple_assign_rhs_code (stmt);
64
+-	  if (TREE_CODE (type) == INTEGER_TYPE
65
+-	      ? !CONVERT_EXPR_CODE_P (rhs_code)
66
+-	      : rhs_code != FIXED_CONVERT_EXPR)
67
++	  if (! widening_mult_conversion_strippable_p (type, stmt))
68
+ 	    rhs1 = rhs;
69
+ 	  else
70
+ 	    {

+ 16
- 0
devel/gcc/patches/030-gcc_bug_48403.patch View File

@@ -0,0 +1,16 @@
1
+--- a/gcc/haifa-sched.c
2
++++ b/gcc/haifa-sched.c
3
+@@ -4654,10 +4654,12 @@ schedule_block (basic_block *target_bb)
4
+ 
5
+ 	  if (recog_memoized (insn) >= 0)
6
+ 	    {
7
++	      memcpy (temp_state, curr_state, dfa_state_size);
8
+ 	      cost = state_transition (curr_state, insn);
9
+ 	      if (sched_pressure != SCHED_PRESSURE_WEIGHTED)
10
+ 		gcc_assert (cost < 0);
11
+-	      cycle_issued_insns++;
12
++	      if (memcmp (temp_state, curr_state, dfa_state_size) != 0)
13
++		cycle_issued_insns++;
14
+ 	      asm_p = false;
15
+ 	    }
16
+ 	  else

+ 65
- 0
devel/gcc/patches/040-gcc_bug_49696.patch View File

@@ -0,0 +1,65 @@
1
+--- a/gcc/config/mips/sync.md
2
++++ b/gcc/config/mips/sync.md
3
+@@ -136,7 +136,7 @@
4
+           [(match_operand:SI 1 "register_operand" "d")
5
+ 	   (match_operand:SI 2 "register_operand" "d")
6
+ 	   (atomic_hiqi_op:SI (match_dup 0)
7
+-			      (match_operand:SI 3 "register_operand" "dJ"))]
8
++			      (match_operand:SI 3 "reg_or_0_operand" "dJ"))]
9
+ 	  UNSPEC_SYNC_OLD_OP_12))
10
+    (clobber (match_scratch:SI 4 "=&d"))]
11
+   "GENERATE_LL_SC"
12
+@@ -177,7 +177,7 @@
13
+           [(match_operand:SI 2 "register_operand" "d")
14
+ 	   (match_operand:SI 3 "register_operand" "d")
15
+ 	   (atomic_hiqi_op:SI (match_dup 0)
16
+-			      (match_operand:SI 4 "register_operand" "dJ"))]
17
++			      (match_operand:SI 4 "reg_or_0_operand" "dJ"))]
18
+ 	  UNSPEC_SYNC_OLD_OP_12))
19
+    (clobber (match_scratch:SI 5 "=&d"))]
20
+   "GENERATE_LL_SC"
21
+@@ -218,7 +218,7 @@
22
+ 	   (match_operand:SI 2 "register_operand" "d")
23
+ 	   (match_operand:SI 3 "register_operand" "d")
24
+ 	   (atomic_hiqi_op:SI (match_dup 0)
25
+-			      (match_operand:SI 4 "register_operand" "dJ"))]
26
++			      (match_operand:SI 4 "reg_or_0_operand" "dJ"))]
27
+ 	  UNSPEC_SYNC_NEW_OP_12))
28
+    (set (match_dup 1)
29
+ 	(unspec_volatile:SI
30
+@@ -259,7 +259,7 @@
31
+           [(match_operand:SI 1 "register_operand" "d")
32
+ 	   (match_operand:SI 2 "register_operand" "d")
33
+ 	   (match_dup 0)
34
+-	   (match_operand:SI 3 "register_operand" "dJ")]
35
++	   (match_operand:SI 3 "reg_or_0_operand" "dJ")]
36
+ 	  UNSPEC_SYNC_OLD_OP_12))
37
+    (clobber (match_scratch:SI 4 "=&d"))]
38
+   "GENERATE_LL_SC"
39
+@@ -298,7 +298,7 @@
40
+ 	(unspec_volatile:SI
41
+           [(match_operand:SI 2 "register_operand" "d")
42
+ 	   (match_operand:SI 3 "register_operand" "d")
43
+-	   (match_operand:SI 4 "register_operand" "dJ")]
44
++	   (match_operand:SI 4 "reg_or_0_operand" "dJ")]
45
+ 	  UNSPEC_SYNC_OLD_OP_12))
46
+    (clobber (match_scratch:SI 5 "=&d"))]
47
+   "GENERATE_LL_SC"
48
+@@ -337,7 +337,7 @@
49
+           [(match_operand:SI 1 "memory_operand" "+R")
50
+ 	   (match_operand:SI 2 "register_operand" "d")
51
+ 	   (match_operand:SI 3 "register_operand" "d")
52
+-	   (match_operand:SI 4 "register_operand" "dJ")]
53
++	   (match_operand:SI 4 "reg_or_0_operand" "dJ")]
54
+ 	  UNSPEC_SYNC_NEW_OP_12))
55
+    (set (match_dup 1)
56
+ 	(unspec_volatile:SI
57
+@@ -546,7 +546,7 @@
58
+    (set (match_dup 1)
59
+ 	(unspec_volatile:SI [(match_operand:SI 2 "register_operand" "d")
60
+ 			     (match_operand:SI 3 "register_operand" "d")
61
+-			     (match_operand:SI 4 "arith_operand" "dJ")]
62
++			     (match_operand:SI 4 "reg_or_0_operand" "dJ")]
63
+ 	  UNSPEC_SYNC_EXCHANGE_12))]
64
+   "GENERATE_LL_SC"
65
+   { return mips_output_sync_loop (insn, operands); }

+ 33
- 0
devel/gcc/patches/100-uclibc-conf.patch View File

@@ -0,0 +1,33 @@
1
+--- a/contrib/regression/objs-gcc.sh
2
++++ b/contrib/regression/objs-gcc.sh
3
+@@ -106,6 +106,10 @@ if [ $H_REAL_TARGET = $H_REAL_HOST -a $H
4
+  then
5
+   make all-gdb all-dejagnu all-ld || exit 1
6
+   make install-gdb install-dejagnu install-ld || exit 1
7
++elif [ $H_REAL_TARGET = $H_REAL_HOST -a $H_REAL_TARGET = i686-pc-linux-uclibc ]
8
++ then
9
++  make all-gdb all-dejagnu all-ld || exit 1
10
++  make install-gdb install-dejagnu install-ld || exit 1
11
+ elif [ $H_REAL_TARGET = $H_REAL_HOST ] ; then
12
+   make bootstrap || exit 1
13
+   make install || exit 1
14
+--- a/libjava/classpath/ltconfig
15
++++ b/libjava/classpath/ltconfig
16
+@@ -603,7 +603,7 @@ host_os=`echo $host | sed 's/^\([^-]*\)-
17
+ 
18
+ # Transform linux* to *-*-linux-gnu*, to support old configure scripts.
19
+ case $host_os in
20
+-linux-gnu*) ;;
21
++linux-gnu*|linux-uclibc*) ;;
22
+ linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
23
+ esac
24
+ 
25
+@@ -1247,7 +1247,7 @@ linux-gnuoldld* | linux-gnuaout* | linux
26
+   ;;
27
+ 
28
+ # This must be Linux ELF.
29
+-linux-gnu*)
30
++linux*)
31
+   version_type=linux
32
+   need_lib_prefix=no
33
+   need_version=no

+ 240
- 0
devel/gcc/patches/200-musl.patch View File

@@ -0,0 +1,240 @@
1
+--- a/config.sub
2
++++ b/config.sub
3
+@@ -125,6 +125,7 @@ esac
4
+ maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
5
+ case $maybe_os in
6
+   nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
7
++  linux-musl* | \
8
+   linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
9
+   knetbsd*-gnu* | netbsd*-gnu* | \
10
+   kopensolaris*-gnu* | \
11
+--- a/gcc/config.gcc
12
++++ b/gcc/config.gcc
13
+@@ -485,7 +485,7 @@ case ${target} in
14
+ esac
15
+ 
16
+ # Common C libraries.
17
+-tm_defines="$tm_defines LIBC_GLIBC=1 LIBC_UCLIBC=2 LIBC_BIONIC=3"
18
++tm_defines="$tm_defines LIBC_GLIBC=1 LIBC_UCLIBC=2 LIBC_BIONIC=3 LIBC_MUSL=4"
19
+ 
20
+ # Common parts for widely ported systems.
21
+ case ${target} in
22
+@@ -598,6 +598,9 @@ case ${target} in
23
+     *-*-*uclibc*)
24
+       tm_defines="$tm_defines DEFAULT_LIBC=LIBC_UCLIBC"
25
+       ;;
26
++    *-*-*musl*)
27
++      tm_defines="$tm_defines DEFAULT_LIBC=LIBC_MUSL"
28
++      ;;
29
+     *)
30
+       tm_defines="$tm_defines DEFAULT_LIBC=LIBC_GLIBC"
31
+       ;;
32
+--- a/gcc/config/arm/linux-eabi.h
33
++++ b/gcc/config/arm/linux-eabi.h
34
+@@ -78,6 +78,10 @@
35
+     %{mfloat-abi=soft*:" GLIBC_DYNAMIC_LINKER_SOFT_FLOAT "} \
36
+     %{!mfloat-abi=*:" GLIBC_DYNAMIC_LINKER_DEFAULT "}"
37
+ 
38
++/* musl has no "classic" (i.e. broken) mode */
39
++#undef  MUSL_DYNAMIC_LINKER
40
++#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-arm.so.1"
41
++
42
+ /* At this point, bpabi.h will have clobbered LINK_SPEC.  We want to
43
+    use the GNU/Linux version, not the generic BPABI version.  */
44
+ #undef  LINK_SPEC
45
+--- a/gcc/config/i386/linux.h
46
++++ b/gcc/config/i386/linux.h
47
+@@ -93,6 +93,7 @@ along with GCC; see the file COPYING3.
48
+ /* These macros may be overridden in k*bsd-gnu.h and i386/k*bsd-gnu.h. */
49
+ #define LINK_EMULATION "elf_i386"
50
+ #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
51
++#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-i386.so.1"
52
+ 
53
+ #undef  ASM_SPEC
54
+ #define ASM_SPEC \
55
+--- a/gcc/config/i386/linux64.h
56
++++ b/gcc/config/i386/linux64.h
57
+@@ -65,6 +65,9 @@ see the files COPYING3 and COPYING.RUNTI
58
+ #define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
59
+ #define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux-x86-64.so.2"
60
+ 
61
++#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-i386.so.1"
62
++#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-x86_64.so.1"
63
++
64
+ #if TARGET_64BIT_DEFAULT
65
+ #define SPEC_32 "m32"
66
+ #define SPEC_64 "!m32"
67
+--- a/gcc/config/linux.h
68
++++ b/gcc/config/linux.h
69
+@@ -33,10 +33,12 @@ see the files COPYING3 and COPYING.RUNTI
70
+ #define OPTION_GLIBC  (DEFAULT_LIBC == LIBC_GLIBC)
71
+ #define OPTION_UCLIBC (DEFAULT_LIBC == LIBC_UCLIBC)
72
+ #define OPTION_BIONIC (DEFAULT_LIBC == LIBC_BIONIC)
73
++#define OPTION_MUSL   (DEFAULT_LIBC == LIBC_MUSL)
74
+ #else
75
+ #define OPTION_GLIBC  (linux_libc == LIBC_GLIBC)
76
+ #define OPTION_UCLIBC (linux_libc == LIBC_UCLIBC)
77
+ #define OPTION_BIONIC (linux_libc == LIBC_BIONIC)
78
++#define OPTION_MUSL   (linux_libc == LIBC_MUSL)
79
+ #endif
80
+ 
81
+ #define LINUX_TARGET_OS_CPP_BUILTINS()				\
82
+@@ -54,18 +56,21 @@ see the files COPYING3 and COPYING.RUNTI
83
+    uClibc or Bionic is the default C library and whether
84
+    -muclibc or -mglibc or -mbionic has been passed to change the default.  */
85
+ 
86
+-#define CHOOSE_DYNAMIC_LINKER1(LIBC1, LIBC2, LIBC3, LD1, LD2, LD3)	\
87
+-  "%{" LIBC2 ":" LD2 ";:%{" LIBC3 ":" LD3 ";:" LD1 "}}"
88
++#define CHOOSE_DYNAMIC_LINKER1(LIBC1, LIBC2, LIBC3, LIBC4, LD1, LD2, LD3, LD4)	\
89
++  "%{" LIBC2 ":" LD2 ";:%{" LIBC3 ":" LD3 ";:%{" LIBC4 ":" LD4 ";:" LD1 "}}}"
90
+ 
91
+ #if DEFAULT_LIBC == LIBC_GLIBC
92
+-#define CHOOSE_DYNAMIC_LINKER(G, U, B) \
93
+-  CHOOSE_DYNAMIC_LINKER1 ("mglibc", "muclibc", "mbionic", G, U, B)
94
++#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
95
++  CHOOSE_DYNAMIC_LINKER1 ("mglibc", "muclibc", "mbionic", "mmusl", G, U, B, M)
96
+ #elif DEFAULT_LIBC == LIBC_UCLIBC
97
+-#define CHOOSE_DYNAMIC_LINKER(G, U, B) \
98
+-  CHOOSE_DYNAMIC_LINKER1 ("muclibc", "mglibc", "mbionic", U, G, B)
99
++#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
100
++  CHOOSE_DYNAMIC_LINKER1 ("muclibc", "mglibc", "mbionic", "mmusl", U, G, B, M)
101
+ #elif DEFAULT_LIBC == LIBC_BIONIC
102
+-#define CHOOSE_DYNAMIC_LINKER(G, U, B) \
103
+-  CHOOSE_DYNAMIC_LINKER1 ("mbionic", "mglibc", "muclibc", B, G, U)
104
++#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
105
++  CHOOSE_DYNAMIC_LINKER1 ("mbionic", "mglibc", "muclibc", "mmusl", B, G, U, M)
106
++#elif DEFAULT_LIBC == LIBC_MUSL
107
++#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
108
++  CHOOSE_DYNAMIC_LINKER1 ("mmusl", "mglibc", "muclibc", "mbionic", M, G, U, B)
109
+ #else
110
+ #error "Unsupported DEFAULT_LIBC"
111
+ #endif /* DEFAULT_LIBC */
112
+@@ -83,13 +88,13 @@ see the files COPYING3 and COPYING.RUNTI
113
+ 
114
+ #define LINUX_DYNAMIC_LINKER						\
115
+   CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER,	\
116
+-			 BIONIC_DYNAMIC_LINKER)
117
++			 BIONIC_DYNAMIC_LINKER, MUSL_DYNAMIC_LINKER)
118
+ #define LINUX_DYNAMIC_LINKER32						\
119
+   CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32, \
120
+-			 BIONIC_DYNAMIC_LINKER32)
121
++			 BIONIC_DYNAMIC_LINKER32, MUSL_DYNAMIC_LINKER32)
122
+ #define LINUX_DYNAMIC_LINKER64						\
123
+   CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64, \
124
+-			 BIONIC_DYNAMIC_LINKER64)
125
++			 BIONIC_DYNAMIC_LINKER64, MUSL_DYNAMIC_LINKER64)
126
+ 
127
+ /* Determine whether the entire c99 runtime
128
+    is present in the runtime library.  */
129
+--- a/gcc/config/linux.opt
130
++++ b/gcc/config/linux.opt
131
+@@ -30,3 +30,7 @@ Use GNU C library
132
+ muclibc
133
+ Target Report RejectNegative Var(linux_libc,LIBC_UCLIBC) Negative(mbionic)
134
+ Use uClibc C library
135
++
136
++mmusl
137
++Target Report RejectNegative Var(linux_libc,LIBC_MUSL) Negative(mglibc)
138
++Use musl C library
139
+--- a/gcc/config/mips/linux.h
140
++++ b/gcc/config/mips/linux.h
141
+@@ -63,6 +63,8 @@ along with GCC; see the file COPYING3.
142
+ 
143
+ #define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
144
+ 
145
++#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-mips.so.1"
146
++
147
+ /* Borrowed from sparc/linux.h */
148
+ #undef LINK_SPEC
149
+ #define LINK_SPEC \
150
+--- a/gcc/ginclude/stddef.h
151
++++ b/gcc/ginclude/stddef.h
152
+@@ -184,6 +184,7 @@ typedef __PTRDIFF_TYPE__ ptrdiff_t;
153
+ #ifndef _GCC_SIZE_T
154
+ #ifndef _SIZET_
155
+ #ifndef __size_t
156
++#ifndef __DEFINED_size_t /* musl */
157
+ #define __size_t__	/* BeOS */
158
+ #define __SIZE_T__	/* Cray Unicos/Mk */
159
+ #define _SIZE_T
160
+@@ -200,6 +201,7 @@ typedef __PTRDIFF_TYPE__ ptrdiff_t;
161
+ #define ___int_size_t_h
162
+ #define _GCC_SIZE_T
163
+ #define _SIZET_
164
++#define __DEFINED_size_t /* musl */
165
+ #if defined (__FreeBSD__) && (__FreeBSD__ >= 5)
166
+ /* __size_t is a typedef on FreeBSD 5!, must not trash it. */
167
+ #else
168
+@@ -214,6 +216,7 @@ typedef __SIZE_TYPE__ size_t;
169
+ typedef long ssize_t;
170
+ #endif /* __BEOS__ */
171
+ #endif /* !(defined (__GNUG__) && defined (size_t)) */
172
++#endif /* __DEFINED_size_t */
173
+ #endif /* __size_t */
174
+ #endif /* _SIZET_ */
175
+ #endif /* _GCC_SIZE_T */
176
+--- a/libgomp/config/posix/time.c
177
++++ b/libgomp/config/posix/time.c
178
+@@ -28,6 +28,8 @@
179
+    The following implementation uses the most simple POSIX routines.
180
+    If present, POSIX 4 clocks should be used instead.  */
181
+ 
182
++#define _POSIX_C_SOURCE 199309L /* for clocks */
183
++
184
+ #include "libgomp.h"
185
+ #include <unistd.h>
186
+ #if TIME_WITH_SYS_TIME
187
+--- a/libstdc++-v3/configure.host
188
++++ b/libstdc++-v3/configure.host
189
+@@ -237,6 +237,13 @@ case "${host_os}" in
190
+     os_include_dir="os/bsd/freebsd"
191
+     ;;
192
+   gnu* | linux* | kfreebsd*-gnu | knetbsd*-gnu)
193
++    # check for musl by target
194
++    case "${host_os}" in
195
++      *-musl*)
196
++        os_include_dir="os/generic"
197
++        ;;
198
++      *)
199
++
200
+     if [ "$uclibc" = "yes" ]; then
201
+       os_include_dir="os/uclibc"
202
+     elif [ "$bionic" = "yes" ]; then
203
+@@ -245,6 +252,9 @@ case "${host_os}" in
204
+       os_include_dir="os/gnu-linux"
205
+     fi
206
+     ;;
207
++
208
++    esac
209
++    ;;
210
+   hpux*)
211
+     os_include_dir="os/hpux"
212
+     ;;
213
+--- a/gcc/config/mips/linux64.h
214
++++ b/gcc/config/mips/linux64.h
215
+@@ -40,9 +40,12 @@ along with GCC; see the file COPYING3.
216
+ #define GLIBC_DYNAMIC_LINKERN32 "/lib32/ld.so.1"
217
+ #define UCLIBC_DYNAMIC_LINKERN32 "/lib32/ld-uClibc.so.0"
218
+ #define BIONIC_DYNAMIC_LINKERN32 "/system/bin/linker32"
219
++#define MUSL_DYNAMIC_LINKERN32 "/lib/ld-musl-mips.so.1"
220
++#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-mips.so.1"
221
++#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-mips.so.1"
222
+ #define LINUX_DYNAMIC_LINKERN32 \
223
+   CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKERN32, UCLIBC_DYNAMIC_LINKERN32, \
224
+-			 BIONIC_DYNAMIC_LINKERN32)
225
++			 BIONIC_DYNAMIC_LINKERN32, MUSL_DYNAMIC_LINKERN32)
226
+ 
227
+ #undef LINK_SPEC
228
+ #define LINK_SPEC "\
229
+--- a/gcc/config/sparc/linux64.h	2013-09-10 10:02:45.663973856 +0100
230
++++ b/gcc/config/sparc/linux64.h	2013-09-10 10:03:17.871972435 +0100
231
+@@ -104,6 +104,9 @@
232
+ #define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
233
+ #define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux.so.2"
234
+ 
235
++#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-sparc.so.1"
236
++#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-sparc.so.1"
237
++
238
+ #ifdef SPARC_BI_ARCH
239
+ 
240
+ #undef SUBTARGET_EXTRA_SPECS

+ 11
- 0
devel/gcc/patches/301-missing-execinfo_h.patch View File

@@ -0,0 +1,11 @@
1
+--- a/boehm-gc/include/gc.h
2
++++ b/boehm-gc/include/gc.h
3
+@@ -503,7 +503,7 @@ GC_API GC_PTR GC_malloc_atomic_ignore_of
4
+ #if defined(__linux__) || defined(__GLIBC__)
5
+ # include <features.h>
6
+ # if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1 || __GLIBC__ > 2) \
7
+-     && !defined(__ia64__)
8
++     && !defined(__ia64__) && !defined(__UCLIBC__)
9
+ #   ifndef GC_HAVE_BUILTIN_BACKTRACE
10
+ #     define GC_HAVE_BUILTIN_BACKTRACE
11
+ #   endif

+ 11
- 0
devel/gcc/patches/302-c99-snprintf.patch View File

@@ -0,0 +1,11 @@
1
+--- a/libstdc++-v3/include/c_global/cstdio
2
++++ b/libstdc++-v3/include/c_global/cstdio
3
+@@ -137,7 +137,7 @@ namespace std
4
+   using ::vsprintf;
5
+ } // namespace
6
+ 
7
+-#if _GLIBCXX_USE_C99
8
++#if _GLIBCXX_USE_C99 || defined __UCLIBC__
9
+ 
10
+ #undef snprintf
11
+ #undef vfscanf

+ 47
- 0
devel/gcc/patches/305-libmudflap-susv3-legacy.patch View File

@@ -0,0 +1,47 @@
1
+--- a/libmudflap/mf-hooks2.c
2
++++ b/libmudflap/mf-hooks2.c
3
+@@ -421,7 +421,7 @@ WRAPPER2(void, bzero, void *s, size_t n)
4
+ {
5
+   TRACE ("%s\n", __PRETTY_FUNCTION__);
6
+   MF_VALIDATE_EXTENT(s, n, __MF_CHECK_WRITE, "bzero region");
7
+-  bzero (s, n);
8
++  memset (s, 0, n);
9
+ }
10
+ 
11
+ 
12
+@@ -431,7 +431,7 @@ WRAPPER2(void, bcopy, const void *src, v
13
+   TRACE ("%s\n", __PRETTY_FUNCTION__);
14
+   MF_VALIDATE_EXTENT(src, n, __MF_CHECK_READ, "bcopy src");
15
+   MF_VALIDATE_EXTENT(dest, n, __MF_CHECK_WRITE, "bcopy dest");
16
+-  bcopy (src, dest, n);
17
++  memmove (dest, src, n);
18
+ }
19
+ 
20
+ 
21
+@@ -441,7 +441,7 @@ WRAPPER2(int, bcmp, const void *s1, cons
22
+   TRACE ("%s\n", __PRETTY_FUNCTION__);
23
+   MF_VALIDATE_EXTENT(s1, n, __MF_CHECK_READ, "bcmp 1st arg");
24
+   MF_VALIDATE_EXTENT(s2, n, __MF_CHECK_READ, "bcmp 2nd arg");
25
+-  return bcmp (s1, s2, n);
26
++  return n == 0 ? 0 : memcmp (s1, s2, n);
27
+ }
28
+ 
29
+ 
30
+@@ -450,7 +450,7 @@ WRAPPER2(char *, index, const char *s, i
31
+   size_t n = strlen (s);
32
+   TRACE ("%s\n", __PRETTY_FUNCTION__);
33
+   MF_VALIDATE_EXTENT(s, CLAMPADD(n, 1), __MF_CHECK_READ, "index region");
34
+-  return index (s, c);
35
++  return strchr (s, c);
36
+ }
37
+ 
38
+ 
39
+@@ -459,7 +459,7 @@ WRAPPER2(char *, rindex, const char *s,
40
+   size_t n = strlen (s);
41
+   TRACE ("%s\n", __PRETTY_FUNCTION__);
42
+   MF_VALIDATE_EXTENT(s, CLAMPADD(n, 1), __MF_CHECK_READ, "rindex region");
43
+-  return rindex (s, c);
44
++  return strrchr (s, c);
45
+ }
46
+ 
47
+ /* XXX:  stpcpy, memccpy */

+ 11
- 0
devel/gcc/patches/800-arm_v5te_no_ldrd_strd.patch View File

@@ -0,0 +1,11 @@
1
+--- a/gcc/config/arm/arm.h
2
++++ b/gcc/config/arm/arm.h
3
+@@ -232,7 +232,7 @@ extern void (*arm_lang_output_object_att
4
+ #define TARGET_BACKTRACE	        (leaf_function_p () \
5
+ 				         ? TARGET_TPCS_LEAF_FRAME \
6
+ 				         : TARGET_TPCS_FRAME)
7
+-#define TARGET_LDRD			(arm_arch5e && ARM_DOUBLEWORD_ALIGN)
8
++#define TARGET_LDRD			(arm_arch6 && ARM_DOUBLEWORD_ALIGN)
9
+ #define TARGET_AAPCS_BASED \
10
+     (arm_abi != ARM_ABI_APCS && arm_abi != ARM_ABI_ATPCS)
11
+ 

+ 26
- 0
devel/gcc/patches/810-arm-softfloat-libgcc.patch View File

@@ -0,0 +1,26 @@
1
+--- a/gcc/config/arm/linux-elf.h
2
++++ b/gcc/config/arm/linux-elf.h
3
+@@ -60,7 +60,7 @@
4
+    %{shared:-lc} \
5
+    %{!shared:%{profile:-lc_p}%{!profile:-lc}}"
6
+ 
7
+-#define LIBGCC_SPEC "%{msoft-float:-lfloat} %{mfloat-abi=soft*:-lfloat} -lgcc"
8
++#define LIBGCC_SPEC "-lgcc"
9
+ 
10
+ #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
11
+ 
12
+--- a/gcc/config/arm/t-linux
13
++++ b/gcc/config/arm/t-linux
14
+@@ -23,7 +23,11 @@ TARGET_LIBGCC2_CFLAGS = -fomit-frame-poi
15
+ 
16
+ LIB1ASMSRC = arm/lib1funcs.asm
17
+ LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx _clzsi2 _clzdi2 \
18
+-	_arm_addsubdf3 _arm_addsubsf3
19
++	_arm_addsubdf3 _arm_addsubsf3 \
20
++	_arm_negdf2 _arm_muldivdf3 _arm_cmpdf2 _arm_unorddf2 \
21
++	_arm_fixdfsi _arm_fixunsdfsi _arm_truncdfsf2 \
22
++	_arm_negsf2 _arm_muldivsf3 _arm_cmpsf2 _arm_unordsf2 \
23
++	_arm_fixsfsi _arm_fixunssfsi
24
+ 
25
+ # MULTILIB_OPTIONS = mhard-float/msoft-float
26
+ # MULTILIB_DIRNAMES = hard-float soft-float

+ 36
- 0
devel/gcc/patches/820-libgcc_pic.patch View File

@@ -0,0 +1,36 @@
1
+--- a/libgcc/Makefile.in
2
++++ b/libgcc/Makefile.in
3
+@@ -747,11 +747,12 @@ $(libgcov-objects): %$(objext): $(gcc_sr
4
+ 
5
+ # Static libraries.
6
+ libgcc.a: $(libgcc-objects)
7
++libgcc_pic.a: $(libgcc-s-objects)
8
+ libgcov.a: $(libgcov-objects)
9
+ libunwind.a: $(libunwind-objects)
10
+ libgcc_eh.a: $(libgcc-eh-objects)
11
+ 
12
+-libgcc.a libgcov.a libunwind.a libgcc_eh.a:
13
++libgcc.a libgcov.a libunwind.a libgcc_eh.a libgcc_pic.a:
14
+ 	-rm -f $@
15
+ 
16
+ 	objects="$(objects)";					\
17
+@@ -773,7 +774,7 @@ libgcc_s$(SHLIB_EXT): libunwind$(SHLIB_E
18
+ endif
19
+ 
20
+ ifeq ($(enable_shared),yes)
21
+-all: libgcc_eh.a libgcc_s$(SHLIB_EXT)
22
++all: libgcc_eh.a libgcc_pic.a libgcc_s$(SHLIB_EXT)
23
+ ifneq ($(LIBUNWIND),)
24
+ all: libunwind$(SHLIB_EXT)
25
+ endif
26
+@@ -954,6 +955,10 @@ install-shared:
27
+ 	chmod 644 $(DESTDIR)$(inst_libdir)/libgcc_eh.a
28
+ 	$(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc_eh.a
29
+ 
30
++	$(INSTALL_DATA) libgcc_pic.a $(mapfile) $(DESTDIR)$(inst_libdir)/
31
++	chmod 644 $(DESTDIR)$(inst_libdir)/libgcc_pic.a
32
++	$(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc_pic.a
33
++
34
+ 	$(subst @multilib_dir@,$(MULTIDIR),$(subst \
35
+ 		@shlib_base_name@,libgcc_s,$(subst \
36
+ 		@shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(SHLIB_INSTALL))))

+ 13
- 0
devel/gcc/patches/830-arm_unbreak_armv4t.patch View File

@@ -0,0 +1,13 @@
1
+http://sourceware.org/ml/crossgcc/2008-05/msg00009.html
2
+
3
+--- a/gcc/config/arm/linux-eabi.h
4
++++ b/gcc/config/arm/linux-eabi.h
5
+@@ -46,7 +46,7 @@
6
+    The ARM10TDMI core is the default for armv5t, so set
7
+    SUBTARGET_CPU_DEFAULT to achieve this.  */
8
+ #undef  SUBTARGET_CPU_DEFAULT
9
+-#define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm10tdmi
10
++#define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm9tdmi
11
+ 
12
+ /* TARGET_BIG_ENDIAN_DEFAULT is set in
13
+    config.gcc for big endian configurations.  */

+ 19
- 0
devel/gcc/patches/840-armv4_pass_fix-v4bx_to_ld.patch View File

@@ -0,0 +1,19 @@
1
+--- a/gcc/config/arm/linux-eabi.h
2
++++ b/gcc/config/arm/linux-eabi.h
3
+@@ -82,10 +82,15 @@
4
+ #undef  MUSL_DYNAMIC_LINKER
5
+ #define MUSL_DYNAMIC_LINKER "/lib/ld-musl-arm.so.1"
6
+ 
7
++/* For armv4 we pass --fix-v4bx to linker to support EABI */
8
++#undef TARGET_FIX_V4BX_SPEC
9
++#define TARGET_FIX_V4BX_SPEC " %{mcpu=arm8|mcpu=arm810|mcpu=strongarm*"\
10
++  "|march=armv4|mcpu=fa526|mcpu=fa626:--fix-v4bx}"
11
++
12
+ /* At this point, bpabi.h will have clobbered LINK_SPEC.  We want to
13
+    use the GNU/Linux version, not the generic BPABI version.  */
14
+ #undef  LINK_SPEC
15
+-#define LINK_SPEC BE8_LINK_SPEC						\
16
++#define LINK_SPEC BE8_LINK_SPEC TARGET_FIX_V4BX_SPEC			\
17
+   LINUX_OR_ANDROID_LD (LINUX_TARGET_LINK_SPEC,				\
18
+ 		       LINUX_TARGET_LINK_SPEC " " ANDROID_LINK_SPEC)
19
+ 

+ 86
- 0
devel/gcc/patches/850-use_shared_libgcc.patch View File

@@ -0,0 +1,86 @@
1
+--- a/gcc/config/arm/linux-eabi.h
2
++++ b/gcc/config/arm/linux-eabi.h
3
+@@ -115,10 +115,6 @@
4
+ #define ENDFILE_SPEC \
5
+   LINUX_OR_ANDROID_LD (GNU_USER_TARGET_ENDFILE_SPEC, ANDROID_ENDFILE_SPEC)
6
+ 
7
+-/* Use the default LIBGCC_SPEC, not the version in linux-elf.h, as we
8
+-   do not use -lfloat.  */
9
+-#undef LIBGCC_SPEC
10
+-
11
+ /* Clear the instruction cache from `beg' to `end'.  This is
12
+    implemented in lib1funcs.asm, so ensure an error if this definition
13
+    is used.  */
14
+--- a/gcc/config/arm/linux-elf.h
15
++++ b/gcc/config/arm/linux-elf.h
16
+@@ -60,8 +60,6 @@
17
+    %{shared:-lc} \
18
+    %{!shared:%{profile:-lc_p}%{!profile:-lc}}"
19
+ 
20
+-#define LIBGCC_SPEC "-lgcc"
21
+-
22
+ #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
23
+ 
24
+ #define LINUX_TARGET_LINK_SPEC  "%{h*} \
25
+--- a/gcc/config/linux.h
26
++++ b/gcc/config/linux.h
27
+@@ -52,6 +52,10 @@ see the files COPYING3 and COPYING.RUNTI
28
+ 	builtin_assert ("system=posix");			\
29
+     } while (0)
30
+ 
31
++#ifndef LIBGCC_SPEC
32
++#define LIBGCC_SPEC "%{static|static-libgcc:-lgcc}%{!static:%{!static-libgcc:-lgcc_s}}"
33
++#endif
34
++
35
+ /* Determine which dynamic linker to use depending on whether GLIBC or
36
+    uClibc or Bionic is the default C library and whether
37
+    -muclibc or -mglibc or -mbionic has been passed to change the default.  */
38
+--- a/gcc/config/rs6000/linux.h
39
++++ b/gcc/config/rs6000/linux.h
40
+@@ -88,6 +88,8 @@
41
+ #define USE_LD_AS_NEEDED 1
42
+ #endif
43
+ 
44
++#define LIBGCC_SPEC "%{!static:%{!static-libgcc:-lgcc_s}} -lgcc"
45
++
46
+ #undef  TARGET_VERSION
47
+ #define TARGET_VERSION fprintf (stderr, " (PowerPC GNU/Linux)");
48
+ 
49
+--- a/gcc/mkmap-symver.awk
50
++++ b/gcc/mkmap-symver.awk
51
+@@ -132,5 +132,5 @@ function output(lib) {
52
+   else if (inherit[lib])
53
+     printf("} %s;\n", inherit[lib]);
54
+   else
55
+-    printf ("\n  local:\n\t*;\n};\n");
56
++    printf ("\n\t*;\n};\n");
57
+ }
58
+--- a/libgcc/Makefile.in
59
++++ b/libgcc/Makefile.in
60
+@@ -269,6 +269,12 @@ ifeq ($(enable_shared),yes)
61
+     install-libunwind = install-libunwind
62
+   endif
63
+ 
64
++else
65
++# Not enable_shared.
66
++iterator = $(srcdir)/empty.mk $(patsubst %,$(srcdir)/static-object.mk,$(iter-items))
67
++endif
68
++
69
++
70
+ # For -fvisibility=hidden.  We need both a -fvisibility=hidden on
71
+ # the command line, and a #define to prevent libgcc2.h etc from
72
+ # overriding that with #pragmas.
73
+@@ -291,13 +297,6 @@ else
74
+ gen-hide-list = echo > $@
75
+ endif
76
+ 
77
+-else
78
+-# Not enable_shared.
79
+-iterator = $(srcdir)/empty.mk $(patsubst %,$(srcdir)/static-object.mk,$(iter-items))
80
+-vis_hide =
81
+-gen-hide-list = echo > \$@
82
+-endif
83
+-
84
+ ifneq ($(EXTRA_PARTS),)
85
+   extra-parts = libgcc-extra-parts
86
+   INSTALL_PARTS = $(EXTRA_PARTS)

+ 29
- 0
devel/gcc/patches/860-uclibc_use_eh_frame.patch View File

@@ -0,0 +1,29 @@
1
+--- a/gcc/crtstuff.c
2
++++ b/gcc/crtstuff.c
3
+@@ -100,15 +100,20 @@ call_ ## FUNC (void)					\
4
+ #if defined(OBJECT_FORMAT_ELF) \
5
+     && !defined(OBJECT_FORMAT_FLAT) \
6
+     && defined(HAVE_LD_EH_FRAME_HDR) \
7
+-    && !defined(inhibit_libc) && !defined(CRTSTUFFT_O) \
8
+-    && defined(__GLIBC__) && __GLIBC__ >= 2
9
++    && !defined(inhibit_libc) && !defined(CRTSTUFFT_O)
10
+ #include <link.h>
11
+ /* uClibc pretends to be glibc 2.2 and DT_CONFIG is defined in its link.h.
12
+    But it doesn't use PT_GNU_EH_FRAME ELF segment currently.  */
13
+-# if !defined(__UCLIBC__) \
14
+-     && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) \
15
+-     || (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2 && defined(DT_CONFIG)))
16
+-#  define USE_PT_GNU_EH_FRAME
17
++# if defined(__UCLIBC__)
18
++#  if (__UCLIBC_MAJOR__ > 0 || __UCLIBC_MINOR__ > 9 || \
19
++       (__UCLIBC_MINOR__ == 9 && __UCLIBC_SUBLEVEL__ >= 33))
20
++#   define USE_PT_GNU_EH_FRAME
21
++#  endif
22
++# elif defined(__GLIBC__)
23
++#  if (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) \
24
++       || (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2 && defined(DT_CONFIG)))
25
++#   define USE_PT_GNU_EH_FRAME
26
++#  endif
27
+ # endif
28
+ #endif
29
+ #if defined(EH_FRAME_SECTION_NAME) && !defined(USE_PT_GNU_EH_FRAME)

+ 20
- 0
devel/gcc/patches/870-ppc_no_crtsavres.patch View File

@@ -0,0 +1,20 @@
1
+--- a/gcc/config/rs6000/sysv4.h
2
++++ b/gcc/config/rs6000/sysv4.h
3
+@@ -248,13 +248,13 @@ do {									\
4
+ 
5
+ /* Define cutoff for using external functions to save floating point.
6
+    When optimizing for size, use external functions when profitable.  */
7
+-#define FP_SAVE_INLINE(FIRST_REG) (optimize_size			\
8
++#define FP_SAVE_INLINE(FIRST_REG) (1 || (optimize_size			\
9
+ 				   ? ((FIRST_REG) == 62			\
10
+ 				      || (FIRST_REG) == 63)		\
11
+-				   : (FIRST_REG) < 64)
12
++				   : (FIRST_REG) < 64))
13
+ /* And similarly for general purpose registers.  */
14
+-#define GP_SAVE_INLINE(FIRST_REG) ((FIRST_REG) < 32	\
15
+-				   && !optimize_size)
16
++#define GP_SAVE_INLINE(FIRST_REG) (1 || ((FIRST_REG) < 32	\
17
++				   && !optimize_size))
18
+ 
19
+ /* Put jump tables in read-only memory, rather than in .text.  */
20
+ #define JUMP_TABLES_IN_TEXT_SECTION 0

+ 11
- 0
devel/gcc/patches/880-no_java_section.patch View File

@@ -0,0 +1,11 @@
1
+--- a/gcc/defaults.h
2
++++ b/gcc/defaults.h
3
+@@ -383,7 +383,7 @@ see the files COPYING3 and COPYING.RUNTI
4
+ /* If we have named section and we support weak symbols, then use the
5
+    .jcr section for recording java classes which need to be registered
6
+    at program start-up time.  */
7
+-#if defined (TARGET_ASM_NAMED_SECTION) && SUPPORTS_WEAK
8
++#if 0 && defined (TARGET_ASM_NAMED_SECTION) && SUPPORTS_WEAK
9
+ #ifndef JCR_SECTION_NAME
10
+ #define JCR_SECTION_NAME ".jcr"
11
+ #endif

+ 9
- 0
devel/gcc/patches/900-bad-mips16-crt View File

@@ -0,0 +1,9 @@
1
+--- gcc/gcc/config/mips/t-libgcc-mips16~	2013-03-26 09:09:34.209077496 -0400
2
++++ gcc/gcc/config/mips/t-libgcc-mips16	2013-03-26 18:21:01.717303669 -0400
3
+@@ -43,3 +43,6 @@
4
+ 
5
+ # Version these symbols if building libgcc.so.
6
+ SHLIB_MAPFILES += $(srcdir)/config/mips/libgcc-mips16.ver
7
++
8
++CRTSTUFF_T_CFLAGS += -mno-mips16
9
++CRTSTUFF_T_CFLAGS_S += -mno-mips16

+ 253
- 0
devel/gcc/patches/910-mbsd_multi.patch View File

@@ -0,0 +1,253 @@
1
+
2
+	This patch brings over a few features from MirBSD:
3
+	* -fhonour-copts
4
+	  If this option is not given, it's warned (depending
5
+	  on environment variables). This is to catch errors
6
+	  of misbuilt packages which override CFLAGS themselves.
7
+	* -Werror-maybe-reset
8
+	  Has the effect of -Wno-error if GCC_NO_WERROR is
9
+	  set and not '0', a no-operation otherwise. This is
10
+	  to be able to use -Werror in "make" but prevent
11
+	  GNU autoconf generated configure scripts from
12
+	  freaking out.
13
+	* Make -fno-strict-aliasing and -fno-delete-null-pointer-checks
14
+	  the default for -O2/-Os, because they trigger gcc bugs
15
+	  and can delete code with security implications.
16
+
17
+	This patch was authored by Thorsten Glaser <tg at mirbsd.de>
18
+	with copyright assignment to the FSF in effect.
19
+
20
+--- a/gcc/c-family/c-opts.c
21
++++ b/gcc/c-family/c-opts.c
22
+@@ -103,6 +103,9 @@ static size_t deferred_count;
23
+ /* Number of deferred options scanned for -include.  */
24
+ static size_t include_cursor;
25
+ 
26
++/* Check if a port honours COPTS.  */
27
++static int honour_copts = 0;
28
++
29
+ static void handle_OPT_d (const char *);
30
+ static void set_std_cxx98 (int);
31
+ static void set_std_cxx0x (int);
32
+@@ -441,6 +444,9 @@ c_common_handle_option (size_t scode, co
33
+       global_dc->warning_as_error_requested = value;
34
+       break;
35
+ 
36
++    case OPT_Werror_maybe_reset:
37
++      break;
38
++
39
+     case OPT_Wformat:
40
+       set_Wformat (value);
41
+       break;
42
+@@ -584,6 +590,12 @@ c_common_handle_option (size_t scode, co
43
+       flag_no_builtin = !value;
44
+       break;
45
+ 
46
++    case OPT_fhonour_copts:
47
++      if (c_language == clk_c) {
48
++        honour_copts++;
49
++      }
50
++      break;
51
++
52
+     case OPT_fconstant_string_class_:
53
+       constant_string_class_name = arg;
54
+       break;
55
+@@ -1058,6 +1070,47 @@ c_common_init (void)
56
+       return false;
57
+     }
58
+ 
59
++  if (c_language == clk_c) {
60
++    char *ev = getenv ("GCC_HONOUR_COPTS");
61
++    int evv;
62
++    if (ev == NULL)
63
++      evv = -1;
64
++    else if ((*ev == '0') || (*ev == '\0'))
65
++      evv = 0;
66
++    else if (*ev == '1')
67
++      evv = 1;
68
++    else if (*ev == '2')
69
++      evv = 2;
70
++    else if (*ev == 's')
71
++      evv = -1;
72
++    else {
73
++      warning (0, "unknown GCC_HONOUR_COPTS value, assuming 1");
74
++      evv = 1; /* maybe depend this on something like MIRBSD_NATIVE?  */
75
++    }
76
++    if (evv == 1) {
77
++      if (honour_copts == 0) {
78
++        error ("someone does not honour COPTS at all in lenient mode");
79
++        return false;
80
++      } else if (honour_copts != 1) {
81
++        warning (0, "someone does not honour COPTS correctly, passed %d times",
82
++         honour_copts);
83
++      }
84
++    } else if (evv == 2) {
85
++      if (honour_copts == 0) {
86
++        error ("someone does not honour COPTS at all in strict mode");
87
++        return false;
88
++      } else if (honour_copts != 1) {
89
++        error ("someone does not honour COPTS correctly, passed %d times",
90
++         honour_copts);
91
++        return false;
92
++      }
93
++    } else if (evv == 0) {
94
++      if (honour_copts != 1)
95
++        inform (0, "someone does not honour COPTS correctly, passed %d times",
96
++         honour_copts);
97
++    }
98
++  }
99
++
100
+   return true;
101
+ }
102
+ 
103
+--- a/gcc/c-family/c.opt
104
++++ b/gcc/c-family/c.opt
105
+@@ -363,6 +363,10 @@ Werror-implicit-function-declaration
106
+ C ObjC RejectNegative Warning Alias(Werror=, implicit-function-declaration)
107
+ This switch is deprecated; use -Werror=implicit-function-declaration instead
108
+ 
109
++Werror-maybe-reset
110
++C ObjC C++ ObjC++
111
++; Documented in common.opt
112
++
113
+ Wfloat-equal
114
+ C ObjC C++ ObjC++ Var(warn_float_equal) Warning
115
+ Warn if testing floating point numbers for equality
116
+@@ -794,6 +798,9 @@ C++ ObjC++ Optimization Alias(fexception
117
+ fhonor-std
118
+ C++ ObjC++ Ignore Warn(switch %qs is no longer supported)
119
+ 
120
++fhonour-copts
121
++C ObjC C++ ObjC++ RejectNegative
122
++
123
+ fhosted
124
+ C ObjC
125
+ Assume normal C execution environment
126
+--- a/gcc/common.opt
127
++++ b/gcc/common.opt
128
+@@ -520,6 +520,10 @@ Werror=
129
+ Common Joined
130
+ Treat specified warning as error
131
+ 
132
++Werror-maybe-reset
133
++Common
134
++If environment variable GCC_NO_WERROR is set, act as -Wno-error
135
++
136
+ Wextra
137
+ Common Var(extra_warnings) Warning
138
+ Print extra (possibly unwanted) warnings
139
+@@ -1156,6 +1160,9 @@ fguess-branch-probability
140
+ Common Report Var(flag_guess_branch_prob) Optimization
141
+ Enable guessing of branch probabilities
142
+ 
143
++fhonour-copts
144
++Common RejectNegative
145
++
146
+ ; Nonzero means ignore `#ident' directives.  0 means handle them.
147
+ ; Generate position-independent code for executables if possible
148
+ ; On SVR4 targets, it also controls whether or not to emit a
149
+--- a/gcc/opts.c
150
++++ b/gcc/opts.c
151
+@@ -477,8 +477,6 @@ static const struct default_options defa
152
+     { OPT_LEVELS_2_PLUS, OPT_fschedule_insns2, NULL, 1 },
153
+ #endif
154
+     { OPT_LEVELS_2_PLUS, OPT_fregmove, NULL, 1 },
155
+-    { OPT_LEVELS_2_PLUS, OPT_fstrict_aliasing, NULL, 1 },
156
+-    { OPT_LEVELS_2_PLUS, OPT_fstrict_overflow, NULL, 1 },
157
+     { OPT_LEVELS_2_PLUS, OPT_freorder_blocks, NULL, 1 },
158
+     { OPT_LEVELS_2_PLUS, OPT_freorder_functions, NULL, 1 },
159
+     { OPT_LEVELS_2_PLUS, OPT_ftree_vrp, NULL, 1 },
160
+@@ -494,6 +492,8 @@ static const struct default_options defa
161
+     { OPT_LEVELS_2_PLUS, OPT_falign_functions, NULL, 1 },
162
+ 
163
+     /* -O3 optimizations.  */
164
++    { OPT_LEVELS_3_PLUS, OPT_fstrict_aliasing, NULL, 1 },
165
++    { OPT_LEVELS_3_PLUS, OPT_fstrict_overflow, NULL, 1 },
166
+     { OPT_LEVELS_3_PLUS, OPT_ftree_loop_distribute_patterns, NULL, 1 },
167
+     { OPT_LEVELS_3_PLUS, OPT_fpredictive_commoning, NULL, 1 },
168
+     /* Inlining of functions reducing size is a good idea with -Os
169
+@@ -1405,6 +1405,17 @@ common_handle_option (struct gcc_options
170
+ 			       opts, opts_set, loc, dc);
171
+       break;
172
+ 
173
++    case OPT_Werror_maybe_reset:
174
++      {
175
++        char *ev = getenv ("GCC_NO_WERROR");
176
++        if ((ev != NULL) && (*ev != '0'))
177
++          warnings_are_errors = 0;
178
++      }
179
++      break;
180
++
181
++    case OPT_fhonour_copts:
182
++      break;
183
++
184
+     case OPT_Wlarger_than_:
185
+       opts->x_larger_than_size = value;
186
+       opts->x_warn_larger_than = value != -1;
187
+--- a/gcc/doc/cppopts.texi
188
++++ b/gcc/doc/cppopts.texi
189
+@@ -164,6 +164,11 @@ in older programs.  This warning is on b
190
+ Make all warnings into hard errors.  Source code which triggers warnings
191
+ will be rejected.
192
+ 
193
++ at item -Werror-maybe-reset
194
++ at opindex Werror-maybe-reset
195
++Act like @samp{-Wno-error} if the @env{GCC_NO_WERROR} environment
196
++variable is set to anything other than 0 or empty.
197
++
198
+ @item -Wsystem-headers
199
+ @opindex Wsystem-headers
200
+ Issue warnings for code in system headers.  These are normally unhelpful
201
+--- a/gcc/doc/invoke.texi
202
++++ b/gcc/doc/invoke.texi
203
+@@ -240,7 +240,7 @@ Objective-C and Objective-C++ Dialects}.
204
+ -Wconversion  -Wcoverage-mismatch  -Wno-cpp  -Wno-deprecated  @gol
205
+ -Wno-deprecated-declarations -Wdisabled-optimization  @gol
206
+ -Wno-div-by-zero -Wdouble-promotion -Wempty-body  -Wenum-compare @gol
207
+--Wno-endif-labels -Werror  -Werror=* @gol
208
++-Wno-endif-labels -Werror  -Werror=* -Werror-maybe-reset @gol
209
+ -Wfatal-errors  -Wfloat-equal  -Wformat  -Wformat=2 @gol
210
+ -Wno-format-contains-nul -Wno-format-extra-args -Wformat-nonliteral @gol
211
+ -Wformat-security  -Wformat-y2k @gol
212
+@@ -4498,6 +4498,22 @@ This option is only supported for C and
213
+ @option{-Wall} and by @option{-pedantic}, which can be disabled with
214
+ @option{-Wno-pointer-sign}.
215
+ 
216
++ at item -Werror-maybe-reset
217
++ at opindex Werror-maybe-reset
218
++Act like @samp{-Wno-error} if the @env{GCC_NO_WERROR} environment
219
++variable is set to anything other than 0 or empty.
220
++
221
++ at item -fhonour-copts
222
++ at opindex fhonour-copts
223
++If @env{GCC_HONOUR_COPTS} is set to 1, abort if this option is not
224
++given at least once, and warn if it is given more than once.
225
++If @env{GCC_HONOUR_COPTS} is set to 2, abort if this option is not
226
++given exactly once.
227
++If @env{GCC_HONOUR_COPTS} is set to 0 or unset, warn if this option
228
++is not given exactly once.
229
++The warning is quelled if @env{GCC_HONOUR_COPTS} is set to @samp{s}.
230
++This flag and environment variable only affect the C language.
231
++
232
+ @item -Wstack-protector
233
+ @opindex Wstack-protector
234
+ @opindex Wno-stack-protector
235
+@@ -6317,7 +6333,7 @@ so, the first branch is redirected to ei
236
+ second branch or a point immediately following it, depending on whether
237
+ the condition is known to be true or false.
238
+ 
239
+-Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
240
++Enabled at levels @option{-O3}.
241
+ 
242
+ @item -fsplit-wide-types
243
+ @opindex fsplit-wide-types
244
+--- a/gcc/java/jvspec.c
245
++++ b/gcc/java/jvspec.c
246
+@@ -627,6 +627,7 @@ lang_specific_pre_link (void)
247
+      class name.  Append dummy `.c' that can be stripped by set_input so %b
248
+      is correct.  */ 
249
+   set_input (concat (main_class_name, "main.c", NULL));
250
++  putenv ("GCC_HONOUR_COPTS=s"); /* XXX hack!  */
251
+   err = do_spec (jvgenmain_spec);
252
+   if (err == 0)
253
+     {

+ 14
- 0
devel/gcc/patches/920-specs_nonfatal_getenv.patch View File

@@ -0,0 +1,14 @@
1
+--- a/gcc/gcc.c
2
++++ b/gcc/gcc.c
3
+@@ -7772,7 +7772,10 @@ getenv_spec_function (int argc, const ch
4
+ 
5
+   value = getenv (argv[0]);
6
+   if (!value)
7
+-    fatal_error ("environment variable %qs not defined", argv[0]);
8
++    {
9
++      warning (0, "environment variable %qs not defined", argv[0]);
10
++      value = "";
11
++    }
12
+ 
13
+   /* We have to escape every character of the environment variable so
14
+      they are not interpreted as active spec characters.  A

+ 11
- 0
devel/gcc/patches/999-coldfire.patch View File

@@ -0,0 +1,11 @@
1
+--- a/gcc/config.gcc
2
++++ b/gcc/config.gcc
3
+@@ -1805,7 +1805,7 @@ m68k-*-linux*)		# Motorola m68k's runnin
4
+ 	default_m68k_cpu=68020
5
+ 	default_cf_cpu=5475
6
+ 	with_arch=${with_arch:-m68k}
7
+-	tm_file="${tm_file} dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h m68k/linux.h ./sysroot-suffix.h"
8
++	tm_file="${tm_file} dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h m68k/linux.h"
9
+ 	extra_options="${extra_options} m68k/ieee.opt"
10
+ 	tm_defines="${tm_defines} MOTOROLA=1"
11
+ 	tmake_file="${tmake_file} m68k/t-floatlib m68k/t-linux m68k/t-mlibs"