Changeset 609 for branches/GNU/src/binutils/bfd/reloc16.c
- Timestamp:
- Aug 16, 2003, 6:59:22 PM (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/GNU/src/binutils/bfd/reloc16.c
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.1.1.2
r608 r609 1 1 /* 8 and 16 bit COFF relocation functions, for BFD. 2 Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 2000 3 Free Software Foundation, Inc.2 Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 2000, 2001, 3 2002 Free Software Foundation, Inc. 4 4 Written by Cygnus Support. 5 5 … … 30 30 where coff_link_input_bfd can find them (and coff_link_input_bfd 31 31 should be changed to use this location rather than rereading the 32 file) (unless info->keep_memory is false, in which case they should32 file) (unless info->keep_memory is FALSE, in which case they should 33 33 free up the relocs after dealing with them). */ 34 34 … … 65 65 h = bfd_wrapped_link_hash_lookup (input_section->owner, link_info, 66 66 bfd_asymbol_name (symbol), 67 false, false, true);67 FALSE, FALSE, TRUE); 68 68 if (h != (struct bfd_link_hash_entry *) NULL 69 69 && (h->type == bfd_link_hash_defined … … 80 80 (link_info, bfd_asymbol_name (symbol), 81 81 input_section->owner, input_section, reloc->address, 82 true)))82 TRUE))) 83 83 abort (); 84 84 value = 0; … … 137 137 } 138 138 139 b oolean140 bfd_coff_reloc16_relax_section (abfd, i , link_info, again)139 bfd_boolean 140 bfd_coff_reloc16_relax_section (abfd, input_section, link_info, again) 141 141 bfd *abfd; 142 asection *i ;142 asection *input_section; 143 143 struct bfd_link_info *link_info; 144 b oolean *again;144 bfd_boolean *again; 145 145 { 146 146 /* Get enough memory to hold the stuff. */ 147 bfd *input_bfd = i->owner; 148 asection *input_section = i; 149 int *shrinks; 150 int shrink = 0; 147 bfd *input_bfd = input_section->owner; 148 unsigned *shrinks; 149 unsigned shrink = 0; 151 150 long reloc_size = bfd_get_reloc_upper_bound (input_bfd, input_section); 152 151 arelent **reloc_vector = NULL; … … 155 154 /* We only do global relaxation once. It is not safe to do it multiple 156 155 times (see discussion of the "shrinks" array below). */ 157 *again = false;156 *again = FALSE; 158 157 159 158 if (reloc_size < 0) 160 return false;161 162 reloc_vector = (arelent **) bfd_malloc ( reloc_size);159 return FALSE; 160 161 reloc_vector = (arelent **) bfd_malloc ((bfd_size_type) reloc_size); 163 162 if (!reloc_vector && reloc_size > 0) 164 return false;163 return FALSE; 165 164 166 165 /* Get the relocs and think about them. */ … … 171 170 { 172 171 free (reloc_vector); 173 return false;172 return FALSE; 174 173 } 175 174 … … 192 191 { 193 192 int another_pass = 0; 193 bfd_size_type amt; 194 194 195 195 /* Allocate and initialize the shrinks array for this section. 196 The last element is used as an accumlator of shrinks. */ 197 shrinks = (int *) bfd_malloc ((reloc_count + 1) * sizeof (int)); 198 memset (shrinks, 0, (reloc_count + 1) * sizeof (int)); 196 The last element is used as an accumlator of shrinks. */ 197 amt = reloc_count + 1; 198 amt *= sizeof (unsigned); 199 shrinks = (unsigned *) bfd_zmalloc (amt); 199 200 200 201 /* Loop until nothing changes in this section. */ 201 do { 202 arelent **parent; 203 unsigned int i; 204 long j; 205 206 another_pass = 0; 207 208 for (i = 0, parent = reloc_vector; *parent; parent++, i++) 209 { 210 /* Let the target/machine dependent code examine each reloc 211 in this section and attempt to shrink it. */ 212 shrink = bfd_coff_reloc16_estimate (abfd, input_section, *parent, 213 shrinks[i], link_info); 214 215 /* If it shrunk, note it in the shrinks array and set up for 216 another pass. */ 217 if (shrink != shrinks[i]) 218 { 219 another_pass = 1; 220 for (j = i + 1; j <= reloc_count; j++) 221 shrinks[j] += shrink - shrinks[i]; 222 } 223 } 224 } 202 do 203 { 204 arelent **parent; 205 unsigned int i; 206 long j; 207 208 another_pass = 0; 209 210 for (i = 0, parent = reloc_vector; *parent; parent++, i++) 211 { 212 /* Let the target/machine dependent code examine each reloc 213 in this section and attempt to shrink it. */ 214 shrink = bfd_coff_reloc16_estimate (abfd, input_section, *parent, 215 shrinks[i], link_info); 216 217 /* If it shrunk, note it in the shrinks array and set up for 218 another pass. */ 219 if (shrink != shrinks[i]) 220 { 221 another_pass = 1; 222 for (j = i + 1; j <= reloc_count; j++) 223 shrinks[j] += shrink - shrinks[i]; 224 } 225 } 226 } 225 227 while (another_pass); 226 228 … … 231 233 input_section->_cooked_size -= shrink; 232 234 free ((char *) reloc_vector); 233 return true;235 return TRUE; 234 236 } 235 237 236 238 bfd_byte * 237 bfd_coff_reloc16_get_relocated_section_contents (in_abfd,238 link_info,239 link_order,240 data,241 relocateable,242 symbols)239 bfd_coff_reloc16_get_relocated_section_contents (in_abfd, 240 link_info, 241 link_order, 242 data, 243 relocateable, 244 symbols) 243 245 bfd *in_abfd; 244 246 struct bfd_link_info *link_info; 245 247 struct bfd_link_order *link_order; 246 248 bfd_byte *data; 247 b oolean relocateable;249 bfd_boolean relocateable; 248 250 asymbol **symbols; 249 251 { … … 266 268 267 269 /* Read in the section. */ 268 if (!bfd_get_section_contents (input_bfd,269 input_section,270 data,271 0,272 input_section->_raw_size))270 if (!bfd_get_section_contents (input_bfd, 271 input_section, 272 data, 273 (bfd_vma) 0, 274 input_section->_raw_size)) 273 275 return NULL; 274 276 275 reloc_vector = (arelent **) bfd_malloc (( size_t) reloc_size);277 reloc_vector = (arelent **) bfd_malloc ((bfd_size_type) reloc_size); 276 278 if (!reloc_vector && reloc_size != 0) 277 279 return NULL; -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.