Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(680)

Side by Side Diff: binutils/gas/write.c

Issue 3018030: [binutils] Bump binutils to 2.20.1 (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/nacl-toolchain.git
Patch Set: Created 10 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « binutils/gas/write.h ('k') | binutils/gold/ChangeLog » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* write.c - emit .o file 1 /* write.c - emit .o file
2 Copyright 1986, 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 2 Copyright 1986, 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
3 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 3 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
4 Free Software Foundation, Inc. 4 Free Software Foundation, Inc.
5 5
6 This file is part of GAS, the GNU Assembler. 6 This file is part of GAS, the GNU Assembler.
7 7
8 GAS is free software; you can redistribute it and/or modify 8 GAS is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by 9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3, or (at your option) 10 the Free Software Foundation; either version 3, or (at your option)
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 /* Create a fixS in obstack 'notes'. */ 143 /* Create a fixS in obstack 'notes'. */
144 144
145 static fixS * 145 static fixS *
146 fix_new_internal (fragS *frag, /* Which frag? */ 146 fix_new_internal (fragS *frag, /* Which frag? */
147 int where, /* Where in that frag? */ 147 int where, /* Where in that frag? */
148 int size, /* 1, 2, or 4 usually. */ 148 int size, /* 1, 2, or 4 usually. */
149 symbolS *add_symbol, /* X_add_symbol. */ 149 symbolS *add_symbol, /* X_add_symbol. */
150 symbolS *sub_symbol, /* X_op_symbol. */ 150 symbolS *sub_symbol, /* X_op_symbol. */
151 offsetT offset, /* X_add_number. */ 151 offsetT offset, /* X_add_number. */
152 int pcrel, /* TRUE if PC-relative relocation. */ 152 int pcrel, /* TRUE if PC-relative relocation. */
153 » » RELOC_ENUM r_type ATTRIBUTE_UNUSED /* Relocation type. */) 153 » » RELOC_ENUM r_type ATTRIBUTE_UNUSED /* Relocation type. */,
154 » » int at_beginning)» /* Add to the start of the list? */
154 { 155 {
155 fixS *fixP; 156 fixS *fixP;
156 157
157 n_fixups++; 158 n_fixups++;
158 159
159 fixP = (fixS *) obstack_alloc (&notes, sizeof (fixS)); 160 fixP = (fixS *) obstack_alloc (&notes, sizeof (fixS));
160 161
161 fixP->fx_frag = frag; 162 fixP->fx_frag = frag;
162 fixP->fx_where = where; 163 fixP->fx_where = where;
163 fixP->fx_size = size; 164 fixP->fx_size = size;
(...skipping 23 matching lines...) Expand all
187 fixP->fx_cgen.insn = NULL; 188 fixP->fx_cgen.insn = NULL;
188 fixP->fx_cgen.opinfo = 0; 189 fixP->fx_cgen.opinfo = 0;
189 #endif 190 #endif
190 191
191 #ifdef TC_FIX_TYPE 192 #ifdef TC_FIX_TYPE
192 TC_INIT_FIX_DATA (fixP); 193 TC_INIT_FIX_DATA (fixP);
193 #endif 194 #endif
194 195
195 as_where (&fixP->fx_file, &fixP->fx_line); 196 as_where (&fixP->fx_file, &fixP->fx_line);
196 197
197 /* Usually, we want relocs sorted numerically, but while
198 comparing to older versions of gas that have relocs
199 reverse sorted, it is convenient to have this compile
200 time option. xoxorich. */
201 { 198 {
202 199
203 fixS **seg_fix_rootP = (frags_chained 200 fixS **seg_fix_rootP = (frags_chained
204 ? &seg_info (now_seg)->fix_root 201 ? &seg_info (now_seg)->fix_root
205 : &frchain_now->fix_root); 202 : &frchain_now->fix_root);
206 fixS **seg_fix_tailP = (frags_chained 203 fixS **seg_fix_tailP = (frags_chained
207 ? &seg_info (now_seg)->fix_tail 204 ? &seg_info (now_seg)->fix_tail
208 : &frchain_now->fix_tail); 205 : &frchain_now->fix_tail);
209 206
210 #ifdef REVERSE_SORT_RELOCS 207 if (at_beginning)
211 208 {
212 fixP->fx_next = *seg_fix_rootP; 209 » fixP->fx_next = *seg_fix_rootP;
213 *seg_fix_rootP = fixP; 210 » *seg_fix_rootP = fixP;
214 211 » if (fixP->fx_next == NULL)
215 #else /* REVERSE_SORT_RELOCS */ 212 » *seg_fix_tailP = fixP;
216 213 }
217 fixP->fx_next = NULL;
218
219 if (*seg_fix_tailP)
220 (*seg_fix_tailP)->fx_next = fixP;
221 else 214 else
222 *seg_fix_rootP = fixP; 215 {
223 *seg_fix_tailP = fixP; 216 » fixP->fx_next = NULL;
224 217 » if (*seg_fix_tailP)
225 #endif /* REVERSE_SORT_RELOCS */ 218 » (*seg_fix_tailP)->fx_next = fixP;
219 » else
220 » *seg_fix_rootP = fixP;
221 » *seg_fix_tailP = fixP;
222 }
226 } 223 }
227 224
228 return fixP; 225 return fixP;
229 } 226 }
230 227
231 /* Create a fixup relative to a symbol (plus a constant). */ 228 /* Create a fixup relative to a symbol (plus a constant). */
232 229
233 fixS * 230 fixS *
234 fix_new (fragS *frag, /* Which frag? */ 231 fix_new (fragS *frag, /* Which frag? */
235 int where, /* Where in that frag? */ 232 int where, /* Where in that frag? */
236 int size, /* 1, 2, or 4 usually. */ 233 int size, /* 1, 2, or 4 usually. */
237 symbolS *add_symbol, /* X_add_symbol. */ 234 symbolS *add_symbol, /* X_add_symbol. */
238 offsetT offset, /* X_add_number. */ 235 offsetT offset, /* X_add_number. */
239 int pcrel, /* TRUE if PC-relative relocation. */ 236 int pcrel, /* TRUE if PC-relative relocation. */
240 RELOC_ENUM r_type /* Relocation type. */) 237 RELOC_ENUM r_type /* Relocation type. */)
241 { 238 {
242 return fix_new_internal (frag, where, size, add_symbol, 239 return fix_new_internal (frag, where, size, add_symbol,
243 » » » (symbolS *) NULL, offset, pcrel, r_type); 240 » » » (symbolS *) NULL, offset, pcrel, r_type, FALSE);
244 } 241 }
245 242
246 /* Create a fixup for an expression. Currently we only support fixups 243 /* Create a fixup for an expression. Currently we only support fixups
247 for difference expressions. That is itself more than most object 244 for difference expressions. That is itself more than most object
248 file formats support anyhow. */ 245 file formats support anyhow. */
249 246
250 fixS * 247 fixS *
251 fix_new_exp (fragS *frag, /* Which frag? */ 248 fix_new_exp (fragS *frag, /* Which frag? */
252 int where, /* Where in that frag? */ 249 int where, /* Where in that frag? */
253 int size, /* 1, 2, or 4 usually. */ 250 int size, /* 1, 2, or 4 usually. */
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 /* Fall through. */ 298 /* Fall through. */
302 case O_constant: 299 case O_constant:
303 off = exp->X_add_number; 300 off = exp->X_add_number;
304 break; 301 break;
305 302
306 default: 303 default:
307 add = make_expr_symbol (exp); 304 add = make_expr_symbol (exp);
308 break; 305 break;
309 } 306 }
310 307
311 return fix_new_internal (frag, where, size, add, sub, off, pcrel, r_type); 308 return fix_new_internal (frag, where, size, add, sub, off, pcrel,
309 » » » r_type, FALSE);
310 }
311
312 /* Create a fixup at the beginning of FRAG. The arguments are the same
313 as for fix_new, except that WHERE is implicitly 0. */
314
315 fixS *
316 fix_at_start (fragS *frag, int size, symbolS *add_symbol,
317 » offsetT offset, int pcrel, RELOC_ENUM r_type)
318 {
319 return fix_new_internal (frag, 0, size, add_symbol,
320 » » » (symbolS *) NULL, offset, pcrel, r_type, TRUE);
312 } 321 }
313 322
314 /* Generic function to determine whether a fixup requires a relocation. */ 323 /* Generic function to determine whether a fixup requires a relocation. */
315 int 324 int
316 generic_force_reloc (fixS *fix) 325 generic_force_reloc (fixS *fix)
317 { 326 {
318 if (fix->fx_r_type == BFD_RELOC_VTABLE_INHERIT 327 if (fix->fx_r_type == BFD_RELOC_VTABLE_INHERIT
319 || fix->fx_r_type == BFD_RELOC_VTABLE_ENTRY) 328 || fix->fx_r_type == BFD_RELOC_VTABLE_ENTRY)
320 return 1; 329 return 1;
321 330
(...skipping 2250 matching lines...) Expand 10 before | Expand all | Expand 10 after
2572 { 2581 {
2573 fprintf (stderr, "\n -<"); 2582 fprintf (stderr, "\n -<");
2574 print_symbol_value_1 (stderr, fixp->fx_subsy); 2583 print_symbol_value_1 (stderr, fixp->fx_subsy);
2575 fprintf (stderr, ">"); 2584 fprintf (stderr, ">");
2576 } 2585 }
2577 fprintf (stderr, "\n"); 2586 fprintf (stderr, "\n");
2578 #ifdef TC_FIX_DATA_PRINT 2587 #ifdef TC_FIX_DATA_PRINT
2579 TC_FIX_DATA_PRINT (stderr, fixp); 2588 TC_FIX_DATA_PRINT (stderr, fixp);
2580 #endif 2589 #endif
2581 } 2590 }
OLDNEW
« no previous file with comments | « binutils/gas/write.h ('k') | binutils/gold/ChangeLog » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698