OLD | NEW |
1 /* BFD backend for hp-ux 9000/300 | 1 /* BFD backend for hp-ux 9000/300 |
2 Copyright 1990, 1991, 1993, 1994, 1995, 1997, 1999, 2000, 2001, 2002, | 2 Copyright 1990, 1991, 1993, 1994, 1995, 1997, 1999, 2000, 2001, 2002, |
3 2003, 2004, 2005, 2007, 2010 Free Software Foundation, Inc. | 3 2003, 2004, 2005, 2007, 2010, 2012 Free Software Foundation, Inc. |
4 Written by Glenn Engel. | 4 Written by Glenn Engel. |
5 | 5 |
6 This file is part of BFD, the Binary File Descriptor library. | 6 This file is part of BFD, the Binary File Descriptor library. |
7 | 7 |
8 This program is free software; you can redistribute it and/or modify | 8 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 | 9 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 | 10 the Free Software Foundation; either version 3 of the License, or |
11 (at your option) any later version. | 11 (at your option) any later version. |
12 | 12 |
13 This program is distributed in the hope that it will be useful, | 13 This program is distributed in the hope that it will be useful, |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 | 188 |
189 #define NAME(x,y) CONCAT3 (hp300hpux,_32_,y) | 189 #define NAME(x,y) CONCAT3 (hp300hpux,_32_,y) |
190 #define ARCH_SIZE 32 | 190 #define ARCH_SIZE 32 |
191 | 191 |
192 /* aoutx.h requires definitions for BMAGIC and QMAGIC. */ | 192 /* aoutx.h requires definitions for BMAGIC and QMAGIC. */ |
193 #define BMAGIC HPUX_DOT_O_MAGIC | 193 #define BMAGIC HPUX_DOT_O_MAGIC |
194 #define QMAGIC 0314 | 194 #define QMAGIC 0314 |
195 | 195 |
196 #include "aoutx.h" | 196 #include "aoutx.h" |
197 | 197 |
198 static const bfd_target * MY (callback) | 198 static const bfd_target * MY (callback) (bfd *); |
199 PARAMS ((bfd *)); | 199 static bfd_boolean MY (write_object_contents) (bfd *); |
200 static bfd_boolean MY (write_object_contents) | |
201 PARAMS ((bfd *)); | |
202 static void convert_sym_type | 200 static void convert_sym_type |
203 PARAMS ((struct external_nlist *, aout_symbol_type *, bfd *)); | 201 (struct external_nlist *, aout_symbol_type *, bfd *); |
204 | 202 |
205 bfd_boolean MY (slurp_symbol_table) | 203 bfd_boolean MY (slurp_symbol_table) (bfd *); |
206 PARAMS ((bfd *)); | |
207 void MY (swap_std_reloc_in) | 204 void MY (swap_std_reloc_in) |
208 PARAMS ((bfd *, struct hp300hpux_reloc *, arelent *, asymbol **, | 205 (bfd *, struct hp300hpux_reloc *, arelent *, asymbol **, bfd_size_type); |
209 » bfd_size_type)); | |
210 bfd_boolean MY (slurp_reloc_table) | 206 bfd_boolean MY (slurp_reloc_table) |
211 PARAMS ((bfd *, sec_ptr, asymbol **)); | 207 (bfd *, sec_ptr, asymbol **); |
212 long MY (canonicalize_symtab) | 208 long MY (canonicalize_symtab) (bfd *, asymbol **); |
213 PARAMS ((bfd *, asymbol **)); | 209 long MY (get_symtab_upper_bound) (bfd *); |
214 long MY (get_symtab_upper_bound) | 210 long MY (canonicalize_reloc) (bfd *, sec_ptr, arelent **, asymbol **); |
215 PARAMS ((bfd *)); | |
216 long MY (canonicalize_reloc) | |
217 PARAMS ((bfd *, sec_ptr, arelent **, asymbol **)); | |
218 | 211 |
219 /* Since the hpux symbol table has nlist elements interspersed with | 212 /* Since the hpux symbol table has nlist elements interspersed with |
220 strings and we need to insert som strings for secondary symbols, we | 213 strings and we need to insert som strings for secondary symbols, we |
221 give ourselves a little extra padding up front to account for | 214 give ourselves a little extra padding up front to account for |
222 this. Note that for each non-secondary symbol we process, we gain | 215 this. Note that for each non-secondary symbol we process, we gain |
223 9 bytes of space for the discarded nlist element (one byte used for | 216 9 bytes of space for the discarded nlist element (one byte used for |
224 null). SYM_EXTRA_BYTES is the extra space. */ | 217 null). SYM_EXTRA_BYTES is the extra space. */ |
225 #define SYM_EXTRA_BYTES 1024 | 218 #define SYM_EXTRA_BYTES 1024 |
226 | 219 |
227 /* Set parameters about this a.out file that are machine-dependent. | 220 /* Set parameters about this a.out file that are machine-dependent. |
228 This routine is called from some_aout_object_p just before it returns. */ | 221 This routine is called from some_aout_object_p just before it returns. */ |
229 static const bfd_target * | 222 static const bfd_target * |
230 MY (callback) (abfd) | 223 MY (callback) (bfd *abfd) |
231 bfd *abfd; | |
232 { | 224 { |
233 struct internal_exec *execp = exec_hdr (abfd); | 225 struct internal_exec *execp = exec_hdr (abfd); |
234 | 226 |
235 /* Calculate the file positions of the parts of a newly read aout header */ | 227 /* Calculate the file positions of the parts of a newly read aout header */ |
236 obj_textsec (abfd)->size = N_TXTSIZE (*execp); | 228 obj_textsec (abfd)->size = N_TXTSIZE (*execp); |
237 | 229 |
238 /* The virtual memory addresses of the sections */ | 230 /* The virtual memory addresses of the sections */ |
239 obj_textsec (abfd)->vma = N_TXTADDR (*execp); | 231 obj_textsec (abfd)->vma = N_TXTADDR (*execp); |
240 obj_datasec (abfd)->vma = N_DATADDR (*execp); | 232 obj_datasec (abfd)->vma = N_DATADDR (*execp); |
241 obj_bsssec (abfd)->vma = N_BSSADDR (*execp); | 233 obj_bsssec (abfd)->vma = N_BSSADDR (*execp); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 | 267 |
276 abfd->flags |= HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS; | 268 abfd->flags |= HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS; |
277 bfd_get_symcount (abfd) = execp->a_syms / 12; | 269 bfd_get_symcount (abfd) = execp->a_syms / 12; |
278 obj_symbol_entry_size (abfd) = 12; | 270 obj_symbol_entry_size (abfd) = 12; |
279 obj_reloc_entry_size (abfd) = RELOC_STD_SIZE; | 271 obj_reloc_entry_size (abfd) = RELOC_STD_SIZE; |
280 } | 272 } |
281 | 273 |
282 return abfd->xvec; | 274 return abfd->xvec; |
283 } | 275 } |
284 | 276 |
285 extern bfd_boolean aout_32_write_syms | 277 extern bfd_boolean aout_32_write_syms (bfd *); |
286 PARAMS ((bfd * abfd)); | |
287 | 278 |
288 static bfd_boolean | 279 static bfd_boolean |
289 MY (write_object_contents) (abfd) | 280 MY (write_object_contents) (bfd * abfd) |
290 bfd *abfd; | |
291 { | 281 { |
292 struct external_exec exec_bytes; | 282 struct external_exec exec_bytes; |
293 struct internal_exec *execp = exec_hdr (abfd); | 283 struct internal_exec *execp = exec_hdr (abfd); |
294 bfd_size_type text_size; /* dummy vars */ | 284 bfd_size_type text_size; /* dummy vars */ |
295 file_ptr text_end; | 285 file_ptr text_end; |
296 | 286 |
297 memset (&exec_bytes, 0, sizeof (exec_bytes)); | 287 memset (&exec_bytes, 0, sizeof (exec_bytes)); |
298 | 288 |
299 obj_reloc_entry_size (abfd) = RELOC_STD_SIZE; | 289 obj_reloc_entry_size (abfd) = RELOC_STD_SIZE; |
300 | 290 |
(...skipping 12 matching lines...) Expand all Loading... |
313 N_SET_FLAGS (*execp, aout_backend_info (abfd)->exec_hdr_flags); | 303 N_SET_FLAGS (*execp, aout_backend_info (abfd)->exec_hdr_flags); |
314 | 304 |
315 NAME (aout,swap_exec_header_out) (abfd, execp, &exec_bytes); | 305 NAME (aout,swap_exec_header_out) (abfd, execp, &exec_bytes); |
316 | 306 |
317 /* update fields not covered by default swap_exec_header_out */ | 307 /* update fields not covered by default swap_exec_header_out */ |
318 | 308 |
319 /* this is really the sym table size but we store it in drelocs */ | 309 /* this is really the sym table size but we store it in drelocs */ |
320 H_PUT_32 (abfd, (bfd_get_symcount (abfd) * 12), exec_bytes.e_drelocs); | 310 H_PUT_32 (abfd, (bfd_get_symcount (abfd) * 12), exec_bytes.e_drelocs); |
321 | 311 |
322 if (bfd_seek (abfd, (file_ptr) 0, FALSE) != 0 | 312 if (bfd_seek (abfd, (file_ptr) 0, FALSE) != 0 |
323 || (bfd_bwrite ((PTR) &exec_bytes, (bfd_size_type) EXEC_BYTES_SIZE, abfd) | 313 || (bfd_bwrite (&exec_bytes, (bfd_size_type) EXEC_BYTES_SIZE, abfd) |
324 != EXEC_BYTES_SIZE)) | 314 != EXEC_BYTES_SIZE)) |
325 return FALSE; | 315 return FALSE; |
326 | 316 |
327 /* Write out the symbols, and then the relocs. We must write out | 317 /* Write out the symbols, and then the relocs. We must write out |
328 the symbols first so that we know the symbol indices. */ | 318 the symbols first so that we know the symbol indices. */ |
329 | 319 |
330 if (bfd_get_symcount (abfd) != 0) | 320 if (bfd_get_symcount (abfd) != 0) |
331 { | 321 { |
332 /* Skip the relocs to where we want to put the symbols. */ | 322 /* Skip the relocs to where we want to put the symbols. */ |
333 if (bfd_seek (abfd, (file_ptr) (N_DRELOFF (*execp) + execp->a_drsize), | 323 if (bfd_seek (abfd, (file_ptr) (N_DRELOFF (*execp) + execp->a_drsize), |
(...skipping 12 matching lines...) Expand all Loading... |
346 return FALSE; | 336 return FALSE; |
347 if (bfd_seek (abfd, (file_ptr) N_DRELOFF (*execp), SEEK_CUR) != 0) | 337 if (bfd_seek (abfd, (file_ptr) N_DRELOFF (*execp), SEEK_CUR) != 0) |
348 return FALSE; | 338 return FALSE; |
349 if (!NAME (aout,squirt_out_relocs) (abfd, obj_datasec (abfd))) | 339 if (!NAME (aout,squirt_out_relocs) (abfd, obj_datasec (abfd))) |
350 return FALSE; | 340 return FALSE; |
351 } | 341 } |
352 | 342 |
353 return TRUE; | 343 return TRUE; |
354 } | 344 } |
355 | 345 |
356 /* convert the hp symbol type to be the same as aout64.h usage so we */ | 346 /* Convert the hp symbol type to be the same as aout64.h usage so we |
357 /* can piggyback routines in aoutx.h. */ | 347 can piggyback routines in aoutx.h. */ |
358 | 348 |
359 static void | 349 static void |
360 convert_sym_type (sym_pointer, cache_ptr, abfd) | 350 convert_sym_type (struct external_nlist *sym_pointer ATTRIBUTE_UNUSED, |
361 struct external_nlist *sym_pointer ATTRIBUTE_UNUSED; | 351 » » aout_symbol_type *cache_ptr, |
362 aout_symbol_type *cache_ptr; | 352 » » bfd *abfd ATTRIBUTE_UNUSED) |
363 bfd *abfd ATTRIBUTE_UNUSED; | |
364 { | 353 { |
365 int name_type; | 354 int name_type; |
366 int new_type; | 355 int new_type; |
367 | 356 |
368 name_type = (cache_ptr->type); | 357 name_type = (cache_ptr->type); |
369 new_type = 0; | 358 new_type = 0; |
370 | 359 |
371 if ((name_type & HP_SYMTYPE_ALIGN) != 0) | 360 if ((name_type & HP_SYMTYPE_ALIGN) != 0) |
372 { | 361 { |
373 /* iou_error ("aligned symbol encountered: %s", name);*/ | 362 /* iou_error ("aligned symbol encountered: %s", name);*/ |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
445 } | 434 } |
446 | 435 |
447 /* | 436 /* |
448 DESCRIPTION | 437 DESCRIPTION |
449 Swaps the information in an executable header taken from a raw | 438 Swaps the information in an executable header taken from a raw |
450 byte stream memory image, into the internal exec_header | 439 byte stream memory image, into the internal exec_header |
451 structure. | 440 structure. |
452 */ | 441 */ |
453 | 442 |
454 void | 443 void |
455 NAME (aout,swap_exec_header_in) (abfd, raw_bytes, execp) | 444 NAME (aout,swap_exec_header_in) (bfd *abfd, |
456 bfd *abfd; | 445 » » » » struct external_exec *raw_bytes, |
457 struct external_exec *raw_bytes; | 446 » » » » struct internal_exec *execp) |
458 struct internal_exec *execp; | |
459 { | 447 { |
460 struct external_exec *bytes = (struct external_exec *) raw_bytes; | 448 struct external_exec *bytes = (struct external_exec *) raw_bytes; |
461 | 449 |
462 /* The internal_exec structure has some fields that are unused in this | 450 /* The internal_exec structure has some fields that are unused in this |
463 configuration (IE for i960), so ensure that all such uninitialized | 451 configuration (IE for i960), so ensure that all such uninitialized |
464 fields are zero'd out. There are places where two of these structs | 452 fields are zero'd out. There are places where two of these structs |
465 are memcmp'd, and thus the contents do matter. */ | 453 are memcmp'd, and thus the contents do matter. */ |
466 memset (execp, 0, sizeof (struct internal_exec)); | 454 memset (execp, 0, sizeof (struct internal_exec)); |
467 /* Now fill in fields in the execp, from the bytes in the raw data. */ | 455 /* Now fill in fields in the execp, from the bytes in the raw data. */ |
468 execp->a_info = H_GET_32 (abfd, bytes->e_info); | 456 execp->a_info = H_GET_32 (abfd, bytes->e_info); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
529 terminate them, using storage from the already allocated symbol table: | 517 terminate them, using storage from the already allocated symbol table: |
530 | 518 |
531 string1 | 519 string1 |
532 null | 520 null |
533 string2 | 521 string2 |
534 null | 522 null |
535 ... | 523 ... |
536 */ | 524 */ |
537 | 525 |
538 bfd_boolean | 526 bfd_boolean |
539 MY (slurp_symbol_table) (abfd) | 527 MY (slurp_symbol_table) (bfd *abfd) |
540 bfd *abfd; | |
541 { | 528 { |
542 bfd_size_type symbol_bytes; | 529 bfd_size_type symbol_bytes; |
543 struct external_nlist *syms; | 530 struct external_nlist *syms; |
544 struct external_nlist *sym_pointer; | 531 struct external_nlist *sym_pointer; |
545 struct external_nlist *sym_end; | 532 struct external_nlist *sym_end; |
546 char *strings; | 533 char *strings; |
547 aout_symbol_type *cached; | 534 aout_symbol_type *cached; |
548 unsigned num_syms = 0; | 535 unsigned num_syms = 0; |
549 bfd_size_type amt; | 536 bfd_size_type amt; |
550 | 537 |
551 /* If there's no work to be done, don't do any */ | 538 /* If there's no work to be done, don't do any */ |
552 if (obj_aout_symbols (abfd) != (aout_symbol_type *) NULL) | 539 if (obj_aout_symbols (abfd) != (aout_symbol_type *) NULL) |
553 return TRUE; | 540 return TRUE; |
554 symbol_bytes = exec_hdr (abfd)->a_syms; | 541 symbol_bytes = exec_hdr (abfd)->a_syms; |
555 | 542 |
556 amt = symbol_bytes + SYM_EXTRA_BYTES; | 543 amt = symbol_bytes + SYM_EXTRA_BYTES; |
557 strings = (char *) bfd_alloc (abfd, amt); | 544 strings = (char *) bfd_alloc (abfd, amt); |
558 if (!strings) | 545 if (!strings) |
559 return FALSE; | 546 return FALSE; |
560 syms = (struct external_nlist *) (strings + SYM_EXTRA_BYTES); | 547 syms = (struct external_nlist *) (strings + SYM_EXTRA_BYTES); |
561 if (bfd_seek (abfd, obj_sym_filepos (abfd), SEEK_SET) != 0 | 548 if (bfd_seek (abfd, obj_sym_filepos (abfd), SEEK_SET) != 0 |
562 || bfd_bread ((PTR) syms, symbol_bytes, abfd) != symbol_bytes) | 549 || bfd_bread (syms, symbol_bytes, abfd) != symbol_bytes) |
563 { | 550 { |
564 bfd_release (abfd, syms); | 551 bfd_release (abfd, syms); |
565 return FALSE; | 552 return FALSE; |
566 } | 553 } |
567 | 554 |
568 sym_end = (struct external_nlist *) (((char *) syms) + symbol_bytes); | 555 sym_end = (struct external_nlist *) (((char *) syms) + symbol_bytes); |
569 | 556 |
570 /* first, march thru the table and figure out how many symbols there are */ | 557 /* first, march thru the table and figure out how many symbols there are */ |
571 for (sym_pointer = syms; sym_pointer < sym_end; sym_pointer++, num_syms++) | 558 for (sym_pointer = syms; sym_pointer < sym_end; sym_pointer++, num_syms++) |
572 { | 559 { |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
633 length); | 620 length); |
634 } | 621 } |
635 } | 622 } |
636 | 623 |
637 obj_aout_symbols (abfd) = cached; | 624 obj_aout_symbols (abfd) = cached; |
638 | 625 |
639 return TRUE; | 626 return TRUE; |
640 } | 627 } |
641 | 628 |
642 void | 629 void |
643 MY (swap_std_reloc_in) (abfd, bytes, cache_ptr, symbols, symcount) | 630 MY (swap_std_reloc_in) (bfd *abfd, |
644 bfd *abfd; | 631 » » » struct hp300hpux_reloc *bytes, |
645 struct hp300hpux_reloc *bytes; | 632 » » » arelent *cache_ptr, |
646 arelent *cache_ptr; | 633 » » » asymbol **symbols, |
647 asymbol **symbols; | 634 » » » bfd_size_type symcount ATTRIBUTE_UNUSED) |
648 bfd_size_type symcount ATTRIBUTE_UNUSED; | |
649 { | 635 { |
650 int r_index; | 636 int r_index; |
651 int r_extern = 0; | 637 int r_extern = 0; |
652 unsigned int r_length; | 638 unsigned int r_length; |
653 int r_pcrel = 0; | 639 int r_pcrel = 0; |
654 struct aoutdata *su = &(abfd->tdata.aout_data->a); | 640 struct aoutdata *su = &(abfd->tdata.aout_data->a); |
655 | 641 |
656 cache_ptr->address = H_GET_32 (abfd, bytes->r_address); | 642 cache_ptr->address = H_GET_32 (abfd, bytes->r_address); |
657 r_index = H_GET_16 (abfd, bytes->r_index); | 643 r_index = H_GET_16 (abfd, bytes->r_index); |
658 | 644 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
712 /* adds this in later. Add it in now... */ | 698 /* adds this in later. Add it in now... */ |
713 MOVE_ADDRESS (-cache_ptr->address); | 699 MOVE_ADDRESS (-cache_ptr->address); |
714 } | 700 } |
715 else | 701 else |
716 { | 702 { |
717 MOVE_ADDRESS (0); | 703 MOVE_ADDRESS (0); |
718 } | 704 } |
719 } | 705 } |
720 | 706 |
721 bfd_boolean | 707 bfd_boolean |
722 MY (slurp_reloc_table) (abfd, asect, symbols) | 708 MY (slurp_reloc_table) (bfd *abfd, sec_ptr asect, asymbol **symbols) |
723 bfd *abfd; | |
724 sec_ptr asect; | |
725 asymbol **symbols; | |
726 { | 709 { |
727 bfd_size_type count; | 710 bfd_size_type count; |
728 bfd_size_type reloc_size; | 711 bfd_size_type reloc_size; |
729 PTR relocs; | 712 void * relocs; |
730 arelent *reloc_cache; | 713 arelent *reloc_cache; |
731 size_t each_size; | 714 size_t each_size; |
732 struct hp300hpux_reloc *rptr; | 715 struct hp300hpux_reloc *rptr; |
733 unsigned int counter; | 716 unsigned int counter; |
734 arelent *cache_ptr; | 717 arelent *cache_ptr; |
735 | 718 |
736 if (asect->relocation) | 719 if (asect->relocation) |
737 return TRUE; | 720 return TRUE; |
738 | 721 |
739 if (asect->flags & SEC_CONSTRUCTOR) | 722 if (asect->flags & SEC_CONSTRUCTOR) |
(...skipping 18 matching lines...) Expand all Loading... |
758 if (bfd_seek (abfd, asect->rel_filepos, SEEK_SET) != 0) | 741 if (bfd_seek (abfd, asect->rel_filepos, SEEK_SET) != 0) |
759 return FALSE; | 742 return FALSE; |
760 each_size = obj_reloc_entry_size (abfd); | 743 each_size = obj_reloc_entry_size (abfd); |
761 | 744 |
762 count = reloc_size / each_size; | 745 count = reloc_size / each_size; |
763 | 746 |
764 reloc_cache = (arelent *) bfd_zalloc (abfd, count * sizeof (arelent)); | 747 reloc_cache = (arelent *) bfd_zalloc (abfd, count * sizeof (arelent)); |
765 if (!reloc_cache && count != 0) | 748 if (!reloc_cache && count != 0) |
766 return FALSE; | 749 return FALSE; |
767 | 750 |
768 relocs = (PTR) bfd_alloc (abfd, reloc_size); | 751 relocs = bfd_alloc (abfd, reloc_size); |
769 if (!relocs && reloc_size != 0) | 752 if (!relocs && reloc_size != 0) |
770 { | 753 { |
771 bfd_release (abfd, reloc_cache); | 754 bfd_release (abfd, reloc_cache); |
772 return FALSE; | 755 return FALSE; |
773 } | 756 } |
774 | 757 |
775 if (bfd_bread (relocs, reloc_size, abfd) != reloc_size) | 758 if (bfd_bread (relocs, reloc_size, abfd) != reloc_size) |
776 { | 759 { |
777 bfd_release (abfd, relocs); | 760 bfd_release (abfd, relocs); |
778 bfd_release (abfd, reloc_cache); | 761 bfd_release (abfd, reloc_cache); |
(...skipping 15 matching lines...) Expand all Loading... |
794 asect->reloc_count = count; | 777 asect->reloc_count = count; |
795 return TRUE; | 778 return TRUE; |
796 } | 779 } |
797 | 780 |
798 /************************************************************************/ | 781 /************************************************************************/ |
799 /* The following functions are identical to functions in aoutx.h except */ | 782 /* The following functions are identical to functions in aoutx.h except */ |
800 /* they refer to MY(func) rather than NAME(aout,func) and they also */ | 783 /* they refer to MY(func) rather than NAME(aout,func) and they also */ |
801 /* call aout_32 versions if the input file was generated by gcc */ | 784 /* call aout_32 versions if the input file was generated by gcc */ |
802 /************************************************************************/ | 785 /************************************************************************/ |
803 | 786 |
804 long aout_32_canonicalize_symtab | 787 long aout_32_canonicalize_symtab (bfd *, asymbol **); |
805 PARAMS ((bfd * abfd, asymbol ** location)); | 788 long aout_32_get_symtab_upper_bound (bfd *); |
806 long aout_32_get_symtab_upper_bound | 789 long aout_32_canonicalize_reloc (bfd *, sec_ptr, arelent **, asymbol **); |
807 PARAMS ((bfd * abfd)); | |
808 long aout_32_canonicalize_reloc | |
809 PARAMS ((bfd * abfd, sec_ptr section, arelent ** relptr, | |
810 » asymbol ** symbols)); | |
811 | 790 |
812 long | 791 long |
813 MY (canonicalize_symtab) (abfd, location) | 792 MY (canonicalize_symtab) (bfd *abfd, asymbol **location) |
814 bfd *abfd; | |
815 asymbol **location; | |
816 { | 793 { |
817 unsigned int counter = 0; | 794 unsigned int counter = 0; |
818 aout_symbol_type *symbase; | 795 aout_symbol_type *symbase; |
819 | 796 |
820 if (obj_aout_subformat (abfd) == gnu_encap_format) | 797 if (obj_aout_subformat (abfd) == gnu_encap_format) |
821 return aout_32_canonicalize_symtab (abfd, location); | 798 return aout_32_canonicalize_symtab (abfd, location); |
822 | 799 |
823 if (!MY (slurp_symbol_table) (abfd)) | 800 if (!MY (slurp_symbol_table) (abfd)) |
824 return -1; | 801 return -1; |
825 | 802 |
826 for (symbase = obj_aout_symbols (abfd); counter++ < bfd_get_symcount (abfd);) | 803 for (symbase = obj_aout_symbols (abfd); counter++ < bfd_get_symcount (abfd);) |
827 *(location++) = (asymbol *) (symbase++); | 804 *(location++) = (asymbol *) (symbase++); |
828 *location++ = 0; | 805 *location++ = 0; |
829 return bfd_get_symcount (abfd); | 806 return bfd_get_symcount (abfd); |
830 } | 807 } |
831 | 808 |
832 long | 809 long |
833 MY (get_symtab_upper_bound) (abfd) | 810 MY (get_symtab_upper_bound) (bfd *abfd) |
834 bfd *abfd; | |
835 { | 811 { |
836 if (obj_aout_subformat (abfd) == gnu_encap_format) | 812 if (obj_aout_subformat (abfd) == gnu_encap_format) |
837 return aout_32_get_symtab_upper_bound (abfd); | 813 return aout_32_get_symtab_upper_bound (abfd); |
838 if (!MY (slurp_symbol_table) (abfd)) | 814 if (!MY (slurp_symbol_table) (abfd)) |
839 return -1; | 815 return -1; |
840 | 816 |
841 return (bfd_get_symcount (abfd) + 1) * (sizeof (aout_symbol_type *)); | 817 return (bfd_get_symcount (abfd) + 1) * (sizeof (aout_symbol_type *)); |
842 } | 818 } |
843 | 819 |
844 long | 820 long |
845 MY (canonicalize_reloc) (abfd, section, relptr, symbols) | 821 MY (canonicalize_reloc) (bfd *abfd, |
846 bfd *abfd; | 822 » » » sec_ptr section, |
847 sec_ptr section; | 823 » » » arelent **relptr, |
848 arelent **relptr; | 824 » » » asymbol **symbols) |
849 asymbol **symbols; | |
850 { | 825 { |
851 arelent *tblptr = section->relocation; | 826 arelent *tblptr = section->relocation; |
852 unsigned int count; | 827 unsigned int count; |
| 828 |
853 if (obj_aout_subformat (abfd) == gnu_encap_format) | 829 if (obj_aout_subformat (abfd) == gnu_encap_format) |
854 return aout_32_canonicalize_reloc (abfd, section, relptr, symbols); | 830 return aout_32_canonicalize_reloc (abfd, section, relptr, symbols); |
855 | 831 |
856 if (!(tblptr || MY (slurp_reloc_table) (abfd, section, symbols))) | 832 if (!(tblptr || MY (slurp_reloc_table) (abfd, section, symbols))) |
857 return -1; | 833 return -1; |
858 | 834 |
859 if (section->flags & SEC_CONSTRUCTOR) | 835 if (section->flags & SEC_CONSTRUCTOR) |
860 { | 836 { |
861 arelent_chain *chain = section->constructor_chain; | 837 arelent_chain *chain = section->constructor_chain; |
862 for (count = 0; count < section->reloc_count; count++) | 838 for (count = 0; count < section->reloc_count; count++) |
(...skipping 10 matching lines...) Expand all Loading... |
873 { | 849 { |
874 *relptr++ = tblptr++; | 850 *relptr++ = tblptr++; |
875 } | 851 } |
876 } | 852 } |
877 *relptr = 0; | 853 *relptr = 0; |
878 | 854 |
879 return section->reloc_count; | 855 return section->reloc_count; |
880 } | 856 } |
881 | 857 |
882 #include "aout-target.h" | 858 #include "aout-target.h" |
OLD | NEW |