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

Side by Side Diff: bfd/reloc16.c

Issue 11969036: Merge GDB 7.5.1 (Closed) Base URL: http://git.chromium.org/native_client/nacl-gdb.git@master
Patch Set: Created 7 years, 11 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
« no previous file with comments | « bfd/reloc.c ('k') | bfd/riscix.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 8 and 16 bit COFF relocation functions, for BFD. 1 /* 8 and 16 bit COFF relocation functions, for BFD.
2 Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 2000, 2001, 2 Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 2000, 2001,
3 2002, 2003, 2004, 2005, 2007, 2008, 2009 Free Software Foundation, Inc. 3 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2012
4 Free Software Foundation, Inc.
4 Written by Cygnus Support. 5 Written by Cygnus Support.
5 6
6 This file is part of BFD, the Binary File Descriptor library. 7 This file is part of BFD, the Binary File Descriptor library.
7 8
8 This program is free software; you can redistribute it and/or modify 9 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by 10 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3 of the License, or 11 the Free Software Foundation; either version 3 of the License, or
11 (at your option) any later version. 12 (at your option) any later version.
12 13
13 This program is distributed in the hope that it will be useful, 14 This program is distributed in the hope that it will be useful,
(...skipping 22 matching lines...) Expand all
36 37
37 #include "sysdep.h" 38 #include "sysdep.h"
38 #include "bfd.h" 39 #include "bfd.h"
39 #include "libbfd.h" 40 #include "libbfd.h"
40 #include "bfdlink.h" 41 #include "bfdlink.h"
41 #include "genlink.h" 42 #include "genlink.h"
42 #include "coff/internal.h" 43 #include "coff/internal.h"
43 #include "libcoff.h" 44 #include "libcoff.h"
44 45
45 bfd_vma 46 bfd_vma
46 bfd_coff_reloc16_get_value (reloc, link_info, input_section) 47 bfd_coff_reloc16_get_value (arelent *reloc,
47 arelent *reloc; 48 » » » struct bfd_link_info *link_info,
48 struct bfd_link_info *link_info; 49 » » » asection *input_section)
49 asection *input_section;
50 { 50 {
51 bfd_vma value; 51 bfd_vma value;
52 asymbol *symbol = *(reloc->sym_ptr_ptr); 52 asymbol *symbol = *(reloc->sym_ptr_ptr);
53 /* A symbol holds a pointer to a section, and an offset from the 53 /* A symbol holds a pointer to a section, and an offset from the
54 base of the section. To relocate, we find where the section will 54 base of the section. To relocate, we find where the section will
55 live in the output and add that in. */ 55 live in the output and add that in. */
56 56
57 if (bfd_is_und_section (symbol->section) 57 if (bfd_is_und_section (symbol->section)
58 || bfd_is_com_section (symbol->section)) 58 || bfd_is_com_section (symbol->section))
59 { 59 {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 + symbol->section->output_section->vma; 97 + symbol->section->output_section->vma;
98 } 98 }
99 99
100 /* Add the value contained in the relocation. */ 100 /* Add the value contained in the relocation. */
101 value += reloc->addend; 101 value += reloc->addend;
102 102
103 return value; 103 return value;
104 } 104 }
105 105
106 void 106 void
107 bfd_perform_slip (abfd, slip, input_section, value) 107 bfd_perform_slip (bfd *abfd,
108 bfd *abfd; 108 » » unsigned int slip,
109 unsigned int slip; 109 » » asection *input_section,
110 asection *input_section; 110 » » bfd_vma value)
111 bfd_vma value;
112 { 111 {
113 asymbol **s; 112 asymbol **s;
114 113
115 s = _bfd_generic_link_get_symbols (abfd); 114 s = _bfd_generic_link_get_symbols (abfd);
116 BFD_ASSERT (s != (asymbol **) NULL); 115 BFD_ASSERT (s != (asymbol **) NULL);
117 116
118 /* Find all symbols past this point, and make them know 117 /* Find all symbols past this point, and make them know
119 what's happened. */ 118 what's happened. */
120 while (*s) 119 while (*s)
121 { 120 {
(...skipping 14 matching lines...) Expand all
136 h->root.u.def.value -= slip; 135 h->root.u.def.value -= slip;
137 BFD_ASSERT (h->root.u.def.value == p->value); 136 BFD_ASSERT (h->root.u.def.value == p->value);
138 } 137 }
139 } 138 }
140 } 139 }
141 s++; 140 s++;
142 } 141 }
143 } 142 }
144 143
145 bfd_boolean 144 bfd_boolean
146 bfd_coff_reloc16_relax_section (abfd, input_section, link_info, again) 145 bfd_coff_reloc16_relax_section (bfd *abfd,
147 bfd *abfd; 146 » » » » asection *input_section,
148 asection *input_section; 147 » » » » struct bfd_link_info *link_info,
149 struct bfd_link_info *link_info; 148 » » » » bfd_boolean *again)
150 bfd_boolean *again;
151 { 149 {
152 /* Get enough memory to hold the stuff. */ 150 /* Get enough memory to hold the stuff. */
153 bfd *input_bfd = input_section->owner; 151 bfd *input_bfd = input_section->owner;
154 unsigned *shrinks; 152 unsigned *shrinks;
155 unsigned shrink = 0; 153 unsigned shrink = 0;
156 long reloc_size = bfd_get_reloc_upper_bound (input_bfd, input_section); 154 long reloc_size = bfd_get_reloc_upper_bound (input_bfd, input_section);
157 arelent **reloc_vector = NULL; 155 arelent **reloc_vector = NULL;
158 long reloc_count; 156 long reloc_count;
159 157
160 if (link_info->relocatable) 158 if (link_info->relocatable)
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 free ((char *) shrinks); 238 free ((char *) shrinks);
241 } 239 }
242 240
243 input_section->rawsize = input_section->size; 241 input_section->rawsize = input_section->size;
244 input_section->size -= shrink; 242 input_section->size -= shrink;
245 free ((char *) reloc_vector); 243 free ((char *) reloc_vector);
246 return TRUE; 244 return TRUE;
247 } 245 }
248 246
249 bfd_byte * 247 bfd_byte *
250 bfd_coff_reloc16_get_relocated_section_contents (in_abfd, 248 bfd_coff_reloc16_get_relocated_section_contents
251 » » » » » » link_info, 249 (bfd *in_abfd,
252 » » » » » » link_order, 250 struct bfd_link_info *link_info,
253 » » » » » » data, 251 struct bfd_link_order *link_order,
254 » » » » » » relocatable, 252 bfd_byte *data,
255 » » » » » » symbols) 253 bfd_boolean relocatable,
256 bfd *in_abfd; 254 asymbol **symbols)
257 struct bfd_link_info *link_info;
258 struct bfd_link_order *link_order;
259 bfd_byte *data;
260 bfd_boolean relocatable;
261 asymbol **symbols;
262 { 255 {
263 /* Get enough memory to hold the stuff. */ 256 /* Get enough memory to hold the stuff. */
264 bfd *input_bfd = link_order->u.indirect.section->owner; 257 bfd *input_bfd = link_order->u.indirect.section->owner;
265 asection *input_section = link_order->u.indirect.section; 258 asection *input_section = link_order->u.indirect.section;
266 long reloc_size = bfd_get_reloc_upper_bound (input_bfd, input_section); 259 long reloc_size = bfd_get_reloc_upper_bound (input_bfd, input_section);
267 arelent **reloc_vector; 260 arelent **reloc_vector;
268 long reloc_count; 261 long reloc_count;
269 bfd_size_type sz; 262 bfd_size_type sz;
270 263
271 if (reloc_size < 0) 264 if (reloc_size < 0)
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 { 325 {
333 bfd_coff_reloc16_extra_cases (input_bfd, link_info, link_order, 326 bfd_coff_reloc16_extra_cases (input_bfd, link_info, link_order,
334 reloc, data, &src_address, 327 reloc, data, &src_address,
335 &dst_address); 328 &dst_address);
336 } 329 }
337 } 330 }
338 } 331 }
339 free ((char *) reloc_vector); 332 free ((char *) reloc_vector);
340 return data; 333 return data;
341 } 334 }
OLDNEW
« no previous file with comments | « bfd/reloc.c ('k') | bfd/riscix.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698