Lines Matching refs:abfd

279 NAME(aout,reloc_type_lookup) (abfd,code)
280 bfd *abfd;
285 int ext = obj_reloc_entry_size (abfd) == RELOC_EXT_SIZE;
288 switch (bfd_get_arch_info (abfd)->bits_per_address)
352 (bfd *abfd,
364 NAME(aout,swap_exec_header_in) (abfd, raw_bytes, execp)
365 bfd *abfd;
377 execp->a_info = H_GET_32 (abfd, bytes->e_info);
378 execp->a_text = GET_WORD (abfd, bytes->e_text);
379 execp->a_data = GET_WORD (abfd, bytes->e_data);
380 execp->a_bss = GET_WORD (abfd, bytes->e_bss);
381 execp->a_syms = GET_WORD (abfd, bytes->e_syms);
382 execp->a_entry = GET_WORD (abfd, bytes->e_entry);
383 execp->a_trsize = GET_WORD (abfd, bytes->e_trsize);
384 execp->a_drsize = GET_WORD (abfd, bytes->e_drsize);
395 (bfd *abfd,
404 NAME(aout,swap_exec_header_out) (abfd, execp, raw_bytes)
405 bfd *abfd;
412 H_PUT_32 (abfd, execp->a_info , bytes->e_info);
413 PUT_WORD (abfd, execp->a_text , bytes->e_text);
414 PUT_WORD (abfd, execp->a_data , bytes->e_data);
415 PUT_WORD (abfd, execp->a_bss , bytes->e_bss);
416 PUT_WORD (abfd, execp->a_syms , bytes->e_syms);
417 PUT_WORD (abfd, execp->a_entry , bytes->e_entry);
418 PUT_WORD (abfd, execp->a_trsize, bytes->e_trsize);
419 PUT_WORD (abfd, execp->a_drsize, bytes->e_drsize);
425 NAME(aout,make_sections) (abfd)
426 bfd *abfd;
428 if (obj_textsec (abfd) == (asection *) NULL
429 && bfd_make_section (abfd, ".text") == (asection *) NULL)
431 if (obj_datasec (abfd) == (asection *) NULL
432 && bfd_make_section (abfd, ".data") == (asection *) NULL)
434 if (obj_bsssec (abfd) == (asection *) NULL
435 && bfd_make_section (abfd, ".bss") == (asection *) NULL)
446 (bfd *abfd,
450 Some a.out variant thinks that the file open in @var{abfd}
458 NAME(aout,some_aout_object_p) (abfd, execp, callback_to_real_object_p)
459 bfd *abfd;
467 rawptr = (struct aout_data_struct *) bfd_zalloc (abfd, amt);
471 oldrawptr = abfd->tdata.aout_data;
472 abfd->tdata.aout_data = rawptr;
479 *abfd->tdata.aout_data = *oldrawptr;
481 abfd->tdata.aout_data->a.hdr = &rawptr->e;
483 *(abfd->tdata.aout_data->a.hdr) = *execp;
484 execp = abfd->tdata.aout_data->a.hdr;
487 abfd->flags = BFD_NO_FLAGS;
489 abfd->flags |= HAS_RELOC;
492 abfd->flags |= HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS;
494 abfd->flags |= DYNAMIC;
498 abfd->flags |= D_PAGED | WP_TEXT;
499 adata (abfd).magic = z_magic;
503 abfd->flags |= D_PAGED | WP_TEXT;
504 adata (abfd).magic = z_magic;
505 adata (abfd).subformat = q_magic_format;
509 abfd->flags |= WP_TEXT;
510 adata (abfd).magic = n_magic;
514 adata (abfd).magic = o_magic;
522 bfd_get_start_address (abfd) = execp->a_entry;
524 obj_aout_symbols (abfd) = (aout_symbol_type *)NULL;
525 bfd_get_symcount (abfd) = execp->a_syms / sizeof (struct external_nlist);
528 obj_reloc_entry_size (abfd) = RELOC_STD_SIZE;
531 obj_symbol_entry_size (abfd) = EXTERNAL_NLIST_SIZE;
534 bfd_init_window (&obj_aout_sym_window (abfd));
535 bfd_init_window (&obj_aout_string_window (abfd));
537 obj_aout_external_syms (abfd) = NULL;
538 obj_aout_external_strings (abfd) = NULL;
539 obj_aout_sym_hashes (abfd) = NULL;
541 if (! NAME(aout,make_sections) (abfd))
544 obj_datasec (abfd)->size = execp->a_data;
545 obj_bsssec (abfd)->size = execp->a_bss;
547 obj_textsec (abfd)->flags =
551 obj_datasec (abfd)->flags =
555 obj_bsssec (abfd)->flags = SEC_ALLOC;
568 struct exec *execp = exec_hdr (abfd);
570 obj_textsec (abfd)->size = N_TXTSIZE (*execp);
574 obj_textsec (abfd)->vma = N_TXTADDR (*execp);
575 obj_datasec (abfd)->vma = N_DATADDR (*execp);
576 obj_bsssec (abfd)->vma = N_BSSADDR (*execp);
579 obj_textsec (abfd)->filepos = N_TXTOFF (*execp);
580 obj_datasec (abfd)->filepos = N_DATOFF (*execp);
583 obj_textsec (abfd)->rel_filepos = N_TRELOFF (*execp);
584 obj_datasec (abfd)->rel_filepos = N_DRELOFF (*execp);
587 obj_str_filepos (abfd) = N_STROFF (*execp);
588 obj_sym_filepos (abfd) = N_SYMOFF (*execp);
591 switch (N_MACHTYPE (*exec_hdr (abfd)))
594 abfd->obj_arch = bfd_arch_obscure;
598 adata (abfd)->page_size = TARGET_PAGE_SIZE;
599 adata (abfd)->segment_size = SEGMENT_SIZE;
600 adata (abfd)->exec_bytes_size = EXEC_BYTES_SIZE;
602 return abfd->xvec;
614 result = (*callback_to_real_object_p) (abfd);
632 || (execp->a_entry >= obj_textsec (abfd)->vma
633 && execp->a_entry < (obj_textsec (abfd)->vma
634 + obj_textsec (abfd)->size)))
635 abfd->flags |= EXEC_P;
645 the default text start (obj_textsec(abfd)->vma) and
646 (obj_textsec(abfd)->vma) + text size. This is not just a mach
648 if (abfd->iostream != NULL
649 && (abfd->flags & BFD_IN_MEMORY) == 0
650 && (fstat (fileno ((FILE *) (abfd->iostream)), &stat_buf) == 0)
652 abfd->flags |= EXEC_P;
659 abfd->sections = obj_textsec (abfd);
660 obj_textsec (abfd)->next = obj_datasec (abfd);
661 obj_datasec (abfd)->next = obj_bsssec (abfd);
667 bfd_release (abfd, rawptr);
668 abfd->tdata.aout_data = oldrawptr;
677 bfd_boolean aout_@var{size}_mkobject, (bfd *abfd);
680 Initialize BFD @var{abfd} for use with a.out files.
684 NAME(aout,mkobject) (abfd)
685 bfd *abfd;
692 rawptr = (struct aout_data_struct *) bfd_zalloc (abfd, amt);
696 abfd->tdata.aout_data = rawptr;
697 exec_hdr (abfd) = &(rawptr->e);
699 obj_textsec (abfd) = (asection *) NULL;
700 obj_datasec (abfd) = (asection *) NULL;
701 obj_bsssec (abfd) = (asection *) NULL;
858 Set the architecture and the machine of the BFD @var{abfd} to the
859 values @var{arch} and @var{machine}. Verify that @var{abfd}'s format
864 NAME(aout,set_arch_mach) (abfd, arch, machine)
865 bfd *abfd;
869 if (! bfd_default_set_arch_mach (abfd, arch, machine))
887 obj_reloc_entry_size (abfd) = RELOC_EXT_SIZE;
890 obj_reloc_entry_size (abfd) = RELOC_STD_SIZE;
894 return (*aout_backend_info (abfd)->set_sizes) (abfd);
898 adjust_o_magic (abfd, execp)
899 bfd *abfd;
902 file_ptr pos = adata (abfd).exec_bytes_size;
907 obj_textsec (abfd)->filepos = pos;
908 if (!obj_textsec (abfd)->user_set_vma)
909 obj_textsec (abfd)->vma = vma;
911 vma = obj_textsec (abfd)->vma;
913 pos += obj_textsec (abfd)->size;
914 vma += obj_textsec (abfd)->size;
917 if (!obj_datasec (abfd)->user_set_vma)
920 pad = align_power (vma, obj_datasec (abfd)->alignment_power) - vma;
922 obj_textsec (abfd)->size += pad;
925 obj_datasec (abfd)->vma = vma;
928 vma = obj_datasec (abfd)->vma;
929 obj_datasec (abfd)->filepos = pos;
930 pos += obj_datasec (abfd)->size;
931 vma += obj_datasec (abfd)->size;
934 if (!obj_bsssec (abfd)->user_set_vma)
937 pad = align_power (vma, obj_bsssec (abfd)->alignment_power) - vma;
939 obj_datasec (abfd)->size += pad;
942 obj_bsssec (abfd)->vma = vma;
949 pad = obj_bsssec (abfd)->vma - vma;
952 obj_datasec (abfd)->size += pad;
956 obj_bsssec (abfd)->filepos = pos;
959 execp->a_text = obj_textsec (abfd)->size;
960 execp->a_data = obj_datasec (abfd)->size;
961 execp->a_bss = obj_bsssec (abfd)->size;
966 adjust_z_magic (abfd, execp)
967 bfd *abfd;
975 abdp = aout_backend_info (abfd);
980 || obj_aout_subformat (abfd) == q_magic_format));
981 obj_textsec (abfd)->filepos = (ztih
982 ? adata (abfd).exec_bytes_size
983 : adata (abfd).zmagic_disk_block_size);
984 if (! obj_textsec (abfd)->user_set_vma)
987 obj_textsec (abfd)->vma = ((abfd->flags & HAS_RELOC)
991 + adata (abfd).exec_bytes_size)
1001 text_pad = ((obj_textsec (abfd)->filepos - obj_textsec (abfd)->vma)
1002 & (adata (abfd).page_size - 1));
1004 text_pad = ((- obj_textsec (abfd)->vma)
1005 & (adata (abfd).page_size - 1));
1011 text_end = obj_textsec (abfd)->filepos + obj_textsec (abfd)->size;
1012 text_pad += BFD_ALIGN (text_end, adata (abfd).page_size) - text_end;
1019 text_end = obj_textsec (abfd)->size;
1020 text_pad += BFD_ALIGN (text_end, adata (abfd).page_size) - text_end;
1021 text_end += obj_textsec (abfd)->filepos;
1023 obj_textsec (abfd)->size += text_pad;
1027 if (!obj_datasec (abfd)->user_set_vma)
1030 vma = obj_textsec (abfd)->vma + obj_textsec (abfd)->size;
1031 obj_datasec (abfd)->vma = BFD_ALIGN (vma, adata (abfd).segment_size);
1035 asection * text = obj_textsec (abfd);
1036 asection * data = obj_datasec (abfd);
1044 obj_datasec (abfd)->filepos = (obj_textsec (abfd)->filepos
1045 + obj_textsec (abfd)->size);
1048 execp->a_text = obj_textsec (abfd)->size;
1050 execp->a_text += adata (abfd).exec_bytes_size;
1051 if (obj_aout_subformat (abfd) == q_magic_format)
1057 obj_datasec (abfd)->size
1058 = align_power (obj_datasec (abfd)->size,
1059 obj_bsssec (abfd)->alignment_power);
1060 execp->a_data = BFD_ALIGN (obj_datasec (abfd)->size,
1061 adata (abfd).page_size);
1062 data_pad = execp->a_data - obj_datasec (abfd)->size;
1065 if (!obj_bsssec (abfd)->user_set_vma)
1066 obj_bsssec (abfd)->vma = (obj_datasec (abfd)->vma
1067 + obj_datasec (abfd)->size);
1075 if (align_power (obj_bsssec (abfd)->vma, obj_bsssec (abfd)->alignment_power)
1076 == obj_datasec (abfd)->vma + obj_datasec (abfd)->size)
1077 execp->a_bss = (data_pad > obj_bsssec (abfd)->size
1078 ? 0 : obj_bsssec (abfd)->size - data_pad);
1080 execp->a_bss = obj_bsssec (abfd)->size;
1084 adjust_n_magic (abfd, execp)
1085 bfd *abfd;
1088 file_ptr pos = adata (abfd).exec_bytes_size;
1093 obj_textsec (abfd)->filepos = pos;
1094 if (!obj_textsec (abfd)->user_set_vma)
1095 obj_textsec (abfd)->vma = vma;
1097 vma = obj_textsec (abfd)->vma;
1098 pos += obj_textsec (abfd)->size;
1099 vma += obj_textsec (abfd)->size;
1102 obj_datasec (abfd)->filepos = pos;
1103 if (!obj_datasec (abfd)->user_set_vma)
1104 obj_datasec (abfd)->vma = BFD_ALIGN (vma, adata (abfd).segment_size);
1105 vma = obj_datasec (abfd)->vma;
1108 vma += obj_datasec (abfd)->size;
1109 pad = align_power (vma, obj_bsssec (abfd)->alignment_power) - vma;
1110 obj_datasec (abfd)->size += pad;
1111 pos += obj_datasec (abfd)->size;
1114 if (!obj_bsssec (abfd)->user_set_vma)
1115 obj_bsssec (abfd)->vma = vma;
1117 vma = obj_bsssec (abfd)->vma;
1120 execp->a_text = obj_textsec (abfd)->size;
1121 execp->a_data = obj_datasec (abfd)->size;
1122 execp->a_bss = obj_bsssec (abfd)->size;
1127 NAME(aout,adjust_sizes_and_vmas) (abfd, text_size, text_end)
1128 bfd *abfd;
1132 struct internal_exec *execp = exec_hdr (abfd);
1134 if (! NAME(aout,make_sections) (abfd))
1137 if (adata (abfd).magic != undecided_magic)
1140 obj_textsec (abfd)->size =
1141 align_power (obj_textsec (abfd)->size,
1142 obj_textsec (abfd)->alignment_power);
1144 *text_size = obj_textsec (abfd)->size;
1161 if (abfd->flags & D_PAGED)
1163 adata (abfd).magic = z_magic;
1164 else if (abfd->flags & WP_TEXT)
1165 adata (abfd).magic = n_magic;
1167 adata (abfd).magic = o_magic;
1173 switch (adata (abfd).magic)
1182 obj_textsec (abfd)->vma, obj_textsec (abfd)->size,
1183 obj_textsec (abfd)->alignment_power,
1184 obj_datasec (abfd)->vma, obj_datasec (abfd)->size,
1185 obj_datasec (abfd)->alignment_power,
1186 obj_bsssec (abfd)->vma, obj_bsssec (abfd)->size,
1187 obj_bsssec (abfd)->alignment_power);
1191 switch (adata (abfd).magic)
1194 adjust_o_magic (abfd, execp);
1197 adjust_z_magic (abfd, execp);
1200 adjust_n_magic (abfd, execp);
1208 obj_textsec (abfd)->vma, obj_textsec (abfd)->size,
1209 obj_textsec (abfd)->filepos,
1210 obj_datasec (abfd)->vma, obj_datasec (abfd)->size,
1211 obj_datasec (abfd)->filepos,
1212 obj_bsssec (abfd)->vma, obj_bsssec (abfd)->size);
1224 (bfd *abfd,
1232 NAME(aout,new_section_hook) (abfd, newsect)
1233 bfd *abfd;
1237 newsect->alignment_power = bfd_get_arch_info (abfd)->section_align_power;
1239 if (bfd_get_format (abfd) == bfd_object)
1241 if (obj_textsec (abfd) == NULL && !strcmp (newsect->name, ".text"))
1243 obj_textsec (abfd)= newsect;
1248 if (obj_datasec (abfd) == NULL && !strcmp (newsect->name, ".data"))
1250 obj_datasec (abfd) = newsect;
1255 if (obj_bsssec (abfd) == NULL && !strcmp (newsect->name, ".bss"))
1257 obj_bsssec (abfd) = newsect;
1268 NAME(aout,set_section_contents) (abfd, section, location, offset, count)
1269 bfd *abfd;
1278 if (! abfd->output_has_begun)
1280 if (! NAME(aout,adjust_sizes_and_vmas) (abfd, &text_size, &text_end))
1284 if (section == obj_bsssec (abfd))
1290 if (section != obj_textsec (abfd)
1291 && section != obj_datasec (abfd))
1293 if (aout_section_merge_with_text_p (abfd, section))
1294 section->filepos = obj_textsec (abfd)->filepos +
1295 (section->vma - obj_textsec (abfd)->vma);
1300 bfd_get_filename (abfd), bfd_get_section_name (abfd, section));
1308 if (bfd_seek (abfd, section->filepos + offset, SEEK_SET) != 0
1309 || bfd_bwrite (location, count, abfd) != count)
1320 aout_get_external_symbols (abfd)
1321 bfd *abfd;
1323 if (obj_aout_external_syms (abfd) == (struct external_nlist *) NULL)
1329 count = exec_hdr (abfd)->a_syms / EXTERNAL_NLIST_SIZE;
1332 if (! bfd_get_file_window (abfd, obj_sym_filepos (abfd),
1333 exec_hdr (abfd)->a_syms,
1334 &obj_aout_sym_window (abfd), TRUE))
1336 syms = (struct external_nlist *) obj_aout_sym_window (abfd).data;
1346 amt = exec_hdr (abfd)->a_syms;
1347 if (bfd_seek (abfd, obj_sym_filepos (abfd), SEEK_SET) != 0
1348 || bfd_bread (syms, amt, abfd) != amt)
1355 obj_aout_external_syms (abfd) = syms;
1356 obj_aout_external_sym_count (abfd) = count;
1359 if (obj_aout_external_strings (abfd) == NULL
1360 && exec_hdr (abfd)->a_syms != 0)
1368 if (bfd_seek (abfd, obj_str_filepos (abfd), SEEK_SET) != 0
1369 || bfd_bread ((PTR) string_chars, amt, abfd) != amt)
1371 stringsize = GET_WORD (abfd, string_chars);
1374 if (! bfd_get_file_window (abfd, obj_str_filepos (abfd), stringsize,
1375 &obj_aout_string_window (abfd), TRUE))
1377 strings = (char *) obj_aout_string_window (abfd).data;
1386 if (bfd_bread (strings + BYTES_IN_WORD, amt, abfd) != amt)
1398 obj_aout_external_strings (abfd) = strings;
1399 obj_aout_external_string_size (abfd) = stringsize;
1411 translate_from_native_sym_flags (abfd, cache_ptr)
1412 bfd *abfd;
1430 sec = obj_textsec (abfd);
1433 sec = obj_datasec (abfd);
1436 sec = obj_bsssec (abfd);
1480 cache_ptr->symbol.section = obj_textsec (abfd);
1493 cache_ptr->symbol.section = obj_datasec (abfd);
1499 cache_ptr->symbol.section = obj_bsssec (abfd);
1528 section = bfd_get_section_by_name (abfd, cache_ptr->symbol.name);
1534 copy = bfd_alloc (abfd, amt);
1539 section = bfd_make_section (abfd, copy);
1545 reloc = (arelent_chain *) bfd_alloc (abfd, amt);
1557 into_section = obj_textsec (abfd);
1561 into_section = obj_datasec (abfd);
1565 into_section = obj_bsssec (abfd);
1590 reloc->relent.howto = CTOR_TABLE_RELOC_HOWTO (abfd);
1600 cache_ptr->symbol.section = obj_textsec (abfd);
1603 cache_ptr->symbol.section = obj_datasec (abfd);
1606 cache_ptr->symbol.section = obj_bsssec (abfd);
1642 cache_ptr->symbol.section = obj_textsec (abfd);
1648 cache_ptr->symbol.section = obj_datasec (abfd);
1654 cache_ptr->symbol.section = obj_bsssec (abfd);
1666 translate_to_native_sym_flags (abfd, cache_ptr, sym_pointer)
1667 bfd *abfd;
1688 bfd_get_filename (abfd),
1702 else if (sec == obj_textsec (abfd))
1704 else if (sec == obj_datasec (abfd))
1706 else if (sec == obj_bsssec (abfd))
1716 if (aout_section_merge_with_text_p (abfd, sec))
1722 bfd_get_filename (abfd), bfd_get_section_name (abfd, sec));
1771 PUT_WORD (abfd, value, sym_pointer->e_value);
1780 NAME(aout,make_empty_symbol) (abfd)
1781 bfd *abfd;
1784 aout_symbol_type *new = (aout_symbol_type *) bfd_zalloc (abfd, amt);
1787 new->symbol.the_bfd = abfd;
1795 NAME(aout,translate_symbol_table) (abfd, in, ext, count, str, strsize, dynamic)
1796 bfd *abfd;
1811 x = GET_WORD (abfd, ext->e_strx);
1812 in->symbol.the_bfd = abfd;
1826 in->symbol.value = GET_SWORD (abfd, ext->e_value);
1827 in->desc = H_GET_16 (abfd, ext->e_desc);
1828 in->other = H_GET_8 (abfd, ext->e_other);
1829 in->type = H_GET_8 (abfd, ext->e_type);
1832 if (! translate_from_native_sym_flags (abfd, in))
1847 NAME(aout,slurp_symbol_table) (abfd)
1848 bfd *abfd;
1855 if (obj_aout_symbols (abfd) != (aout_symbol_type *) NULL)
1858 old_external_syms = obj_aout_external_syms (abfd);
1860 if (! aout_get_external_symbols (abfd))
1863 cached_size = obj_aout_external_sym_count (abfd);
1871 (abfd, cached,
1872 obj_aout_external_syms (abfd),
1873 obj_aout_external_sym_count (abfd),
1874 obj_aout_external_strings (abfd),
1875 obj_aout_external_string_size (abfd),
1882 bfd_get_symcount (abfd) = obj_aout_external_sym_count (abfd);
1884 obj_aout_symbols (abfd) = cached;
1891 && obj_aout_external_syms (abfd) != (struct external_nlist *) NULL)
1894 bfd_free_window (&obj_aout_sym_window (abfd));
1896 free (obj_aout_external_syms (abfd));
1898 obj_aout_external_syms (abfd) = NULL;
1923 add_to_stringtab (abfd, tab, str, copy)
1924 bfd *abfd;
1939 if ((abfd->flags & BFD_TRADITIONAL_FORMAT) != 0)
1958 emit_stringtab (abfd, tab)
1959 register bfd *abfd;
1966 PUT_WORD (abfd, _bfd_stringtab_size (tab) + BYTES_IN_WORD, buffer);
1967 if (bfd_bwrite ((PTR) buffer, amt, abfd) != amt)
1970 return _bfd_stringtab_emit (abfd, tab);
1975 NAME(aout,write_syms) (abfd)
1976 bfd *abfd;
1979 asymbol **generic = bfd_get_outsymbols (abfd);
1986 for (count = 0; count < bfd_get_symcount (abfd); count++)
1993 indx = add_to_stringtab (abfd, strtab, g->name, FALSE);
1996 PUT_WORD (abfd, indx, (bfd_byte *) nsp.e_strx);
1998 if (bfd_asymbol_flavour (g) == abfd->xvec->flavour)
2000 H_PUT_16 (abfd, aout_symbol (g)->desc, nsp.e_desc);
2001 H_PUT_8 (abfd, aout_symbol (g)->other, nsp.e_other);
2002 H_PUT_8 (abfd, aout_symbol (g)->type, nsp.e_type);
2006 H_PUT_16 (abfd, 0, nsp.e_desc);
2007 H_PUT_8 (abfd, 0, nsp.e_other);
2008 H_PUT_8 (abfd, 0, nsp.e_type);
2011 if (! translate_to_native_sym_flags (abfd, g, &nsp))
2015 if (bfd_bwrite ((PTR) &nsp, amt, abfd) != amt)
2023 if (! emit_stringtab (abfd, strtab))
2037 NAME(aout,canonicalize_symtab) (abfd, location)
2038 bfd *abfd;
2044 if (!NAME(aout,slurp_symbol_table) (abfd))
2047 for (symbase = obj_aout_symbols (abfd);
2048 counter++ < bfd_get_symcount (abfd);
2052 return bfd_get_symcount (abfd);
2063 NAME(aout,swap_std_reloc_out) (abfd, g, natptr)
2064 bfd *abfd;
2076 PUT_WORD (abfd, g->address, natptr->r_address);
2125 if (bfd_header_big_endian (abfd))
2158 NAME(aout,swap_ext_reloc_out) (abfd, g, natptr)
2159 bfd *abfd;
2170 PUT_WORD (abfd, g->address, natptr->r_address);
2206 if (bfd_header_big_endian (abfd))
2223 PUT_WORD (abfd, r_addend, natptr->r_addend);
2249 cache_ptr->sym_ptr_ptr = obj_textsec (abfd)->symbol_ptr_ptr; \
2254 cache_ptr->sym_ptr_ptr = obj_datasec (abfd)->symbol_ptr_ptr; \
2259 cache_ptr->sym_ptr_ptr = obj_bsssec (abfd)->symbol_ptr_ptr; \
2272 NAME(aout,swap_ext_reloc_in) (abfd, bytes, cache_ptr, symbols, symcount)
2273 bfd *abfd;
2282 struct aoutdata *su = &(abfd->tdata.aout_data->a);
2284 cache_ptr->address = (GET_SWORD (abfd, bytes->r_address));
2287 if (bfd_header_big_endian (abfd))
2324 MOVE_ADDRESS (GET_SWORD (abfd, bytes->r_addend));
2328 NAME(aout,swap_std_reloc_in) (abfd, bytes, cache_ptr, symbols, symcount)
2329 bfd *abfd;
2340 struct aoutdata *su = &(abfd->tdata.aout_data->a);
2343 cache_ptr->address = H_GET_32 (abfd, bytes->r_address);
2346 if (bfd_header_big_endian (abfd))
2399 NAME(aout,slurp_reloc_table) (abfd, asect, symbols)
2400 bfd *abfd;
2419 if (asect == obj_datasec (abfd))
2420 reloc_size = exec_hdr (abfd)->a_drsize;
2421 else if (asect == obj_textsec (abfd))
2422 reloc_size = exec_hdr (abfd)->a_trsize;
2423 else if (asect == obj_bsssec (abfd))
2431 if (bfd_seek (abfd, asect->rel_filepos, SEEK_SET) != 0)
2434 each_size = obj_reloc_entry_size (abfd);
2450 if (bfd_bread (relocs, reloc_size, abfd) != reloc_size)
2463 MY_swap_ext_reloc_in (abfd, rptr, cache_ptr, symbols,
2464 (bfd_size_type) bfd_get_symcount (abfd));
2471 MY_swap_std_reloc_in (abfd, rptr, cache_ptr, symbols,
2472 (bfd_size_type) bfd_get_symcount (abfd));
2486 NAME(aout,squirt_out_relocs) (abfd, section)
2487 bfd *abfd;
2500 each_size = obj_reloc_entry_size (abfd);
2502 native = (unsigned char *) bfd_zalloc (abfd, natsize);
2513 MY_swap_ext_reloc_out (abfd, *generic,
2521 MY_swap_std_reloc_out (abfd, *generic,
2525 if (bfd_bwrite ((PTR) native, natsize, abfd) != natsize)
2527 bfd_release (abfd, native);
2530 bfd_release (abfd, native);
2538 NAME(aout,canonicalize_reloc) (abfd, section, relptr, symbols)
2539 bfd *abfd;
2547 if (section == obj_bsssec (abfd))
2553 if (!(tblptr || NAME(aout,slurp_reloc_table) (abfd, section, symbols)))
2580 NAME(aout,get_reloc_upper_bound) (abfd, asect)
2581 bfd *abfd;
2584 if (bfd_get_format (abfd) != bfd_object)
2593 if (asect == obj_datasec (abfd))
2595 * ((exec_hdr (abfd)->a_drsize / obj_reloc_entry_size (abfd))
2598 if (asect == obj_textsec (abfd))
2600 * ((exec_hdr (abfd)->a_trsize / obj_reloc_entry_size (abfd))
2603 if (asect == obj_bsssec (abfd))
2606 if (asect == obj_bsssec (abfd))
2615 NAME(aout,get_symtab_upper_bound) (abfd)
2616 bfd *abfd;
2618 if (!NAME(aout,slurp_symbol_table) (abfd))
2621 return (bfd_get_symcount (abfd)+1) * (sizeof (aout_symbol_type *));
2660 NAME(aout,print_symbol) (abfd, afile, symbol, how)
2661 bfd *abfd;
2684 bfd_print_symbol_vandf (abfd, (PTR)file, symbol);
2708 NAME(aout,read_minisymbols) (abfd, dynamic, minisymsp, sizep)
2709 bfd *abfd;
2718 return _bfd_generic_read_minisymbols (abfd, dynamic, minisymsp, sizep);
2721 if (! aout_get_external_symbols (abfd))
2724 if (obj_aout_external_sym_count (abfd) < MINISYM_THRESHOLD)
2725 return _bfd_generic_read_minisymbols (abfd, dynamic, minisymsp, sizep);
2727 *minisymsp = (PTR) obj_aout_external_syms (abfd);
2733 obj_aout_external_syms (abfd) = NULL;
2736 return obj_aout_external_sym_count (abfd);
2744 NAME(aout,minisymbol_to_symbol) (abfd, dynamic, minisym, sym)
2745 bfd *abfd;
2751 || obj_aout_external_sym_count (abfd) < MINISYM_THRESHOLD)
2752 return _bfd_generic_minisymbol_to_symbol (abfd, dynamic, minisym, sym);
2758 (abfd,
2762 obj_aout_external_strings (abfd),
2763 obj_aout_external_string_size (abfd),
2776 (abfd, section, symbols, offset, filename_ptr, functionname_ptr, line_ptr)
2777 bfd *abfd;
2798 *filename_ptr = abfd->filename;
2865 if (obj_textsec (abfd) != section)
2923 if (adata (abfd).line_buf != NULL)
2924 free (adata (abfd).line_buf);
2927 adata (abfd).line_buf = buf = NULL;
2931 adata (abfd).line_buf = buf;
2956 if (bfd_get_symbol_leading_char (abfd) == '\0')
2960 buf[0] = bfd_get_symbol_leading_char (abfd);
2974 NAME(aout,sizeof_headers) (abfd, execable)
2975 bfd *abfd;
2978 return adata (abfd).exec_bytes_size;
2985 NAME(aout,bfd_free_cached_info) (abfd)
2986 bfd *abfd;
2990 if (bfd_get_format (abfd) != bfd_object
2991 || abfd->tdata.aout_data == NULL)
2995 BFCI_FREE (obj_aout_symbols (abfd));
2997 obj_aout_external_syms (abfd) = 0;
2998 bfd_free_window (&obj_aout_sym_window (abfd));
2999 bfd_free_window (&obj_aout_string_window (abfd));
3000 obj_aout_external_strings (abfd) = 0;
3002 BFCI_FREE (obj_aout_external_syms (abfd));
3003 BFCI_FREE (obj_aout_external_strings (abfd));
3005 for (o = abfd->sections; o != (asection *) NULL; o = o->next)
3061 NAME(aout,link_hash_table_init) (table, abfd, newfunc)
3063 bfd *abfd;
3068 return _bfd_link_hash_table_init (&table->root, abfd, newfunc);
3074 NAME(aout,link_hash_table_create) (abfd)
3075 bfd *abfd;
3084 if (! NAME(aout,link_hash_table_init) (ret, abfd,
3097 NAME(aout,link_add_symbols) (abfd, info)
3098 bfd *abfd;
3101 switch (bfd_get_format (abfd))
3104 return aout_link_add_object_symbols (abfd, info);
3107 (abfd, info, aout_link_check_archive_element);
3117 aout_link_add_object_symbols (abfd, info)
3118 bfd *abfd;
3121 if (! aout_get_external_symbols (abfd))
3123 if (! aout_link_add_symbols (abfd, info))
3127 if (! aout_link_free_symbols (abfd))
3139 aout_link_check_archive_element (abfd, info, pneeded)
3140 bfd *abfd;
3144 if (! aout_get_external_symbols (abfd))
3147 if (! aout_link_check_ar_symbols (abfd, info, pneeded))
3152 if (! aout_link_add_symbols (abfd, info))
3158 if (! aout_link_free_symbols (abfd))
3168 aout_link_free_symbols (abfd)
3169 bfd *abfd;
3171 if (obj_aout_external_syms (abfd) != (struct external_nlist *) NULL)
3174 bfd_free_window (&obj_aout_sym_window (abfd));
3176 free ((PTR) obj_aout_external_syms (abfd));
3178 obj_aout_external_syms (abfd) = (struct external_nlist *) NULL;
3180 if (obj_aout_external_strings (abfd) != (char *) NULL)
3183 bfd_free_window (&obj_aout_string_window (abfd));
3185 free ((PTR) obj_aout_external_strings (abfd));
3187 obj_aout_external_strings (abfd) = (char *) NULL;
3200 aout_link_check_ar_symbols (abfd, info, pneeded)
3201 bfd *abfd;
3212 p = obj_aout_external_syms (abfd);
3213 pend = p + obj_aout_external_sym_count (abfd);
3214 strings = obj_aout_external_strings (abfd);
3217 int type = H_GET_8 (abfd, p->e_type);
3238 name = strings + GET_WORD (abfd, p->e_strx);
3297 if (! (*info->callbacks->add_archive_element) (info, abfd, name))
3307 value = GET_WORD (abfd, p->e_value);
3317 symbfd = h->u.undef.abfd;
3325 abfd,
3347 if (power > bfd_get_arch_info (abfd)->section_align_power)
3348 power = bfd_get_arch_info (abfd)->section_align_power;
3374 if (! (*info->callbacks->add_archive_element) (info, abfd, name))
3389 aout_link_add_symbols (abfd, info)
3390 bfd *abfd;
3406 syms = obj_aout_external_syms (abfd);
3407 sym_count = obj_aout_external_sym_count (abfd);
3408 strings = obj_aout_external_strings (abfd);
3414 if (aout_backend_info (abfd)->add_dynamic_symbols != NULL)
3416 if (! ((*aout_backend_info (abfd)->add_dynamic_symbols)
3417 (abfd, info, &syms, &sym_count, &strings)))
3426 sym_hash = (struct aout_link_hash_entry **) bfd_alloc (abfd, amt);
3429 obj_aout_sym_hashes (abfd) = sym_hash;
3431 add_one_symbol = aout_backend_info (abfd)->add_one_symbol;
3448 type = H_GET_8 (abfd, p->e_type);
3454 name = strings + GET_WORD (abfd, p->e_strx);
3455 value = GET_WORD (abfd, p->e_value);
3493 section = obj_textsec (abfd);
3494 value -= bfd_get_section_vma (abfd, section);
3500 section = obj_datasec (abfd);
3501 value -= bfd_get_section_vma (abfd, section);
3504 section = obj_bsssec (abfd);
3505 value -= bfd_get_section_vma (abfd, section);
3512 string = strings + GET_WORD (abfd, p->e_strx);
3524 section = obj_textsec (abfd);
3526 value -= bfd_get_section_vma (abfd, section);
3529 section = obj_datasec (abfd);
3531 value -= bfd_get_section_vma (abfd, section);
3534 section = obj_bsssec (abfd);
3536 value -= bfd_get_section_vma (abfd, section);
3544 name = strings + GET_WORD (abfd, p->e_strx);
3557 section = obj_textsec (abfd);
3558 value -= bfd_get_section_vma (abfd, section);
3562 section = obj_datasec (abfd);
3563 value -= bfd_get_section_vma (abfd, section);
3567 section = obj_bsssec (abfd);
3568 value -= bfd_get_section_vma (abfd, section);
3574 (info, abfd, name, flags, section, value, string, copy, FALSE,
3585 bfd_get_arch_info (abfd)->section_align_power))
3587 bfd_get_arch_info (abfd)->section_align_power;
3730 NAME(aout,final_link) (abfd, info, callback)
3731 bfd *abfd;
3749 abfd->flags |= DYNAMIC;
3752 aout_info.output_bfd = abfd;
3790 bfd_get_filename (abfd),
3791 sub->xvec->name, abfd->xvec->name);
3821 if (obj_textsec (abfd) != (asection *) NULL)
3822 trsize += (_bfd_count_link_order_relocs (obj_textsec (abfd)
3824 * obj_reloc_entry_size (abfd));
3825 if (obj_datasec (abfd) != (asection *) NULL)
3826 drsize += (_bfd_count_link_order_relocs (obj_datasec (abfd)
3828 * obj_reloc_entry_size (abfd));
3831 exec_hdr (abfd)->a_trsize = trsize;
3832 exec_hdr (abfd)->a_drsize = drsize;
3834 exec_hdr (abfd)->a_entry = bfd_get_start_address (abfd);
3839 if (! NAME(aout,adjust_sizes_and_vmas) (abfd, &text_size, &text_end))
3850 (*callback) (abfd, &aout_info.treloff, &aout_info.dreloff,
3852 obj_textsec (abfd)->rel_filepos = aout_info.treloff;
3853 obj_datasec (abfd)->rel_filepos = aout_info.dreloff;
3854 obj_sym_filepos (abfd) = aout_info.symoff;
3857 obj_aout_external_sym_count (abfd) = 0;
3918 for (o = abfd->sections; o != NULL; o = o->next)
3926 for (o = abfd->sections; o != (asection *) NULL; o = o->next)
3954 if (! _bfd_default_link_order (abfd, info, o, p))
3971 for (o = abfd->sections; o != (asection *) NULL; o = o->next)
4014 if (aout_backend_info (abfd)->finish_dynamic_link != NULL)
4016 if (! (*aout_backend_info (abfd)->finish_dynamic_link) (abfd, info))
4021 abfd->symcount = obj_aout_external_sym_count (abfd);
4022 exec_hdr (abfd)->a_syms = abfd->symcount * EXTERNAL_NLIST_SIZE;
4023 obj_str_filepos (abfd) = obj_sym_filepos (abfd) + exec_hdr (abfd)->a_syms;
4024 obj_textsec (abfd)->reloc_count =
4025 exec_hdr (abfd)->a_trsize / obj_reloc_entry_size (abfd);
4026 obj_datasec (abfd)->reloc_count =
4027 exec_hdr (abfd)->a_drsize / obj_reloc_entry_size (abfd);
4030 if (abfd->symcount > 0)
4032 if (bfd_seek (abfd, obj_str_filepos (abfd), SEEK_SET) != 0
4033 || ! emit_stringtab (abfd, aout_info.strtab))
4036 else if (obj_textsec (abfd)->reloc_count == 0
4037 && obj_datasec (abfd)->reloc_count == 0)
4043 pos = obj_datasec (abfd)->filepos + exec_hdr (abfd)->a_data - 1;
4044 if (bfd_seek (abfd, pos, SEEK_SET) != 0
4045 || bfd_bwrite (&b, (bfd_size_type) 1, abfd) != 1)
4827 aout_reloc_index_to_section (abfd, indx)
4828 bfd *abfd;
4834 return obj_textsec (abfd);
4836 return obj_datasec (abfd);
4838 return obj_bsssec (abfd);