00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106 #define TARGETNAME "a.out-hp300hpux"
00107
00108
00109
00110
00111 #define MY(OP) CONCAT2 (hp300hpux_,OP)
00112
00113 #define external_exec hp300hpux_exec_bytes
00114 #define external_nlist hp300hpux_nlist_bytes
00115
00116 #include "aout/hp300hpux.h"
00117
00118
00119 #define e_strx e_shlib
00120 #define e_other e_length
00121 #define e_desc e_almod
00122
00123 #define AR_PAD_CHAR '/'
00124 #define TARGET_IS_BIG_ENDIAN_P
00125 #define DEFAULT_ARCH bfd_arch_m68k
00126
00127 #define MY_get_section_contents aout_32_get_section_contents
00128 #define MY_slurp_armap bfd_slurp_bsd_armap_f2
00129
00130
00131
00132
00133
00134
00135
00136 #define MY_canonicalize_symtab hp300hpux_canonicalize_symtab
00137 #define MY_get_symtab_upper_bound hp300hpux_get_symtab_upper_bound
00138 #define MY_canonicalize_reloc hp300hpux_canonicalize_reloc
00139 #define MY_write_object_contents hp300hpux_write_object_contents
00140
00141 #define MY_read_minisymbols _bfd_generic_read_minisymbols
00142 #define MY_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol
00143
00144 #define MY_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
00145 #define MY_bfd_link_add_symbols _bfd_generic_link_add_symbols
00146 #define MY_final_link_callback unused
00147 #define MY_bfd_final_link _bfd_generic_final_link
00148
00149
00150
00151
00152
00153 #define MY_bfd_free_cached_info bfd_true
00154
00155 #define hp300hpux_write_syms aout_32_write_syms
00156
00157 #define MY_callback MY(callback)
00158
00159 #define MY_exec_hdr_flags 0x2
00160
00161 #define NAME_swap_exec_header_in NAME(hp300hpux_32_,swap_exec_header_in)
00162
00163 #define HP_SYMTYPE_UNDEFINED 0x00
00164 #define HP_SYMTYPE_ABSOLUTE 0x01
00165 #define HP_SYMTYPE_TEXT 0x02
00166 #define HP_SYMTYPE_DATA 0x03
00167 #define HP_SYMTYPE_BSS 0x04
00168 #define HP_SYMTYPE_COMMON 0x05
00169
00170 #define HP_SYMTYPE_TYPE 0x0F
00171 #define HP_SYMTYPE_FILENAME 0x1F
00172
00173 #define HP_SYMTYPE_ALIGN 0x10
00174 #define HP_SYMTYPE_EXTERNAL 0x20
00175 #define HP_SECONDARY_SYMBOL 0x40
00176
00177
00178 #define HP_RSEGMENT_TEXT 0x00
00179 #define HP_RSEGMENT_DATA 0x01
00180 #define HP_RSEGMENT_BSS 0x02
00181 #define HP_RSEGMENT_EXTERNAL 0x03
00182 #define HP_RSEGMENT_PCREL 0x04
00183 #define HP_RSEGMENT_RDLT 0x05
00184 #define HP_RSEGMENT_RPLT 0x06
00185 #define HP_RSEGMENT_NOOP 0x3F
00186
00187 #define HP_RLENGTH_BYTE 0x00
00188 #define HP_RLENGTH_WORD 0x01
00189 #define HP_RLENGTH_LONG 0x02
00190 #define HP_RLENGTH_ALIGN 0x03
00191
00192 #define NAME(x,y) CONCAT3 (hp300hpux,_32_,y)
00193 #define ARCH_SIZE 32
00194
00195
00196 #define BMAGIC HPUX_DOT_O_MAGIC
00197 #define QMAGIC 0314
00198
00199 #include "aoutx.h"
00200
00201 static const bfd_target * MY (callback)
00202 PARAMS ((bfd *));
00203 static bfd_boolean MY (write_object_contents)
00204 PARAMS ((bfd *));
00205 static void convert_sym_type
00206 PARAMS ((struct external_nlist *, aout_symbol_type *, bfd *));
00207
00208 bfd_boolean MY (slurp_symbol_table)
00209 PARAMS ((bfd *));
00210 void MY (swap_std_reloc_in)
00211 PARAMS ((bfd *, struct hp300hpux_reloc *, arelent *, asymbol **,
00212 bfd_size_type));
00213 bfd_boolean MY (slurp_reloc_table)
00214 PARAMS ((bfd *, sec_ptr, asymbol **));
00215 long MY (canonicalize_symtab)
00216 PARAMS ((bfd *, asymbol **));
00217 long MY (get_symtab_upper_bound)
00218 PARAMS ((bfd *));
00219 long MY (canonicalize_reloc)
00220 PARAMS ((bfd *, sec_ptr, arelent **, asymbol **));
00221
00222
00223
00224
00225
00226
00227
00228 #define SYM_EXTRA_BYTES 1024
00229
00230
00231
00232 static const bfd_target *
00233 MY (callback) (abfd)
00234 bfd *abfd;
00235 {
00236 struct internal_exec *execp = exec_hdr (abfd);
00237
00238
00239 obj_textsec (abfd)->size = N_TXTSIZE (*execp);
00240
00241
00242 obj_textsec (abfd)->vma = N_TXTADDR (*execp);
00243 obj_datasec (abfd)->vma = N_DATADDR (*execp);
00244 obj_bsssec (abfd)->vma = N_BSSADDR (*execp);
00245
00246 obj_textsec (abfd)->lma = obj_textsec (abfd)->vma;
00247 obj_datasec (abfd)->lma = obj_datasec (abfd)->vma;
00248 obj_bsssec (abfd)->lma = obj_bsssec (abfd)->vma;
00249
00250
00251 obj_textsec (abfd)->filepos = N_TXTOFF (*execp);
00252 obj_datasec (abfd)->filepos = N_DATOFF (*execp);
00253
00254
00255 obj_textsec (abfd)->rel_filepos = N_TRELOFF (*execp);
00256 obj_datasec (abfd)->rel_filepos = N_DRELOFF (*execp);
00257
00258
00259 obj_sym_filepos (abfd) = N_SYMOFF (*execp);
00260 obj_str_filepos (abfd) = N_STROFF (*execp);
00261
00262
00263 #ifdef SET_ARCH_MACH
00264 SET_ARCH_MACH (abfd, *execp);
00265 #else
00266 bfd_default_set_arch_mach (abfd, DEFAULT_ARCH, 0);
00267 #endif
00268
00269 if (obj_aout_subformat (abfd) == gnu_encap_format)
00270 {
00271
00272 obj_textsec (abfd)->rel_filepos = N_GNU_TRELOFF (*execp);
00273 obj_datasec (abfd)->rel_filepos = N_GNU_DRELOFF (*execp);
00274
00275
00276 obj_sym_filepos (abfd) = N_GNU_SYMOFF (*execp);
00277 obj_str_filepos (abfd) = (obj_sym_filepos (abfd) + execp->a_syms);
00278
00279 abfd->flags |= HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS;
00280 bfd_get_symcount (abfd) = execp->a_syms / 12;
00281 obj_symbol_entry_size (abfd) = 12;
00282 obj_reloc_entry_size (abfd) = RELOC_STD_SIZE;
00283 }
00284
00285 return abfd->xvec;
00286 }
00287
00288 extern bfd_boolean aout_32_write_syms
00289 PARAMS ((bfd * abfd));
00290
00291 static bfd_boolean
00292 MY (write_object_contents) (abfd)
00293 bfd *abfd;
00294 {
00295 struct external_exec exec_bytes;
00296 struct internal_exec *execp = exec_hdr (abfd);
00297 bfd_size_type text_size;
00298 file_ptr text_end;
00299
00300 memset (&exec_bytes, 0, sizeof (exec_bytes));
00301
00302 obj_reloc_entry_size (abfd) = RELOC_STD_SIZE;
00303
00304 if (adata (abfd).magic == undecided_magic)
00305 NAME (aout,adjust_sizes_and_vmas) (abfd, &text_size, &text_end);
00306 execp->a_syms = 0;
00307
00308 execp->a_entry = bfd_get_start_address (abfd);
00309
00310 execp->a_trsize = ((obj_textsec (abfd)->reloc_count) *
00311 obj_reloc_entry_size (abfd));
00312 execp->a_drsize = ((obj_datasec (abfd)->reloc_count) *
00313 obj_reloc_entry_size (abfd));
00314
00315 N_SET_MACHTYPE (*execp, 0xc);
00316 N_SET_FLAGS (*execp, aout_backend_info (abfd)->exec_hdr_flags);
00317
00318 NAME (aout,swap_exec_header_out) (abfd, execp, &exec_bytes);
00319
00320
00321
00322
00323 H_PUT_32 (abfd, (bfd_get_symcount (abfd) * 12), exec_bytes.e_drelocs);
00324
00325 if (bfd_seek (abfd, (file_ptr) 0, FALSE) != 0
00326 || (bfd_bwrite ((PTR) &exec_bytes, (bfd_size_type) EXEC_BYTES_SIZE, abfd)
00327 != EXEC_BYTES_SIZE))
00328 return FALSE;
00329
00330
00331
00332
00333 if (bfd_get_symcount (abfd) != 0)
00334 {
00335
00336 if (bfd_seek (abfd, (file_ptr) (N_DRELOFF (*execp) + execp->a_drsize),
00337 SEEK_SET) != 0)
00338 return FALSE;
00339 }
00340
00341 if (!MY (write_syms) (abfd))
00342 return FALSE;
00343
00344 if (bfd_get_symcount (abfd) != 0)
00345 {
00346 if (bfd_seek (abfd, (file_ptr) N_TRELOFF (*execp), SEEK_CUR) != 0)
00347 return FALSE;
00348 if (!NAME (aout,squirt_out_relocs) (abfd, obj_textsec (abfd)))
00349 return FALSE;
00350 if (bfd_seek (abfd, (file_ptr) N_DRELOFF (*execp), SEEK_CUR) != 0)
00351 return FALSE;
00352 if (!NAME (aout,squirt_out_relocs) (abfd, obj_datasec (abfd)))
00353 return FALSE;
00354 }
00355
00356 return TRUE;
00357 }
00358
00359
00360
00361
00362 static void
00363 convert_sym_type (sym_pointer, cache_ptr, abfd)
00364 struct external_nlist *sym_pointer ATTRIBUTE_UNUSED;
00365 aout_symbol_type *cache_ptr;
00366 bfd *abfd ATTRIBUTE_UNUSED;
00367 {
00368 int name_type;
00369 int new_type;
00370
00371 name_type = (cache_ptr->type);
00372 new_type = 0;
00373
00374 if ((name_type & HP_SYMTYPE_ALIGN) != 0)
00375 {
00376
00377 name_type = 0;
00378 }
00379
00380 if (name_type == HP_SYMTYPE_FILENAME)
00381 new_type = N_FN;
00382 else
00383 {
00384 switch (name_type & HP_SYMTYPE_TYPE)
00385 {
00386 case HP_SYMTYPE_UNDEFINED:
00387 new_type = N_UNDF;
00388 break;
00389
00390 case HP_SYMTYPE_ABSOLUTE:
00391 new_type = N_ABS;
00392 break;
00393
00394 case HP_SYMTYPE_TEXT:
00395 new_type = N_TEXT;
00396 break;
00397
00398 case HP_SYMTYPE_DATA:
00399 new_type = N_DATA;
00400 break;
00401
00402 case HP_SYMTYPE_BSS:
00403 new_type = N_BSS;
00404 break;
00405
00406 case HP_SYMTYPE_COMMON:
00407 new_type = N_COMM;
00408 break;
00409
00410 default:
00411 abort ();
00412 break;
00413 }
00414 if (name_type & HP_SYMTYPE_EXTERNAL)
00415 new_type |= N_EXT;
00416
00417 if (name_type & HP_SECONDARY_SYMBOL)
00418 {
00419 switch (new_type)
00420 {
00421 default:
00422 abort ();
00423 case N_UNDF | N_EXT:
00424
00425
00426
00427
00428 if (cache_ptr->symbol.value == 0)
00429 new_type = N_WEAKU;
00430 break;
00431 case N_ABS | N_EXT:
00432 new_type = N_WEAKA;
00433 break;
00434 case N_TEXT | N_EXT:
00435 new_type = N_WEAKT;
00436 break;
00437 case N_DATA | N_EXT:
00438 new_type = N_WEAKD;
00439 break;
00440 case N_BSS | N_EXT:
00441 new_type = N_WEAKB;
00442 break;
00443 }
00444 }
00445 }
00446 cache_ptr->type = new_type;
00447
00448 }
00449
00450
00451
00452
00453
00454
00455
00456
00457 void
00458 NAME (aout,swap_exec_header_in) (abfd, raw_bytes, execp)
00459 bfd *abfd;
00460 struct external_exec *raw_bytes;
00461 struct internal_exec *execp;
00462 {
00463 struct external_exec *bytes = (struct external_exec *) raw_bytes;
00464
00465
00466
00467
00468
00469 memset (execp, 0, sizeof (struct internal_exec));
00470
00471 execp->a_info = H_GET_32 (abfd, bytes->e_info);
00472 execp->a_text = GET_WORD (abfd, bytes->e_text);
00473 execp->a_data = GET_WORD (abfd, bytes->e_data);
00474 execp->a_bss = GET_WORD (abfd, bytes->e_bss);
00475 execp->a_syms = GET_WORD (abfd, bytes->e_syms);
00476 execp->a_entry = GET_WORD (abfd, bytes->e_entry);
00477 execp->a_trsize = GET_WORD (abfd, bytes->e_trsize);
00478 execp->a_drsize = GET_WORD (abfd, bytes->e_drsize);
00479
00480
00481
00482
00483
00484
00485
00486 do
00487 {
00488 long syms;
00489 struct aout_data_struct *rawptr;
00490 bfd_size_type amt;
00491
00492 if (H_GET_32 (abfd, bytes->e_passize) != 0)
00493 break;
00494 if (H_GET_32 (abfd, bytes->e_syms) != 0)
00495 break;
00496 if (H_GET_32 (abfd, bytes->e_supsize) != 0)
00497 break;
00498
00499 syms = H_GET_32 (abfd, bytes->e_drelocs);
00500 if (syms == 0)
00501 break;
00502
00503
00504 execp->a_syms = syms;
00505
00506
00507 amt = sizeof (*rawptr);
00508 rawptr = (struct aout_data_struct *) bfd_zalloc (abfd, amt);
00509
00510 if (rawptr == NULL)
00511 return;
00512 abfd->tdata.aout_data = rawptr;
00513 obj_aout_subformat (abfd) = gnu_encap_format;
00514 }
00515 while (0);
00516 }
00517
00518
00519
00520
00521
00522
00523
00524
00525
00526
00527
00528
00529
00530
00531
00532
00533
00534
00535
00536
00537
00538
00539
00540
00541 bfd_boolean
00542 MY (slurp_symbol_table) (abfd)
00543 bfd *abfd;
00544 {
00545 bfd_size_type symbol_bytes;
00546 struct external_nlist *syms;
00547 struct external_nlist *sym_pointer;
00548 struct external_nlist *sym_end;
00549 char *strings;
00550 aout_symbol_type *cached;
00551 unsigned num_syms = 0;
00552 bfd_size_type amt;
00553
00554
00555 if (obj_aout_symbols (abfd) != (aout_symbol_type *) NULL)
00556 return TRUE;
00557 symbol_bytes = exec_hdr (abfd)->a_syms;
00558
00559 amt = symbol_bytes + SYM_EXTRA_BYTES;
00560 strings = (char *) bfd_alloc (abfd, amt);
00561 if (!strings)
00562 return FALSE;
00563 syms = (struct external_nlist *) (strings + SYM_EXTRA_BYTES);
00564 if (bfd_seek (abfd, obj_sym_filepos (abfd), SEEK_SET) != 0
00565 || bfd_bread ((PTR) syms, symbol_bytes, abfd) != symbol_bytes)
00566 {
00567 bfd_release (abfd, syms);
00568 return FALSE;
00569 }
00570
00571 sym_end = (struct external_nlist *) (((char *) syms) + symbol_bytes);
00572
00573
00574 for (sym_pointer = syms; sym_pointer < sym_end; sym_pointer++, num_syms++)
00575 {
00576
00577 sym_pointer = (struct external_nlist *) (((char *) sym_pointer) +
00578 sym_pointer->e_length[0]);
00579 }
00580
00581
00582 bfd_get_symcount (abfd) = num_syms;
00583
00584 amt = num_syms;
00585 amt *= sizeof (aout_symbol_type);
00586 cached = (aout_symbol_type *) bfd_zalloc (abfd, amt);
00587 if (cached == NULL && num_syms != 0)
00588 return FALSE;
00589
00590
00591
00592
00593
00594
00595
00596 {
00597 aout_symbol_type *cache_ptr = cached;
00598 aout_symbol_type cache_save;
00599
00600 for (sym_pointer = syms, cache_ptr = cached;
00601 sym_pointer < sym_end; sym_pointer++, cache_ptr++)
00602 {
00603 unsigned int length;
00604 cache_ptr->symbol.the_bfd = abfd;
00605 cache_ptr->symbol.value = GET_SWORD (abfd, sym_pointer->e_value);
00606 cache_ptr->desc = bfd_get_16 (abfd, sym_pointer->e_almod);
00607 cache_ptr->type = bfd_get_8 (abfd, sym_pointer->e_type);
00608 cache_ptr->symbol.udata.p = NULL;
00609 length = bfd_get_8 (abfd, sym_pointer->e_length);
00610 cache_ptr->other = length;
00611
00612 cache_save = *cache_ptr;
00613 convert_sym_type (sym_pointer, cache_ptr, abfd);
00614 if (!translate_from_native_sym_flags (abfd, cache_ptr))
00615 return FALSE;
00616
00617
00618
00619
00620
00621 if (length)
00622 {
00623
00624
00625
00626
00627
00628 cache_ptr->symbol.name = strings;
00629 memcpy (strings, sym_pointer + 1, length);
00630 strings[length] = '\0';
00631 strings += length + 1;
00632 }
00633 else
00634 cache_ptr->symbol.name = (char *) NULL;
00635
00636
00637 sym_pointer = (struct external_nlist *) (((char *) sym_pointer) +
00638 length);
00639 }
00640 }
00641
00642 obj_aout_symbols (abfd) = cached;
00643
00644 return TRUE;
00645 }
00646
00647 void
00648 MY (swap_std_reloc_in) (abfd, bytes, cache_ptr, symbols, symcount)
00649 bfd *abfd;
00650 struct hp300hpux_reloc *bytes;
00651 arelent *cache_ptr;
00652 asymbol **symbols;
00653 bfd_size_type symcount ATTRIBUTE_UNUSED;
00654 {
00655 int r_index;
00656 int r_extern = 0;
00657 unsigned int r_length;
00658 int r_pcrel = 0;
00659 struct aoutdata *su = &(abfd->tdata.aout_data->a);
00660
00661 cache_ptr->address = H_GET_32 (abfd, bytes->r_address);
00662 r_index = H_GET_16 (abfd, bytes->r_index);
00663
00664 switch (bytes->r_type[0])
00665 {
00666 case HP_RSEGMENT_TEXT:
00667 r_index = N_TEXT;
00668 break;
00669 case HP_RSEGMENT_DATA:
00670 r_index = N_DATA;
00671 break;
00672 case HP_RSEGMENT_BSS:
00673 r_index = N_BSS;
00674 break;
00675 case HP_RSEGMENT_EXTERNAL:
00676 r_extern = 1;
00677 break;
00678 case HP_RSEGMENT_PCREL:
00679 r_extern = 1;
00680 r_pcrel = 1;
00681 break;
00682 case HP_RSEGMENT_RDLT:
00683 break;
00684 case HP_RSEGMENT_RPLT:
00685 break;
00686 case HP_RSEGMENT_NOOP:
00687 break;
00688 default:
00689 abort ();
00690 break;
00691 }
00692
00693 switch (bytes->r_length[0])
00694 {
00695 case HP_RLENGTH_BYTE:
00696 r_length = 0;
00697 break;
00698 case HP_RLENGTH_WORD:
00699 r_length = 1;
00700 break;
00701 case HP_RLENGTH_LONG:
00702 r_length = 2;
00703 break;
00704 default:
00705 abort ();
00706 break;
00707 }
00708
00709 cache_ptr->howto = howto_table_std + r_length + 4 * r_pcrel;
00710
00711
00712
00713 if (r_pcrel && r_extern)
00714 {
00715
00716
00717
00718 MOVE_ADDRESS (-cache_ptr->address);
00719 }
00720 else
00721 {
00722 MOVE_ADDRESS (0);
00723 }
00724 }
00725
00726 bfd_boolean
00727 MY (slurp_reloc_table) (abfd, asect, symbols)
00728 bfd *abfd;
00729 sec_ptr asect;
00730 asymbol **symbols;
00731 {
00732 bfd_size_type count;
00733 bfd_size_type reloc_size;
00734 PTR relocs;
00735 arelent *reloc_cache;
00736 size_t each_size;
00737 struct hp300hpux_reloc *rptr;
00738 unsigned int counter;
00739 arelent *cache_ptr;
00740
00741 if (asect->relocation)
00742 return TRUE;
00743
00744 if (asect->flags & SEC_CONSTRUCTOR)
00745 return TRUE;
00746
00747 if (asect == obj_datasec (abfd))
00748 {
00749 reloc_size = exec_hdr (abfd)->a_drsize;
00750 goto doit;
00751 }
00752
00753 if (asect == obj_textsec (abfd))
00754 {
00755 reloc_size = exec_hdr (abfd)->a_trsize;
00756 goto doit;
00757 }
00758
00759 bfd_set_error (bfd_error_invalid_operation);
00760 return FALSE;
00761
00762 doit:
00763 if (bfd_seek (abfd, asect->rel_filepos, SEEK_SET) != 0)
00764 return FALSE;
00765 each_size = obj_reloc_entry_size (abfd);
00766
00767 count = reloc_size / each_size;
00768
00769 reloc_cache = (arelent *) bfd_zalloc (abfd, count * sizeof (arelent));
00770 if (!reloc_cache && count != 0)
00771 return FALSE;
00772
00773 relocs = (PTR) bfd_alloc (abfd, reloc_size);
00774 if (!relocs && reloc_size != 0)
00775 {
00776 bfd_release (abfd, reloc_cache);
00777 return FALSE;
00778 }
00779
00780 if (bfd_bread (relocs, reloc_size, abfd) != reloc_size)
00781 {
00782 bfd_release (abfd, relocs);
00783 bfd_release (abfd, reloc_cache);
00784 return FALSE;
00785 }
00786
00787 rptr = (struct hp300hpux_reloc *) relocs;
00788 counter = 0;
00789 cache_ptr = reloc_cache;
00790
00791 for (; counter < count; counter++, rptr++, cache_ptr++)
00792 {
00793 MY (swap_std_reloc_in) (abfd, rptr, cache_ptr, symbols,
00794 (bfd_size_type) bfd_get_symcount (abfd));
00795 }
00796
00797 bfd_release (abfd, relocs);
00798 asect->relocation = reloc_cache;
00799 asect->reloc_count = count;
00800 return TRUE;
00801 }
00802
00803
00804
00805
00806
00807
00808
00809 long aout_32_canonicalize_symtab
00810 PARAMS ((bfd * abfd, asymbol ** location));
00811 long aout_32_get_symtab_upper_bound
00812 PARAMS ((bfd * abfd));
00813 long aout_32_canonicalize_reloc
00814 PARAMS ((bfd * abfd, sec_ptr section, arelent ** relptr,
00815 asymbol ** symbols));
00816
00817 long
00818 MY (canonicalize_symtab) (abfd, location)
00819 bfd *abfd;
00820 asymbol **location;
00821 {
00822 unsigned int counter = 0;
00823 aout_symbol_type *symbase;
00824
00825 if (obj_aout_subformat (abfd) == gnu_encap_format)
00826 return aout_32_canonicalize_symtab (abfd, location);
00827
00828 if (!MY (slurp_symbol_table) (abfd))
00829 return -1;
00830
00831 for (symbase = obj_aout_symbols (abfd); counter++ < bfd_get_symcount (abfd);)
00832 *(location++) = (asymbol *) (symbase++);
00833 *location++ = 0;
00834 return bfd_get_symcount (abfd);
00835 }
00836
00837 long
00838 MY (get_symtab_upper_bound) (abfd)
00839 bfd *abfd;
00840 {
00841 if (obj_aout_subformat (abfd) == gnu_encap_format)
00842 return aout_32_get_symtab_upper_bound (abfd);
00843 if (!MY (slurp_symbol_table) (abfd))
00844 return -1;
00845
00846 return (bfd_get_symcount (abfd) + 1) * (sizeof (aout_symbol_type *));
00847 }
00848
00849 long
00850 MY (canonicalize_reloc) (abfd, section, relptr, symbols)
00851 bfd *abfd;
00852 sec_ptr section;
00853 arelent **relptr;
00854 asymbol **symbols;
00855 {
00856 arelent *tblptr = section->relocation;
00857 unsigned int count;
00858 if (obj_aout_subformat (abfd) == gnu_encap_format)
00859 return aout_32_canonicalize_reloc (abfd, section, relptr, symbols);
00860
00861 if (!(tblptr || MY (slurp_reloc_table) (abfd, section, symbols)))
00862 return -1;
00863
00864 if (section->flags & SEC_CONSTRUCTOR)
00865 {
00866 arelent_chain *chain = section->constructor_chain;
00867 for (count = 0; count < section->reloc_count; count++)
00868 {
00869 *relptr++ = &chain->relent;
00870 chain = chain->next;
00871 }
00872 }
00873 else
00874 {
00875 tblptr = section->relocation;
00876
00877 for (count = 0; count++ < section->reloc_count;)
00878 {
00879 *relptr++ = tblptr++;
00880 }
00881 }
00882 *relptr = 0;
00883
00884 return section->reloc_count;
00885 }
00886
00887 #include "aout-target.h"