[x86] alix2: add config files for bridging
[openwrt.git] / toolchain / gcc / patches / 4.4.1+cs / 910-mbsd_multi.patch
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 * Make -fno-strict-aliasing and -fno-delete-null-pointer-checks
8 the default for -O2/-Os, because they trigger gcc bugs
9 and can delete code with security implications.
10
11 This patch was authored by Thorsten Glaser <tg at mirbsd.de>
12 with copyright assignment to the FSF in effect.
13
14 --- a/gcc/c-opts.c
15 +++ b/gcc/c-opts.c
16 @@ -106,6 +106,9 @@
17 /* Number of deferred options scanned for -include. */
18 static size_t include_cursor;
19
20 +/* Check if a port honours COPTS. */
21 +static int honour_copts = 0;
22 +
23 static void set_Wimplicit (int);
24 static void handle_OPT_d (const char *);
25 static void set_std_cxx98 (int);
26 @@ -689,6 +692,12 @@
27 flag_exceptions = value;
28 break;
29
30 + case OPT_fhonour_copts:
31 + if (c_language == clk_c) {
32 + honour_copts++;
33 + }
34 + break;
35 +
36 case OPT_fimplement_inlines:
37 flag_implement_inlines = value;
38 break;
39 @@ -1198,6 +1207,47 @@
40 return false;
41 }
42
43 + if (c_language == clk_c) {
44 + char *ev = getenv ("GCC_HONOUR_COPTS");
45 + int evv;
46 + if (ev == NULL)
47 + evv = -1;
48 + else if ((*ev == '0') || (*ev == '\0'))
49 + evv = 0;
50 + else if (*ev == '1')
51 + evv = 1;
52 + else if (*ev == '2')
53 + evv = 2;
54 + else if (*ev == 's')
55 + evv = -1;
56 + else {
57 + warning (0, "unknown GCC_HONOUR_COPTS value, assuming 1");
58 + evv = 1; /* maybe depend this on something like MIRBSD_NATIVE? */
59 + }
60 + if (evv == 1) {
61 + if (honour_copts == 0) {
62 + error ("someone does not honour COPTS at all in lenient mode");
63 + return false;
64 + } else if (honour_copts != 1) {
65 + warning (0, "someone does not honour COPTS correctly, passed %d times",
66 + honour_copts);
67 + }
68 + } else if (evv == 2) {
69 + if (honour_copts == 0) {
70 + error ("someone does not honour COPTS at all in strict mode");
71 + return false;
72 + } else if (honour_copts != 1) {
73 + error ("someone does not honour COPTS correctly, passed %d times",
74 + honour_copts);
75 + return false;
76 + }
77 + } else if (evv == 0) {
78 + if (honour_copts != 1)
79 + inform (0, "someone does not honour COPTS correctly, passed %d times",
80 + honour_copts);
81 + }
82 + }
83 +
84 return true;
85 }
86
87 --- a/gcc/c.opt
88 +++ b/gcc/c.opt
89 @@ -609,6 +609,9 @@
90 fhonor-std
91 C++ ObjC++
92
93 +fhonour-copts
94 +C ObjC C++ ObjC++ RejectNegative
95 +
96 fhosted
97 C ObjC
98 Assume normal C execution environment
99 --- a/gcc/common.opt
100 +++ b/gcc/common.opt
101 @@ -587,6 +587,9 @@
102 Common Report Var(flag_guess_branch_prob) Optimization
103 Enable guessing of branch probabilities
104
105 +fhonour-copts
106 +Common RejectNegative
107 +
108 ; Nonzero means ignore `#ident' directives. 0 means handle them.
109 ; Generate position-independent code for executables if possible
110 ; On SVR4 targets, it also controls whether or not to emit a
111 --- a/gcc/opts.c
112 +++ b/gcc/opts.c
113 @@ -896,9 +896,6 @@
114 flag_schedule_insns_after_reload = opt2;
115 #endif
116 flag_regmove = opt2;
117 - flag_strict_aliasing = opt2;
118 - flag_strict_overflow = opt2;
119 - flag_delete_null_pointer_checks = opt2;
120 flag_reorder_blocks = opt2;
121 flag_reorder_functions = opt2;
122 flag_tree_vrp = opt2;
123 @@ -922,6 +919,9 @@
124
125 /* -O3 optimizations. */
126 opt3 = (optimize >= 3);
127 + flag_strict_aliasing = opt3;
128 + flag_strict_overflow = opt3;
129 + flag_delete_null_pointer_checks = opt3;
130 flag_predictive_commoning = opt3;
131 flag_inline_functions = opt3;
132 flag_unswitch_loops = opt3;
133 @@ -1605,6 +1605,9 @@
134 enable_warning_as_error (arg, value, lang_mask);
135 break;
136
137 + case OPT_fhonour_copts:
138 + break;
139 +
140 case OPT_Wextra:
141 set_Wextra (value);
142 break;
143 --- a/gcc/doc/invoke.texi
144 +++ b/gcc/doc/invoke.texi
145 @@ -5699,7 +5699,7 @@
146 second branch or a point immediately following it, depending on whether
147 the condition is known to be true or false.
148
149 -Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
150 +Enabled at levels @option{-O3}.
151
152 @item -fsplit-wide-types
153 @opindex fsplit-wide-types
154 @@ -5844,7 +5844,7 @@
155 @option{-fno-delete-null-pointer-checks} to disable this optimization
156 for programs which depend on that behavior.
157
158 -Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
159 +Enabled at levels @option{-O3}.
160
161 @item -fexpensive-optimizations
162 @opindex fexpensive-optimizations
163 --- a/gcc/java/jvspec.c
164 +++ b/gcc/java/jvspec.c
165 @@ -670,6 +670,7 @@
166 class name. Append dummy `.c' that can be stripped by set_input so %b
167 is correct. */
168 set_input (concat (main_class_name, "main.c", NULL));
169 + putenv ("GCC_HONOUR_COPTS=s"); /* XXX hack! */
170 err = do_spec (jvgenmain_spec);
171 if (err == 0)
172 {
This page took 0.049131 seconds and 5 git commands to generate.