diff options
Diffstat (limited to 'meta/recipes-devtools/gcc/gcc-csl-arm/pic-without-sl.patch')
-rw-r--r-- | meta/recipes-devtools/gcc/gcc-csl-arm/pic-without-sl.patch | 303 |
1 files changed, 0 insertions, 303 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-csl-arm/pic-without-sl.patch b/meta/recipes-devtools/gcc/gcc-csl-arm/pic-without-sl.patch deleted file mode 100644 index 9a49794da4..0000000000 --- a/meta/recipes-devtools/gcc/gcc-csl-arm/pic-without-sl.patch +++ /dev/null | |||
@@ -1,303 +0,0 @@ | |||
1 | Index: gcc/config/arm/arm-protos.h | ||
2 | =================================================================== | ||
3 | RCS file: /cvsroot/gcc/gcc/gcc/config/arm/arm-protos.h,v | ||
4 | retrieving revision 1.60.4.20 | ||
5 | diff -u -r1.60.4.20 arm-protos.h | ||
6 | --- gcc/config/arm/arm-protos.h 29 Mar 2005 03:00:11 -0000 1.60.4.20 | ||
7 | +++ gcc/config/arm/arm-protos.h 23 Apr 2005 04:41:06 -0000 | ||
8 | @@ -64,6 +64,7 @@ | ||
9 | extern enum reg_class vfp_secondary_reload_class (enum machine_mode, rtx); | ||
10 | extern int tls_symbolic_operand (rtx, enum machine_mode); | ||
11 | extern bool arm_tls_operand_p (rtx x); | ||
12 | +extern bool arm_pc_pic_operand_p (rtx x); | ||
13 | |||
14 | /* Predicates. */ | ||
15 | extern int s_register_operand (rtx, enum machine_mode); | ||
16 | Index: gcc/config/arm/arm.c | ||
17 | =================================================================== | ||
18 | RCS file: /cvsroot/gcc/gcc/gcc/config/arm/arm.c,v | ||
19 | retrieving revision 1.303.2.79 | ||
20 | diff -u -r1.303.2.79 arm.c | ||
21 | --- gcc/config/arm/arm.c 12 Apr 2005 06:17:07 -0000 1.303.2.79 | ||
22 | +++ gcc/config/arm/arm.c 23 Apr 2005 04:41:09 -0000 | ||
23 | @@ -1003,7 +1003,7 @@ | ||
24 | |||
25 | /* If stack checking is disabled, we can use r10 as the PIC register, | ||
26 | which keeps r9 available. */ | ||
27 | - if (flag_pic) | ||
28 | + if (0 && flag_pic) | ||
29 | arm_pic_register = TARGET_APCS_STACK ? 9 : 10; | ||
30 | |||
31 | if (TARGET_APCS_FLOAT) | ||
32 | @@ -3120,6 +3120,10 @@ | ||
33 | rtx | ||
34 | legitimize_pic_address (rtx orig, enum machine_mode mode, rtx reg) | ||
35 | { | ||
36 | + if (GET_CODE (orig) == UNSPEC | ||
37 | + && XINT (orig, 1) == UNSPEC_GOTSLOTPC) | ||
38 | + abort (); | ||
39 | + | ||
40 | if (GET_CODE (orig) == SYMBOL_REF | ||
41 | || GET_CODE (orig) == LABEL_REF) | ||
42 | { | ||
43 | @@ -3149,27 +3153,80 @@ | ||
44 | else | ||
45 | address = reg; | ||
46 | |||
47 | - if (TARGET_ARM) | ||
48 | - emit_insn (gen_pic_load_addr_arm (address, orig)); | ||
49 | - else | ||
50 | - emit_insn (gen_pic_load_addr_thumb (address, orig)); | ||
51 | + if (arm_pic_register != INVALID_REGNUM) | ||
52 | + { | ||
53 | + /* Using GP-based PIC addressing. */ | ||
54 | + if (TARGET_ARM) | ||
55 | + emit_insn (gen_pic_load_addr_arm (address, orig)); | ||
56 | + else | ||
57 | + emit_insn (gen_pic_load_addr_thumb (address, orig)); | ||
58 | + | ||
59 | + if ((GET_CODE (orig) == LABEL_REF | ||
60 | + || (GET_CODE (orig) == SYMBOL_REF && | ||
61 | + SYMBOL_REF_LOCAL_P (orig))) | ||
62 | + && NEED_GOT_RELOC) | ||
63 | + pic_ref = gen_rtx_PLUS (Pmode, pic_offset_table_rtx, address); | ||
64 | + else | ||
65 | + { | ||
66 | + pic_ref = gen_rtx_MEM (Pmode, | ||
67 | + gen_rtx_PLUS (Pmode, pic_offset_table_rtx, | ||
68 | + address)); | ||
69 | + RTX_UNCHANGING_P (pic_ref) = 1; | ||
70 | + } | ||
71 | |||
72 | - if ((GET_CODE (orig) == LABEL_REF | ||
73 | - || (GET_CODE (orig) == SYMBOL_REF && | ||
74 | - SYMBOL_REF_LOCAL_P (orig))) | ||
75 | - && NEED_GOT_RELOC) | ||
76 | - pic_ref = gen_rtx_PLUS (Pmode, pic_offset_table_rtx, address); | ||
77 | + current_function_uses_pic_offset_table = 1; | ||
78 | + } | ||
79 | else | ||
80 | { | ||
81 | - pic_ref = gen_rtx_MEM (Pmode, | ||
82 | - gen_rtx_PLUS (Pmode, pic_offset_table_rtx, | ||
83 | - address)); | ||
84 | - RTX_UNCHANGING_P (pic_ref) = 1; | ||
85 | + /* Using PC-based PIC addressing. */ | ||
86 | + rtx label, tmp; | ||
87 | + int offset; | ||
88 | + | ||
89 | + label = gen_label_rtx (); | ||
90 | + offset = TARGET_ARM ? 8 : 4; | ||
91 | + | ||
92 | + if (GET_CODE (orig) == LABEL_REF | ||
93 | + || (GET_CODE (orig) == SYMBOL_REF && SYMBOL_REF_LOCAL_P (orig))) | ||
94 | + { | ||
95 | + /* This symbol is defined locally. We don't need a GOT entry. */ | ||
96 | + tmp = gen_rtx_MINUS (Pmode, gen_rtx_UNSPEC (Pmode, gen_rtvec (1, orig), UNSPEC_PIC_SYM), gen_rtx_PLUS (Pmode, | ||
97 | + gen_rtx_LABEL_REF (Pmode, label), | ||
98 | + GEN_INT (offset))); | ||
99 | + | ||
100 | + load_tls_operand (tmp, address); | ||
101 | + | ||
102 | + if (TARGET_ARM) | ||
103 | + emit_insn (gen_pic_add_dot_plus_eight (address, label)); | ||
104 | + else | ||
105 | + emit_insn (gen_pic_add_dot_plus_four (address, label)); | ||
106 | + } | ||
107 | + else | ||
108 | + { | ||
109 | + rtx x = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, orig), UNSPEC_GOTSLOTPC); | ||
110 | + rtx dummy_label; | ||
111 | + | ||
112 | + dummy_label = gen_label_rtx (); | ||
113 | + LABEL_PRESERVE_P (dummy_label) = 1; | ||
114 | + LABEL_NUSES (dummy_label) = 1; | ||
115 | + | ||
116 | + tmp = gen_rtx_MINUS (Pmode, x, gen_rtx_PLUS (Pmode, | ||
117 | + gen_rtx_LABEL_REF (Pmode, label), | ||
118 | + GEN_INT (offset))); | ||
119 | + | ||
120 | + load_tls_operand (tmp, address); | ||
121 | + | ||
122 | + if (TARGET_ARM) | ||
123 | + emit_insn (gen_tls_load_dot_plus_eight (address, address, label, dummy_label)); | ||
124 | + else | ||
125 | + emit_insn (gen_tls_load_dot_plus_four (address, address, label, dummy_label)); | ||
126 | + } | ||
127 | + | ||
128 | + pic_ref = address; | ||
129 | } | ||
130 | |||
131 | insn = emit_move_insn (reg, pic_ref); | ||
132 | #endif | ||
133 | - current_function_uses_pic_offset_table = 1; | ||
134 | + | ||
135 | /* Put a REG_EQUAL note on this insn, so that it can be optimized | ||
136 | by loop. */ | ||
137 | REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_EQUAL, orig, | ||
138 | @@ -3179,11 +3236,17 @@ | ||
139 | else if (GET_CODE (orig) == CONST) | ||
140 | { | ||
141 | rtx base, offset; | ||
142 | + bool minus = FALSE; | ||
143 | |||
144 | if (GET_CODE (XEXP (orig, 0)) == PLUS | ||
145 | && XEXP (XEXP (orig, 0), 0) == pic_offset_table_rtx) | ||
146 | return orig; | ||
147 | |||
148 | + if (GET_CODE (XEXP (orig, 0)) == MINUS | ||
149 | + && GET_CODE (XEXP (XEXP (orig, 0), 0)) == UNSPEC | ||
150 | + && XINT (XEXP (XEXP (orig, 0), 0), 1) == UNSPEC_GOTSLOTPC) | ||
151 | + return orig; | ||
152 | + | ||
153 | if (GET_CODE (XEXP (orig, 0)) == UNSPEC) | ||
154 | return orig; | ||
155 | |||
156 | @@ -3201,6 +3264,13 @@ | ||
157 | offset = legitimize_pic_address (XEXP (XEXP (orig, 0), 1), Pmode, | ||
158 | base == reg ? 0 : reg); | ||
159 | } | ||
160 | + else if (GET_CODE (XEXP (orig, 0)) == MINUS) | ||
161 | + { | ||
162 | + minus = TRUE; | ||
163 | + base = legitimize_pic_address (XEXP (XEXP (orig, 0), 0), Pmode, reg); | ||
164 | + offset = legitimize_pic_address (XEXP (XEXP (orig, 0), 1), Pmode, | ||
165 | + base == reg ? 0 : reg); | ||
166 | + } | ||
167 | else | ||
168 | abort (); | ||
169 | |||
170 | @@ -3228,7 +3298,7 @@ | ||
171 | return reg; | ||
172 | } | ||
173 | |||
174 | - return gen_rtx_PLUS (Pmode, base, offset); | ||
175 | + return minus ? gen_rtx_MINUS (Pmode, base, offset) : gen_rtx_PLUS (Pmode, base, offset); | ||
176 | } | ||
177 | |||
178 | return orig; | ||
179 | @@ -3267,7 +3337,7 @@ | ||
180 | rtx l1, pic_tmp, pic_tmp2, pic_rtx; | ||
181 | rtx global_offset_table; | ||
182 | |||
183 | - if (current_function_uses_pic_offset_table == 0 || TARGET_SINGLE_PIC_BASE) | ||
184 | + if (current_function_uses_pic_offset_table == 0 || TARGET_SINGLE_PIC_BASE || arm_pic_register == INVALID_REGNUM) | ||
185 | return; | ||
186 | |||
187 | if (!flag_pic) | ||
188 | @@ -3341,8 +3411,11 @@ | ||
189 | static int | ||
190 | pcrel_constant_p (rtx x) | ||
191 | { | ||
192 | + if (GET_CODE (x) == CONST) | ||
193 | + return pcrel_constant_p (XEXP (x, 0)); | ||
194 | + | ||
195 | if (GET_CODE (x) == MINUS) | ||
196 | - return symbol_mentioned_p (XEXP (x, 0)) && label_mentioned_p (XEXP (x, 1)); | ||
197 | + return (((GET_CODE (XEXP (x, 0)) == UNSPEC && XINT (XEXP (x, 0), 1) == UNSPEC_PIC_SYM)) || symbol_mentioned_p (XEXP (x, 0))) && label_mentioned_p (XEXP (x, 1)); | ||
198 | |||
199 | if (GET_CODE (x) == UNSPEC | ||
200 | && XINT (x, 1) == UNSPEC_TLS | ||
201 | @@ -3946,12 +4019,32 @@ | ||
202 | return SYMBOL_REF_TLS_MODEL (op); | ||
203 | } | ||
204 | |||
205 | +bool | ||
206 | +arm_pc_pic_operand_p (rtx op) | ||
207 | +{ | ||
208 | + if (GET_CODE (op) == CONST | ||
209 | + && GET_CODE (XEXP (op, 0)) == MINUS | ||
210 | + && GET_CODE (XEXP (XEXP (op, 0), 0)) == UNSPEC | ||
211 | + && XINT (XEXP (XEXP (op, 0), 0), 1) == UNSPEC_GOTSLOTPC) | ||
212 | + return 1; | ||
213 | + | ||
214 | + if (GET_CODE (op) == CONST | ||
215 | + && GET_CODE (XEXP (op, 0)) == MINUS | ||
216 | + && GET_CODE (XEXP (XEXP (op, 0), 0)) == UNSPEC | ||
217 | + && XINT (XEXP (XEXP (op, 0), 0), 1) == UNSPEC_PIC_SYM) | ||
218 | + return 1; | ||
219 | + | ||
220 | + return 0; | ||
221 | +} | ||
222 | + | ||
223 | /* Valid input to a move instruction. */ | ||
224 | int | ||
225 | move_input_operand (rtx op, enum machine_mode mode) | ||
226 | { | ||
227 | if (tls_symbolic_operand (op, mode)) | ||
228 | return 0; | ||
229 | + if (pcrel_constant_p (op)) | ||
230 | + return 1; | ||
231 | return general_operand (op, mode); | ||
232 | } | ||
233 | |||
234 | @@ -15634,11 +15727,34 @@ | ||
235 | return TRUE; | ||
236 | } | ||
237 | |||
238 | +static bool | ||
239 | +arm_emit_got_decoration (FILE *fp, rtx x) | ||
240 | +{ | ||
241 | + rtx val; | ||
242 | + | ||
243 | + val = XVECEXP (x, 0, 0); | ||
244 | + | ||
245 | + fputs ("_gotslotpc_(", fp); | ||
246 | + | ||
247 | + output_addr_const (fp, val); | ||
248 | + | ||
249 | + fputc (')', fp); | ||
250 | + | ||
251 | + return TRUE; | ||
252 | +} | ||
253 | + | ||
254 | bool | ||
255 | arm_output_addr_const_extra (FILE *fp, rtx x) | ||
256 | { | ||
257 | if (GET_CODE (x) == UNSPEC && XINT (x, 1) == UNSPEC_TLS) | ||
258 | return arm_emit_tls_decoration (fp, x); | ||
259 | + else if (GET_CODE (x) == UNSPEC && XINT (x, 1) == UNSPEC_GOTSLOTPC) | ||
260 | + return arm_emit_got_decoration (fp, x); | ||
261 | + else if (GET_CODE (x) == UNSPEC && XINT (x, 1) == UNSPEC_PIC_SYM) | ||
262 | + { | ||
263 | + output_addr_const (fp, XVECEXP (x, 0, 0)); | ||
264 | + return TRUE; | ||
265 | + } | ||
266 | else if (GET_CODE (x) == CONST_VECTOR) | ||
267 | return arm_emit_vector_const (fp, x); | ||
268 | |||
269 | Index: gcc/config/arm/arm.md | ||
270 | =================================================================== | ||
271 | RCS file: /cvsroot/gcc/gcc/gcc/config/arm/arm.md,v | ||
272 | retrieving revision 1.145.2.31 | ||
273 | diff -u -r1.145.2.31 arm.md | ||
274 | --- gcc/config/arm/arm.md 28 Mar 2005 19:04:37 -0000 1.145.2.31 | ||
275 | +++ gcc/config/arm/arm.md 23 Apr 2005 04:41:11 -0000 | ||
276 | @@ -88,6 +88,7 @@ | ||
277 | (UNSPEC_WMADDS 18) ; Used by the intrinsic form of the iWMMXt WMADDS instruction. | ||
278 | (UNSPEC_WMADDU 19) ; Used by the intrinsic form of the iWMMXt WMADDU instruction. | ||
279 | (UNSPEC_TLS 20) ; A symbol that has been treated properly for TLS usage. | ||
280 | + (UNSPEC_GOTSLOTPC 21) | ||
281 | ] | ||
282 | ) | ||
283 | |||
284 | @@ -4179,7 +4180,8 @@ | ||
285 | && (CONSTANT_P (operands[1]) | ||
286 | || symbol_mentioned_p (operands[1]) | ||
287 | || label_mentioned_p (operands[1])) | ||
288 | - && ! tls_mentioned_p (operands[1])) | ||
289 | + && ! tls_mentioned_p (operands[1]) | ||
290 | + && ! arm_pc_pic_operand_p (operands[1])) | ||
291 | operands[1] = legitimize_pic_address (operands[1], SImode, | ||
292 | (no_new_pseudos ? operands[0] : 0)); | ||
293 | } | ||
294 | @@ -4412,7 +4414,8 @@ | ||
295 | (mem:SI (unspec:SI [(plus:SI (match_dup 0) | ||
296 | (const (plus:SI (pc) (const_int 8))))] | ||
297 | UNSPEC_PIC_BASE))) | ||
298 | - (use (label_ref (match_operand 1 "" "")))])] | ||
299 | + (use (label_ref (match_operand 1 "" ""))) | ||
300 | + (use (label_ref (match_operand 1 "" "")))])] | ||
301 | "" | ||
302 | ) | ||
303 | |||