]>
Commit | Line | Data |
---|---|---|
f3b7a7a6 JB |
1 | From binutils-return-33437-listarch-binutils=sources dot redhat dot com at sources dot redhat dot com Wed May 05 17:45:08 2004 |
2 | Return-Path: <binutils-return-33437-listarch-binutils=sources dot redhat dot com at sources dot redhat dot com> | |
3 | Delivered-To: listarch-binutils at sources dot redhat dot com | |
4 | Received: (qmail 20913 invoked by alias); 5 May 2004 17:45:08 -0000 | |
5 | Mailing-List: contact binutils-help at sources dot redhat dot com; run by ezmlm | |
6 | Precedence: bulk | |
7 | List-Subscribe: <mailto:binutils-subscribe at sources dot redhat dot com> | |
8 | List-Archive: <http://sources.redhat.com/ml/binutils/> | |
9 | List-Post: <mailto:binutils at sources dot redhat dot com> | |
10 | List-Help: <mailto:binutils-help at sources dot redhat dot com>, <http://sources dot redhat dot com/ml/#faqs> | |
11 | Sender: binutils-owner at sources dot redhat dot com | |
12 | Delivered-To: mailing list binutils at sources dot redhat dot com | |
13 | Received: (qmail 20904 invoked from network); 5 May 2004 17:45:05 -0000 | |
14 | Received: from unknown (HELO dmz.algor.co.uk) (62.254.210.145) | |
15 | by sources dot redhat dot com with SMTP; 5 May 2004 17:45:05 -0000 | |
16 | Received: from alg158.algor.co.uk ([62.254.210.158] helo=olympia.mips.com) | |
17 | by dmz dot algor dot co dot uk with esmtp (Exim 3 dot 35 #1 (Debian)) | |
18 | id 1BLQgU-0007Tz-00; Wed, 05 May 2004 18:59:54 +0100 | |
19 | Received: from stockwell.mips.com ([192.168.192.238]) | |
20 | by olympia dot mips dot com with esmtp (Exim 3 dot 36 #1 (Debian)) | |
21 | id 1BLQRk-0004Mi-00; Wed, 05 May 2004 18:44:40 +0100 | |
22 | Subject: Re: [mips patch RFC] removal of gas embedded-pic support code | |
23 | From: David Ung <davidu at mips dot com> | |
24 | To: cgd at broadcom dot com, ica2_ts at csv dot ica dot uni-stuttgart dot de, binutils at sources dot redhat dot com | |
25 | Content-Type: text/plain | |
26 | Organization: MIPS Technologies UK | |
27 | Message-Id: <1083779079.31797.223.camel@stockwell.mips.com> | |
28 | Mime-Version: 1.0 | |
29 | Date: Wed, 05 May 2004 18:44:40 +0100 | |
30 | Content-Transfer-Encoding: 7bit | |
31 | X-MTUK-Scanner: Found to be clean | |
32 | X-MTUK-SpamCheck: not spam, SpamAssassin (score=-4.833, required 4, AWL, | |
33 | BAYES_00) | |
34 | ||
35 | >At Thu, 29 Apr 2004 02:46:46 +0000 (UTC), "Thiemo Seufer" wrote: | |
36 | >> I think it is ok. | |
37 | > | |
38 | >Thanks for looking it over. | |
39 | > | |
40 | >I've checked it in. I *really* hope it really doesn't break | |
41 | >anything. 8-) | |
42 | > | |
43 | > | |
44 | >chris | |
45 | ||
46 | Chris, | |
47 | ||
48 | woops. your recent patch seem to have broke building of the compiler on | |
49 | linux. The problem occurs when building for libgcc/./_divdi3.o | |
50 | ||
51 | gas fails with: | |
52 | Error: operation combines symbols in different segments | |
53 | ||
54 | as it is trying to assemble this piece of .s code generated from gcc. | |
55 | ||
56 | .section .eh_frame,"aw",@progbits | |
57 | $Lframe1: | |
58 | .4byte $LECIE1-$LSCIE1 | |
59 | $LSCIE1: | |
60 | .4byte 0x0 | |
61 | .byte 0x1 | |
62 | .ascii "zR\000" | |
63 | .uleb128 0x1 | |
64 | .sleb128 4 | |
65 | .byte 0x1f | |
66 | .uleb128 0x1 | |
67 | .byte 0x1b | |
68 | .byte 0xc | |
69 | .uleb128 0x1d | |
70 | .uleb128 0x0 | |
71 | .align 2 | |
72 | $LECIE1: | |
73 | $LSFDE1: | |
74 | .4byte $LEFDE1-$LASFDE1 | |
75 | $LASFDE1: | |
76 | .4byte $LASFDE1-$Lframe1 | |
77 | .4byte $LFB42-. ** | |
78 | .4byte $LFE42-$LFB42 | |
79 | .uleb128 0x0 | |
80 | ||
81 | ** $LFB42 is from the text section of divdi3. | |
82 | ||
83 | I've reverted back the necessary changes to your patch, so that it now | |
84 | works with the above. | |
85 | ||
86 | David. | |
87 | ||
88 | ||
89 | ||
90 | Index: bfd/ChangeLog | |
91 | =================================================================== | |
92 | RCS file: /cvsroot/gcc/src-cvs/src/bfd/ChangeLog,v | |
93 | retrieving revision 1.2535 | |
94 | diff -u -r1.2535 ChangeLog | |
95 | --- bfd/ChangeLog 3 May 2004 14:52:01 -0000 1.2535 | |
96 | +++ bfd/ChangeLog 5 May 2004 17:38:51 -0000 | |
97 | @@ -1,0 +1,12 @@ | |
98 | +2004-05-05 David Ung <davidu@mips.com> | |
99 | + | |
100 | + * elfxx-mips.c (mips_elf_calculate_relocation): Put back cases for | |
101 | + R_MIPS_PC32 and R_MIPS_PC64. | |
102 | + | |
103 | + * elf32-mips.c: Put back elf_mips_gnu_pcrel64 and | |
104 | + elf_mips_gnu_pcrel32. | |
105 | + (bfd_elf32_bfd_reloc_type_lookup): Put back cases for | |
106 | + BFD_RELOC_64_PCREL and BFD_RELOC_32_PCREL. | |
107 | + (mips_elf32_rtype_to_howto): Put back cases for R_MIPS_PC32 and | |
108 | + R_MIPS_PC64. | |
109 | + | |
110 | Index: bfd/elf32-mips.c | |
111 | =================================================================== | |
112 | RCS file: /cvsroot/gcc/src-cvs/src/bfd/elf32-mips.c,v | |
113 | retrieving revision 1.175 | |
114 | diff -u -r1.175 elf32-mips.c | |
115 | --- bfd/elf32-mips.c 24 Apr 2004 22:07:13 -0000 1.175 | |
116 | +++ bfd/elf32-mips.c 5 May 2004 17:38:51 -0000 | |
117 | @@ -615,6 +615,38 @@ | |
118 | 0xffff, /* dst_mask */ | |
119 | TRUE); /* pcrel_offset */ | |
120 | ||
121 | +/* 64 bit pc-relative. */ | |
122 | +static reloc_howto_type elf_mips_gnu_pcrel64 = | |
123 | + HOWTO (R_MIPS_PC64, /* type */ | |
124 | + 0, /* rightshift */ | |
125 | + 4, /* size (0 = byte, 1 = short, 2 = long) */ | |
126 | + 64, /* bitsize */ | |
127 | + TRUE, /* pc_relative */ | |
128 | + 0, /* bitpos */ | |
129 | + complain_overflow_signed, /* complain_on_overflow */ | |
130 | + _bfd_mips_elf_generic_reloc, /* special_function */ | |
131 | + "R_MIPS_PC64", /* name */ | |
132 | + TRUE, /* partial_inplace */ | |
133 | + MINUS_ONE, /* src_mask */ | |
134 | + MINUS_ONE, /* dst_mask */ | |
135 | + TRUE); /* pcrel_offset */ | |
136 | + | |
137 | +/* 32 bit pc-relative. */ | |
138 | +static reloc_howto_type elf_mips_gnu_pcrel32 = | |
139 | + HOWTO (R_MIPS_PC32, /* type */ | |
140 | + 0, /* rightshift */ | |
141 | + 2, /* size (0 = byte, 1 = short, 2 = long) */ | |
142 | + 32, /* bitsize */ | |
143 | + TRUE, /* pc_relative */ | |
144 | + 0, /* bitpos */ | |
145 | + complain_overflow_signed, /* complain_on_overflow */ | |
146 | + _bfd_mips_elf_generic_reloc, /* special_function */ | |
147 | + "R_MIPS_PC32", /* name */ | |
148 | + TRUE, /* partial_inplace */ | |
149 | + 0xffffffff, /* src_mask */ | |
150 | + 0xffffffff, /* dst_mask */ | |
151 | + TRUE); /* pcrel_offset */ | |
152 | + | |
153 | /* GNU extension to record C++ vtable hierarchy */ | |
154 | static reloc_howto_type elf_mips_gnu_vtinherit_howto = | |
155 | HOWTO (R_MIPS_GNU_VTINHERIT, /* type */ | |
156 | @@ -1071,6 +1103,10 @@ | |
157 | return &elf_mips_gnu_vtentry_howto; | |
158 | case BFD_RELOC_16_PCREL_S2: | |
159 | return &elf_mips_gnu_rel16_s2; | |
160 | + case BFD_RELOC_64_PCREL: | |
161 | + return &elf_mips_gnu_pcrel64; | |
162 | + case BFD_RELOC_32_PCREL: | |
163 | + return &elf_mips_gnu_pcrel32; | |
164 | } | |
165 | } | |
166 | ||
167 | @@ -1092,6 +1128,10 @@ | |
168 | return &elf_mips_gnu_vtentry_howto; | |
169 | case R_MIPS_GNU_REL16_S2: | |
170 | return &elf_mips_gnu_rel16_s2; | |
171 | + case R_MIPS_PC64: | |
172 | + return &elf_mips_gnu_pcrel64; | |
173 | + case R_MIPS_PC32: | |
174 | + return &elf_mips_gnu_pcrel32; | |
175 | default: | |
176 | BFD_ASSERT (r_type < (unsigned int) R_MIPS_max); | |
177 | return &elf_mips_howto_table_rel[r_type]; | |
178 | Index: bfd/elfxx-mips.c | |
179 | =================================================================== | |
180 | RCS file: /cvsroot/gcc/src-cvs/src/bfd/elfxx-mips.c,v | |
181 | retrieving revision 1.100 | |
182 | diff -u -r1.100 elfxx-mips.c | |
183 | --- bfd/elfxx-mips.c 24 Apr 2004 22:07:13 -0000 1.100 | |
184 | +++ bfd/elfxx-mips.c 5 May 2004 17:38:51 -0000 | |
185 | @@ -3335,6 +3335,12 @@ | |
186 | value &= howto->dst_mask; | |
187 | break; | |
188 | ||
189 | + case R_MIPS_PC32: | |
190 | + case R_MIPS_PC64: | |
191 | + value = symbol + addend - p; | |
192 | + value &= howto->dst_mask; | |
193 | + break; | |
194 | + | |
195 | case R_MIPS_GNU_REL16_S2: | |
196 | value = symbol + _bfd_mips_elf_sign_extend (addend, 18) - p; | |
197 | overflowed_p = mips_elf_overflow_p (value, 18); | |
198 | Index: gas/ChangeLog | |
199 | =================================================================== | |
200 | RCS file: /cvsroot/gcc/src-cvs/src/gas/ChangeLog,v | |
201 | retrieving revision 1.2114 | |
202 | diff -u -r1.2114 ChangeLog | |
203 | --- gas/ChangeLog 29 Apr 2004 05:14:20 -0000 1.2114 | |
204 | +++ gas/ChangeLog 5 May 2004 17:38:51 -0000 | |
205 | @@ -1,0 +1,6 @@ | |
206 | +2004-05-05 David Ung <davidu@mips.com> | |
207 | + | |
208 | + * config/tc-mips.c (md_apply_fix3): Revert last change. | |
209 | + (tc_gen_reloc): Put back pc rel handling. | |
210 | + * config/tc-mips.h: Defines DIFF_EXPR_OK. | |
211 | + | |
212 | Index: gas/config/tc-mips.c | |
213 | =================================================================== | |
214 | RCS file: /cvsroot/gcc/src-cvs/src/gas/config/tc-mips.c,v | |
215 | retrieving revision 1.263 | |
216 | diff -u -r1.263 tc-mips.c | |
217 | --- gas/config/tc-mips.c 29 Apr 2004 05:14:21 -0000 1.263 | |
218 | +++ gas/config/tc-mips.c 5 May 2004 17:38:51 -0000 | |
219 | @@ -10861,8 +10861,7 @@ | |
220 | buf = (bfd_byte *) (fixP->fx_frag->fr_literal + fixP->fx_where); | |
221 | ||
222 | /* We are not done if this is a composite relocation to set up gp. */ | |
223 | - assert (! fixP->fx_pcrel); | |
224 | - if (fixP->fx_addsy == NULL | |
225 | + if (fixP->fx_addsy == NULL && ! fixP->fx_pcrel | |
226 | && !(fixP->fx_r_type == BFD_RELOC_MIPS_SUB | |
227 | || (fixP->fx_r_type == BFD_RELOC_64 | |
228 | && (previous_fx_r_type == BFD_RELOC_GPREL32 | |
229 | @@ -12723,8 +12722,27 @@ | |
230 | *reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy); | |
231 | reloc->address = fixp->fx_frag->fr_address + fixp->fx_where; | |
232 | ||
233 | - assert (! fixp->fx_pcrel); | |
234 | - reloc->addend = fixp->fx_addnumber; | |
235 | + if (fixp->fx_pcrel) | |
236 | + { | |
237 | + bfd_vma pcrel_address; | |
238 | + | |
239 | + pcrel_address = reloc->address; | |
240 | + | |
241 | + if (OUTPUT_FLAVOR == bfd_target_elf_flavour) | |
242 | + { | |
243 | + /* At this point, fx_addnumber is "symbol offset - pcrel_address". | |
244 | + Relocations want only the symbol offset. */ | |
245 | + reloc->addend = fixp->fx_addnumber + pcrel_address; | |
246 | + } | |
247 | + else | |
248 | + { | |
249 | + /* A gruesome hack which is a result of the gruesome gas reloc | |
250 | + handling. */ | |
251 | + reloc->addend = pcrel_address; | |
252 | + } | |
253 | + } | |
254 | + else | |
255 | + reloc->addend = fixp->fx_addnumber; | |
256 | ||
257 | /* Since the old MIPS ELF ABI uses Rel instead of Rela, encode the vtable | |
258 | entry to be used in the relocation's section offset. */ | |
259 | @@ -12735,6 +12753,34 @@ | |
260 | } | |
261 | ||
262 | code = fixp->fx_r_type; | |
263 | + if (fixp->fx_pcrel) | |
264 | + { | |
265 | + switch (code) | |
266 | + { | |
267 | + case BFD_RELOC_8: | |
268 | + code = BFD_RELOC_8_PCREL; | |
269 | + break; | |
270 | + case BFD_RELOC_16: | |
271 | + code = BFD_RELOC_16_PCREL; | |
272 | + break; | |
273 | + case BFD_RELOC_32: | |
274 | + code = BFD_RELOC_32_PCREL; | |
275 | + break; | |
276 | + case BFD_RELOC_64: | |
277 | + code = BFD_RELOC_64_PCREL; | |
278 | + break; | |
279 | + case BFD_RELOC_8_PCREL: | |
280 | + case BFD_RELOC_16_PCREL: | |
281 | + case BFD_RELOC_32_PCREL: | |
282 | + case BFD_RELOC_64_PCREL: | |
283 | + case BFD_RELOC_16_PCREL_S2: | |
284 | + break; | |
285 | + default: | |
286 | + as_bad_where (fixp->fx_file, fixp->fx_line, | |
287 | + _("Cannot make %s relocation PC relative"), | |
288 | + bfd_get_reloc_code_name (code)); | |
289 | + } | |
290 | + } | |
291 | ||
292 | /* To support a PC relative reloc, we used a Cygnus extension. | |
293 | We check for that here to make sure that we don't let such a | |
294 | Index: gas/config/tc-mips.h | |
295 | =================================================================== | |
296 | RCS file: /cvsroot/gcc/src-cvs/src/gas/config/tc-mips.h,v | |
297 | retrieving revision 1.35 | |
298 | diff -u -r1.35 tc-mips.h | |
299 | --- gas/config/tc-mips.h 29 Apr 2004 05:14:22 -0000 1.35 | |
300 | +++ gas/config/tc-mips.h 5 May 2004 17:38:51 -0000 | |
301 | @@ -58,6 +58,10 @@ | |
302 | ||
303 | #define MAX_MEM_FOR_RS_ALIGN_CODE (1 + 2) | |
304 | ||
305 | +/* We permit PC relative difference expressions when generating | |
306 | + embedded PIC code. */ | |
307 | +#define DIFF_EXPR_OK | |
308 | + | |
309 | /* Tell assembler that we have an itbl_mips.h header file to include. */ | |
310 | #define HAVE_ITBL_CPU | |
311 | ||
312 | Index: include/elf/ChangeLog | |
313 | =================================================================== | |
314 | RCS file: /cvsroot/gcc/src-cvs/src/include/elf/ChangeLog,v | |
315 | retrieving revision 1.205 | |
316 | diff -u -r1.205 ChangeLog | |
317 | --- include/elf/ChangeLog 24 Apr 2004 22:07:14 -0000 1.205 | |
318 | +++ include/elf/ChangeLog 5 May 2004 17:38:51 -0000 | |
319 | @@ -1,3 +1,7 @@ | |
320 | +2004-05-05 David Ung <davidu@mips.com> | |
321 | + | |
322 | + * mips.h: Put back R_MIPS_PC32 and R_MIPS_PC64. | |
323 | + | |
324 | 2004-04-24 Chris Demetriou <cgd@broadcom.com> | |
325 | ||
326 | * mips.h (R_MIPS_PC32, R_MIPS_PC64, R_MIPS_GNU_REL_LO16) | |
327 | Index: include/elf/mips.h | |
328 | =================================================================== | |
329 | RCS file: /cvsroot/gcc/src-cvs/src/include/elf/mips.h,v | |
330 | retrieving revision 1.22 | |
331 | diff -u -r1.22 mips.h | |
332 | --- include/elf/mips.h 24 Apr 2004 22:07:14 -0000 1.22 | |
333 | +++ include/elf/mips.h 5 May 2004 17:38:51 -0000 | |
334 | @@ -76,6 +76,8 @@ | |
335 | /* These relocs are used for the mips16. */ | |
336 | RELOC_NUMBER (R_MIPS16_26, 100) | |
337 | RELOC_NUMBER (R_MIPS16_GPREL, 101) | |
338 | + RELOC_NUMBER (R_MIPS_PC32, 248) | |
339 | + RELOC_NUMBER (R_MIPS_PC64, 249) | |
340 | /* FIXME: this relocation is used internally by gas. */ | |
341 | RELOC_NUMBER (R_MIPS_GNU_REL16_S2, 250) | |
342 | /* These are GNU extensions to enable C++ vtable garbage collection. */ |