aboutsummaryrefslogtreecommitdiff
path: root/bfd/elfcode.h
AgeCommit message (Collapse)AuthorFilesLines
1994-09-29* elf.c (bfd_elf_print_symbol): Moved here from elf_print_symbol in elfcode.h.Ken Raeburn1-40/+3
(case bfd_print_symbol_all): Print symbol's size field, except for common symbols; print their alignment. * elfcode.h (elf_print_symbol): Deleted. * libelf.h (bfd_elf_print_symbol): Declare. (bfd_elf{32,64}_print_symbol): Replace declarations with macros.
1994-09-26tipoIan Lance Taylor1-1/+1
1994-09-23 * elfcode.h (map_program_segments): Don't abort if we allocatedIan Lance Taylor1-6/+4
too much space for the program header, only if we allocated too little.
1994-09-12 * elfcode.h (swap_out_syms): Set the type of an undefined symbolIan Lance Taylor1-6/+8
to STT_FUNC if the BSF_FUNCTION flag is set.
1994-08-30 * elfcode.h (NAME(bfd_elf,size_dynamic_sections)): Add sonameIan Lance Taylor1-7/+21
argument, and use it to set DT_SONAME dynamic entry. * bfd-in.h (bfd_elf32_size_dynamic_sections): Update prototype. (bfd_elf64_size_dynamic_sections): Update prototype. * bfd-in2.h: Rebuilt.
1994-08-15 * elfcode.h (bfd_section_from_shdr): If a SHT_SYMTAB section in aIan Lance Taylor1-0/+13
shared object has SHF_ALLOC set, create a BFD section for it. (elf_section_from_bfd_section): There may be a BFD section for a SHT_SYMTAB section.
1994-08-12 * elfcode.h (section_from_elf_index): Correct check for invalidIan Lance Taylor1-1/+1
section index.
1994-08-12 * elfcode.h (elf_link_add_object_symbols): If there is no symbolIan Lance Taylor1-0/+17
table, try using the dynamic symbol table. From Eric Youngdale <ericy@cais.cais.com>.
1994-08-01 * elfcode.h (map_program_segments): Check DYNAMIC as well as EXEC_P.Jean Marie Diaz1-2/+2
(assign_file_positions_except_relocs): Likewise.
1994-08-01 ELF linker patches from Eric Youngdale <ericy@cais.cais.com>.Jean Marie Diaz1-10/+9
* elfcode.h (elf_link_create_dynamic_sections): Set type of _DYNAMIC to STT_OBJECT. (NAME(bfd_elf,record_link_assignment)): Always create hash table entry. Set type to STT_OBJECT. (elf_link_output_extsym): Don't set type of weak defined symbol to STB_WEAK if symbol was referenced. * elf32-i386.c (elf_i386_create_dynamic_sections): Set type of _GLOBAL_OFFSET_TABLE to STT_OBJECT. (elf_i386_check_relocs): Ignore local PLT32 relocs. (elf_i386_relocate_section): Treat local PLT32 relocs as PC32.
1994-08-01 * elfcode.h (elf_adjust_dynamic_symbol): Correct weak symbolIan Lance Taylor1-5/+4
handling again.
1994-08-01 * elfcode.h (elf_slurp_reloc_table): Don't try to read the relocsIan Lance Taylor1-2/+4
if there aren't any.
1994-07-26 Add support for creating shared libraries under i386 ELF and SPARCIan Lance Taylor1-130/+254
ELF. Based on patches by Eric Youngdale <ericy@cais.cais.com>. * libelf.h (struct elf_link_hash_entry): Remove copy_offset field. Add got_offset and plt_offset fields. (ELF_LINK_HASH_REF_DYNAMIC_MULTIPLE): Don't define. (ELF_LINK_HASH_DEF_DYNAMIC_MULTIPLE): Don't define. (ELF_LINK_HASH_NEEDS_COPY): Define. (struct elf_backend_data): Add check_relocs field. (struct bfd_elf_section_data): Change relocs from PTR to Elf_Internal_Rela *. (struct elf_obj_tdata): Add local_got_offsets field. (elf_local_got_offsets): Define accessor macro. (bfd_elf32_link_create_dynamic_sections): Declare. (bfd_elf32_link_record_dynamic_symbol): Declare. (bfd_elf64_link_create_dynamic_sections): Declare. (bfd_elf64_link_record_dynamic_symbol): Declare. * elfcode.h (elf_slurp_reloc_table): Don't use the section data relocs field. (elf_link_record_dynamic_symbol): Make globally visible. Use macro to rename to NAME(bfd_elf,link_record_dynamic_symbol). (elf_link_add_object_symbols): If creating a shared library, put make all local symbols dynamic. Don't bother with the DYNAMIC_MULTIPLE flags. Call the check_relocs backend function if it is defined. (elf_link_create_dynamic_sections): Make globally visible. Use macro to rename to NAME(bfd_elf,link_create_dynamic_sections). If creating a shared library, make sure that _DYNAMIC is added as a dynamic symbol. (elf_link_read_relocs): New function. (NAME(bfd_elf,record_link_assignment)): If creating a shared library, always create symbols, and always make them dynamic. (elf_bfd_final_link): Permit creation of shared libraries. (elf_link_input_bfd): Use elf_link_read_relocs to get the relocs. * elf.c (_bfd_elf_link_hash_newfunc): Don't initialize copy_offset. Initialize got_offset and plt_offset. * elf32-target.h (elf_backend_check_relocs): Define as 0 if not defined. (elf32_bed): Initialize check_relocs field. * elf64-target.h (elf_backend_check_relocs): Define as 0 if not defined. (elf64_bed): Initialize check_relocs field. * elf32-i386.c (elf_howto_table): Change R_386_PLT32 and R_386_GOTPC to be pc_relative and pcrel_offset. (elf_i386_pic_plt0_entry): Define. (elf_i386_pic_plt_entry): Define. (elf_i386_create_dynamic_sections): Create a .got.plt section, and define _GLOBAL_OFFSET_TABLE_ at the start of it. If creating a shared library, make sure that _GLOBAL_OFFSET_TABLE_ is added as a dynamic symbol. Don't create .rel.bss if creating a shared library. (elf_i386_check_relocs): New function. (elf_i386_adjust_dynamic_symbol): Don't make a PLT entry if the symbol already has one. When making a PLT entry, set plt_offset. Don't create a copy reloc when creating a shared library. Don't set copy_offset, just set ELF_LINK_HASH_NEEDS_COPY. (elf_i386_allocate_dynamic_section): Remove. (elf_i386_size_dynamic_sections): Look through all the sections rather than assuming we know their names. Remove any empty reloc or plt sections. Only add a DT_DEBUG entry if not creating a shared library. Only add a DT_PLTGOT entry if there is a PLT. Add a DT_TEXTREL entry if required. (elf_i386_relocate_section): Permit undefined symbols when creating a shared library. Handle the special relocation types specially. (elf_i386_finish_dynamic_symbol): Create a PLT entry if plt_offset is set. If creating a shared library, produce a PIC PLT entry. Only mark a PLT symbol as undefined if it was not defined by a regular object file. Create a GOT entry if got_offset is set. Create a copy reloc if ELF_LINK_HASH_NEEDS_COPY is set. (elf_i386_finish_dynamic_sections): Change the handling of DT_RELSZ to simply subtract out the size of .rel.plt. If creating a shared library, produce PIC PLT code. (elf_backend_check_relocs): Define. * elf32-sparc.c (elf_sparc_howto_table): Change R_SPARC_GOT10, R_SPARC_GOT22, and R_SPARC_PC10 to not warn about reloc overflow. (elf32_sparc_create_dynamic_sections): If creating a shared library, make sure that _GLOBAL_OFFSET_TABLE_ is added as a dynamic symbol, and set the type to STT_OBJECT. Likewise for _PROCEDURE_LINKAGE_TABLE_. Don't create .rel.bss if creating a shared library. (elf32_sparc_check_relocs): New function. (elf32_sparc_adjust_dynamic_symbol): Don't make a PLT entry if the symbol already has one. When making a PLT entry, set plt_offset. Don't create a copy reloc when creating a shared library. Don't set copy_offset, just set ELF_LINK_HASH_NEEDS_COPY. (elf32_sparc_allocate_dynamic_section): Remove. (elf32_sparc_size_dynamic_sections): Look through all the sections rather than assuming we know their names. Only add a DT_DEBUG entry if not creating a shared library. Add a DT_TEXTREL entry if required. (elf32_sparc_relocate_section): Permit undefined symbols when creating a shared library. Handle the special relocation types specially. (elf32_sparc_finish_dynamic_symbol): Create a PLT entry if plt_offset is set. Only mark a PLT symbol as undefined if it was not defined by a regular object file. Create a GOT entry if got_offset is set. Create a copy reloc if ELF_LINK_HASH_NEEDS_COPY is set. (elf32_sparc_finish_dynamic_sections): Store dynobj in a local variable. (elf_backend_check_relocs): Define.
1994-07-22 * aoutx.h (aout_link_check_ar_symbols): When changing a symbol toIan Lance Taylor1-7/+5
common, set the alignment. (aout_link_add_symbols): Restrict the alignment of a common symbol to the alignment power given by the architecture. * elf.c (_bfd_elf_link_hash_newfunc): Don't initialize align. Do initialize copy_offset. * elf32-i386.c (elf_i386_adjust_dynamic_symbol): Use copy_offset field rather than align field. Get alignment using bfd_log2 rather than switch. * elf32-sparc.c (elf32_sparc_adjust_dynamic_symbol): Likewise. * elf32-i386.c (elf_i386_finish_dynamic_symbol): Use copy_offset, not align. * elf32-sparc.c (elf32_sparc_finish_dynamic_symbol): Likewise.
1994-07-20 * elfcode.h (NAME(bfd_elf,size_dynamic_sections)): Add rpathIan Lance Taylor1-1/+18
argument. If it is not NULL, use it to set DT_RPATH. * bfd-in.h (bfd_elf32_size_dynamic_sections): Update prototype. (bfd_elf64_size_dynamic_sections): Likewise. * bfd-in2.h: Rebuilt.
1994-07-17 * libelf.h (ELF_LINK_HASH_DEFINED_WEAK): Define.Ian Lance Taylor1-2/+17
* elfcode.h (elf_link_add_object_symbols): If symbol is defined as weak, set ELF_LINK_HASH_DEFINED_WEAK. (elf_link_output_extsym): If symbol is defined as weak, mark it STB_WEAK.
1994-07-17 * libelf.h (struct bfd_elf_section_data): Add relocs field.Ian Lance Taylor1-218/+112
(shdr_name): Remove; unused. * elfcode.h (elf_slurp_reloc_table): Rewrote to handle both REL and RELA relocs. Free up the unswapped relocs. Permit the relocs to be cached in the section_data. Correct the reloc address. (elf_slurp_reloca_table): Remove. (elf_canonicalize_reloc): Rewrote. (elf_link_input_bfd): Permit the relocs to be cached in the section data.
1994-07-12 * aix386-core.c, aoutf1.h, cisco-core.c, elfcode.h, hppabsd-core.c,Peter Schauer1-5/+8
hpux-core.c, irix-core.c, lynx-core.c, osf-core.c, ptrace-core.c, rs6000-core.c, trad-core.c: Remove SEC_ALLOC flag from .reg sections, .reg sections are not allocated and contain debug information only. * osf-core.c (make_bfd_asection, osf_core_core_file_p): Use bfd_make_section_anyway instead of building unique section names.
1994-07-05 * elfcode.h (swap_out_syms): Get alignment of common symbol fromIan Lance Taylor1-28/+56
st_value field of saved ELF symbol information, if there is any.
1994-06-23 Preliminary support for generating shared libraries, from EricIan Lance Taylor1-8/+47
Youngdale <ericy@cais.cais.com>. * elfcode.h (prep_headers): If DYNAMIC, set e_type to ET_DYN. (elf_link_add_object_symbols): If generating a shared library, create dynamic sections for first input BFD with the right format. (elf_link_create_dynamic_sections): Don't create .interp section if creating a shared library. (elf_link_input_bfd): Skip dynamic sections in input file. (elf_bfd_final_link): If creating a shared library, it's OK for dynobj to have sections which are not SEC_IN_MEMORY. * elf32-i386.c (elf_i386_size_dynamic_sections): Only set .interp section if not creating a shared library. * elf32-sparc.c (elf_sparc_size_dynamic_sections): Likewise.
1994-06-23 * elfcode.h (elf_object_p): Don't set DYNAMIC just because thereIan Lance Taylor1-18/+1
is an SHT_DYNAMIC section.
1994-06-21 * section.c (bfd_abs_section): Make const.Ian Lance Taylor1-34/+38
(bfd_abs_section_ptr, bfd_is_abs_section): Define. (bfd_und_section): Make const. (bfd_und_section_ptr, bfd_is_und_section): Define. (bfd_com_section): Make const. (bfd_com_section_ptr): Define. (bfd_ind_section): Make const. (bfd_ind_section_ptr, bfd_is_ind_section): Define. (bfd_abs_symbol, bfd_com_symbol): Make const. (bfd_und_symbol, bfd_ind_symbol): Likewise. (global_syms): Cast initialization of section field. (STD_SECTION): Define as const, and cast initializations. * bfd-in2.h: Rebuilt. * Many files: Change uses of bfd_abs_section, etc., to use bfd_abs_section_ptr or bfd_is_abs_section, etc.
1994-06-20 * Many files: change all bfd_target vectors to be const. ChangeIan Lance Taylor1-4/+4
all uses of bfd_target * to be const bfd_target *. Change bfd_target_vector and bfd_default_vector arrays to be const bfd_target * const *.
1994-06-20 * aoutx.h (NAME(aout,final_link)): Check flavour of sub, not abfd,Ian Lance Taylor1-9/+9
when computing reloc sizes. From Eric Youngdale <ericy@cais.cais.com>. * elfcode.h (elf_bfd_final_link): Don't try to compute maximum reloc count or size for a non-ELF file.
1994-06-17 * elfcode.h (elf_link_input_bfd): Don't try to read local symbolsJeff Law1-4/+5
if there aren't any in the input file.
1994-06-16 * elfcode.h (elf_bfd_final_link): If trying to generate a sharedIan Lance Taylor1-0/+8
object, warn and return false.
1994-06-16 * libelf.h (struct elf_obj_tdata): New field dt_needed_name.Ian Lance Taylor1-1/+5
(elf_dt_needed_name): New accessor macro. * elfcode.h (elf_link_add_object_symbols): If elf_dt_needed_name is set, use that instead of the filename for the DT_NEEDED dynamic entry. * elf.c (bfd_elf_set_dt_needed_name): New function. * bfd-in.h (bfd_elf_set_dt_needed_name): Declare. * bfd-in2.h: Rebuilt.
1994-06-15Tweak v9 support to ready it for release.Ken Raeburn1-3/+6
1994-06-15 * elfcode.h (NAME(bfd_elf,size_dynamic_sections)): Add sinterpptrIan Lance Taylor1-12/+18
argument, and set it to the .interp section. * bfd-in.h (bfd_elf32_size_dynamic_sections): Update prototype. (bfd_elf64_size_dynamic_sections): Likewise. * bfd-in2.h: Rebuilt.
1994-06-06 * elfcode.h (bfd_section_from_shdr): Don't turn a reloc sectionIan Lance Taylor1-11/+7
into a BFD section just because SHF_ALLOC is set; require that it not use the normal symbol table. (elf_section_from_bfd_section): Corresponding change.
1994-06-05 Changes to support ELF strip and objcopy on dynamically linkedIan Lance Taylor1-345/+282
files. * elfcode.h (elf_fake_sections): Add prototype. (bfd_section_from_shdr): Make a BFD section from an SHT_HASH section, and from an SHT_DYNSYM section, and from the dynamic string table section. (elf_object_p): Set D_PAGED if there is a program header. (elf_make_sections): Remove. (fix_up_strtabs): Remove. (elf_fake_sections): Rewrite. Now sets sh_entsize. (assign_section_numbers): Rewrite. Now sets sh_link and sh_info for all sections. (elf_compute_section_file_positions): Don't call obsolete functions elf_make_sections or fix_up_strtabs. (swap_out_syms): Set sh_addralign to FILE_ALIGN rather than 4. (NAME(bfd_elf,write_object_contents)): Permit writing DYNAMIC objects. (elf_section_from_bfd_section): Treat SHT_DYNSYM like other normal sections. If an SHT_REL or SHT_RELA section is allocated or uses an unusual symbol table, permit a BFD section to map to it. Permit most SHT_STRTAB sections to have a BFD section mapped to them. (elf_bfd_final_link): Don't set sh_link, sh_info or sh_entsize fields of dynamic sections here; do it in assign_section_numbers. * elf32-target.h, elf64-target.h: Add D_PAGED to permitted object flags.
1994-05-24 Make MIPS ELF use new ELF backend linker. No shared libraryIan Lance Taylor1-25/+70
support yet. * elf32-mips.c (bfd_mips_elf32_swap_gptab_in): New function. (bfd_mips_elf32_swap_gptab_out): New function. (mips_elf_object_p): If last symbol is LOCAL, set elf_bad_symtab. (mips_elf_final_write_processing): Set sh_info field for .gptab.* sections. (mips_elf_fake_sections): Set sh_entsize for .gptab.* sections. (mips_elf_read_ecoff_info): Read and free external symbols last, not first, for clarity. (struct mips_elf_link_hash_entry): Define new structure. (struct mips_elf_link_hash_table): Define new structure. (mips_elf_link_hash_lookup): Define new macro. (mips_elf_link_hash_traverse): Define new macro. (mips_elf_hash_table): Define new macro. (mips_elf_link_hash_newfunc): New static function. (mips_elf_link_hash_table_create): New static function. (mips_elf_add_symbol_hook): New static function. (struct extsym_info): Define new structure. (mips_elf_get_extr, mips_elf_set_index): Remove. (mips_elf_output_extsym): New static function. (gptab_compare): New static function. (mips_elf_final_link): Rewrite to use ELF backend linker, and to merge gptab information in input files. (mips_elf_relocate_hi16): New static function. (mips_elf_relocate_section): New static function. (bfd_elf32_bfd_link_hash_table_create): Define as macro before including elf32-target.h. (elf_backend_relocate_section): Likewise. (elf_backend_add_symbol_hook): Likewise. * elf.c (_bfd_elf_link_hash_newfunc): Rename from elf_link_hash_newfunc and make globally visible. Change caller. (_bfd_elf_link_hash_table_init): New function, broken out of _bfd_elf_link_hash_table_create. (_bfd_elf_link_hash_table_create): Use _bfd_elf_link_hash_table_init. * libelf.h (struct elf_obj_tdata): Add new field bad_symtab. (elf_bad_symtab): Define new accessor macro. (_bfd_elf_link_hash_newfunc): Declare. (_bew_elf_link_hash_table_init): Declare. * elfcode.h (elf_object_p): Call backend object_p hook after swapping in all the section headers. (map_program_segments): Correct typo: Internal for External. (elf_link_add_object_symbols): If elf_bad_symtab is set, read all the symbols. Skip STB_LOCAL symbols rather than giving an error. (elf_bfd_final_link): If elf_bad_symtab is set, allocate space for all symbols, not just locals. (elf_link_output_extsym): Only skip a symbol not mentioned by a regular file if it is mentioned by a dynamic object. (elf_link_input_bfd): If elf_bad_symtab is set, read all the symbols.
1994-05-20 * elf.c (_bfd_elf_make_section_from_shdr): New function, based onIan Lance Taylor1-115/+29
code repeated three times in bfd_section_from_shdr in elfcode.h. * libelf.h (_bfd_elf_make_section_from_shdr): Declare. * elfcode.h (bfd_section_from_shdr): Use new function _bfd_elf_make_section_from_shdr to create BFD sections. If a reloc section does not use the main symbol table, or it is part of the process image, treat it as a normal section, not relocs. * elf32-mips.c (mips_elf_section_from_shdr): Use new function _bfd_elf_make_section_from_shdr.
1994-05-19Make map_program_segments tend to call abort rather than trash theIan Lance Taylor1-5/+3
stack in unhandled cases. Still covered by previous ChangeLog entry.
1994-05-19 Add support for ELF shared libraries. Loosely based on work byIan Lance Taylor1-380/+1463
Eric Youngdale <ericy@cais.com>. * libelf.h (struct elf_backend_data): Add new fields for dynamic linking: elf_backend_create_dynamic_sections, elf_backend_adjust_dynamic_symbol, elf_backend_size_dynamic_sections, elf_backend_finish_dynamic_symbol, elf_backend_finish_dynamic_sections. (struct elf_link_hash_entry): Change type of align field to bfd_size_type. Add fields dynindx, dynstr_index, weakdef, elf_link_hash_flags. (struct elf_link_hash_table): Add fields dynobj, dynsymcount, dynstr, bucketcount. (bfd_elf32_swap_reloc_in, bfd_elf32_swap_reloc_out): Declare. (bfd_elf32_swap_reloca_in, bfd_elf32_swap_reloca_out): Declare. (bfd_elf32_swap_dyn_in, bfd_elf32_swap_dyn_out): Declare. (bfd_elf32_add_dynamic_entry): Declare. (bfd_elf64_swap_reloc_in, bfd_elf64_swap_reloc_out): Declare. (bfd_elf64_swap_reloca_in, bfd_elf64_swap_reloca_out): Declare. (bfd_elf64_swap_dyn_in, bfd_elf64_swap_dyn_out): Declare. (bfd_elf64_add_dynamic_entry): Declare. * elfcode.h (Elf_External_Dyn): Define. (elf_swap_reloc_in): Define as macro using NAME. Make externally visible. (elf_swap_reloc_out): Likewise. (elf_swap_reloca_in, elf_swap_reloca_out): Likewise. (elf_swap_dyn_in, elf_swap_dyn_out): Define as macro using NAME and as new externally visible function. (elf_fake_sections): Set section type of dynamic sections based on section names. (elf_write_phdrs): Remove. (assign_file_position_for_section): Add new align argument. Change all callers. (get_program_header_size): New static function. (struct seg_info): Remove. (map_program_segments): Completely rewrite. (assign_file_positions_except_relocs): Completely rewrite. (assign_file_positions_for_relocs): Don't set a file position for sections which already have one. Don't bother to align the file position here. (section_from_elf_index): Handle SHT_HASH and SHT_DYNAMIC section types. (elf_section_from_bfd_section): Likewise. (elf_slurp_symbol_table): If section_from_elf_index fails, just use bfd_abs_section rather than returning an error. (elf_sizeof_headers): Make useful. (elf_link_record_dynamic_symbol): New static function. (elf_link_add_object_symbols): Handle dynamic objects. (elf_link_create_dynamic_sections): New static function. (elf_add_dynamic_entry): Define as macro using NAME and as new externally visible function. (NAME(bfd_elf,record_link_assignment)): New function. (elf_buckets): New static variable. (NAME(bfd_elf,size_dynamic_sections)): New function. (struct elf_final_link_info): Add dynsym_sec and hash_sec fields. (elf_bfd_final_link): Handle dynamic linking. Create a section symbol for all ELF sections, not all BFD sections. Store section symbol index in target_index field, not index field. Traverse over global symbols even if stripping. (elf_link_output_extsym): Output dynamic symbols. Mark symbols defined by dynamic objects as undefined. (elf_link_input_bfd): Ignore dynamic objects. Use target_index field for section relocs, and make sure it is set. (elf_reloc_link_order): Use target_index field for section relocs, and make sure it is set. * elf.c (elf_link_hash_newfunc): Initialize dynindx, dynstr_index, weakdef and elf_link_hash_flags fields. (_bfd_elf_link_hash_table_create): Initialize dynobj, dynsymcount, dynstr and bucketcount fields. * elf32-target.h: Initialize new dynamic linking fields. * elf64-target.h: Likewise. * elf32-i386.c: New functions for dynamic linking support. * elf32-sparc.c: Likewise. * bfd-in.h (bfd_elf32_record_link_assignment): Declare. (bfd_elf64_record_link_assignment): Declare. (bfd_elf32_size_dynamic_sections): Declare. (bfd_elf64_size_dynamic_sections): Declare. * bfd-in2.h: Rebuilt.
1994-05-16 * bfd-in2.h: Rebuilt.Jeff Law1-13/+1
* elf32-hppa.c: Change .hppa_linker_stubs to .PARISC.stubs, likewise for other PA specific sections. (hppa_elf_relocate_unwind_table): Delete unused function. (elf_hppa_howto_table): Completely new table based on 94-02-02 draft PA ELF spec. Change relocation tags appropriately throughout elf32-hppa.c (hppa_elf_gen_reloc_type): Rewrite and simplify based on 94-02-02 spec. (hppa_elf_reloc): Likewise. (hppa_look_for_stubs_in_section): Likewise (ELF_MACHINE_CODE): Change to EM_PARISC. * elf32-hppa.h: Include "elf/hppa.h". Change relocation tags appropriately throughout elf32-hppa.h. (elf32_hppa_reloc_type): New table based on 94-02-02 draft PA ELF spec. (R_HPPA_ABS_CALL, R_HPPA_COMPLEX*, R_HPPA_UNWIND): Delete definitions. * elfcode.h (prep_headers): Use EM_PARISC instead of EM_HPPA. * reloc.c (bfd_reloc_code_real): Delete unused HPPA relocations. * som.h (R_HPPA_ABS_CALL, R_HPPA_COMPLEX): Delete definitions. * libhppa.h (hppa_field_adjust): Avoid adding constant_value into the final value twice for LR and RR field selectors.
1994-05-09 * elfcode.h: Include bfdlink.h. Added several new functions to doIan Lance Taylor1-108/+1698
linking. (ELF_R_TYPE): Define. (bfd_add_to_strtab): Return unsigned long. Change check for realloc failure. (elf_fake_sections): Check return value of bfd_add_to_strtab. (elf_compute_section_file_positions): Add link_info argument. Call elf_backend_begin_write_processing hook and prep_headers here. Only call swap_out_syms if link_info is NULL. Set up .shstrtab section here. Pass dosyms argument to assign_file_positions_except_relocs. Set output_has_begun flag. (assign_file_positions_for_symtab_and_strtabs): Add dosyms argument, and use it to control setting .symtab and .strtab file positions. (assign_file_positions_except_relocs): Add dosyms argument, and pass it on. (prep_headers): Check return value of bfd_add_to_strtab. (swap_out_syms): Likewise. Also, don't set up .shstrtab here. (NAME(bfd_elf,write_object_contents)): Some calls moved into elf_compute_section_file_positions. (elf_set_section_contents): Likewise. (elf_slurp_symbol_table): SHN_LORESERV corrected to SHN_LORESERVE. * libelf.h: Include bfdlink.h. (struct elf_backend_data): Add fields collect, elf_add_symbol_hook, elf_backend_relocate_section. (struct bfd_elf_section_data): Add field rel_hashes. (struct elf_obj_tdata): Remove fields internal_syms and symbols. Add field sym_hashes. (obj_symbols, obj_internal_syms): Remove definitions. (elf_sym_hashes): Define. (struct elf_link_hash_entry): Define. (struct elf_link_hash_table): Define. (elf_link_hash_lookup): Define. (elf_link_hash_traverse): Define. (elf_hash_table): Define. (_bfd_elf_link_hash_table_create): Declare. (bfd_elf32_bfd_link_add_symbols): Declare. (bfd_elf32_bfd_final_link): Declare. (bfd_elf64_bfd_link_add_symbols): Declare. (bfd_elf64_bfd_final_link): Declare. * elf.c: Include bfdlink.h. (elf_link_hash_newfunc): New function. (_bfd_elf_link_hash_table_create): New function. * elf32-target.h (elf_backend_relocate_section): If not defined, define as 0 and use generic linker. Otherwise, use ELF backend linker. (elf_backend_collect): If not defined, define as false. (elf_backend_add_symbol_hook): If not defined, define as 0. (elf32_bed): Initialize new fields. * elf64-target.h: Same changes as elf32-target.h. * elf32-i386.c: Include bfdlink.h. (elf_i386_relocate_section): New function. (elf_backend_relocate_section): Define. * elf32-sparc.c: Include bfdlink.h. (elf_info_to_howto): Change type of dst from Elf32_Internal_Rela to Elf_Internal_Rela (they're the same type anyhow). (elf_sparc_relocate_section): New function. (elf_backend_relocate_section): Define. * elf32-mips.c (elf_backend_collect): Define.
1994-04-25 * elfcode.h (write_relocs): Undo patch of Apr 10; breaks Solaris.Ian Lance Taylor1-11/+0
1994-04-25 * elfcode.h (bfd_section_from_shdr): Use bfd_make_section_anywayIan Lance Taylor1-96/+124
to create sections. Check return value of recursive calls. (bfd_section_from_phdr): Check return value of bfd_make_section. (elf_symbol_from_bfd_symbol): Likewise. (elf_object_p): Check return value of bfd_section_from_shdr. (section_from_elf_index): Likewise. (elf_slurp_symbol_table): Check return value of section_from_elf_index. (bfd_prstatus): Return boolean value. Check return value of bfd_make_section. (bfd_fpregset): Likewise. (bfd_prpsinfo): Return boolean value. (elf_corefile_note): Check return values of bfd_prstatus, bfd_fpregset, and bfd_prpsinfo. (elf_core_file_p): Check return value of elf_corefile_note.
1994-04-22 * aout-adobe.c (aout_adobe_set_arch_mach): Check return value ofIan Lance Taylor1-16/+8
bfd_default_set_arch_mach. Accept bfd_arch_m68k as well as bfd_arch_unknown. * elfcode.h (elf_set_arch_mach): Don't check a list of ELF architectures, just see if the desired architecture matches what the ELF backend permits.
1994-04-21 * libelf.h (elf_obj_tdata): Add members for dynamic symbol tablePeter Schauer1-23/+71
handling. * elfcode.h (bfd_section_from_shdr): Handle dynamic symbol table. * elfcode.h (elf_slurp_symbol_table): Take additional parameter to select static or dynamic symbol table and return number of symbols slurped or -1 on error. * elfcode.h (elf_get_symtab): Set bfd symcount from elf_slurp_symbol_table result. * elfcode.h (elf_get_dynamic_symtab_upper_bound, elf_canonicalize_dynamic_symtab): New functions to handle dynamic symbol table. * elf32-target.h, elf64-target.h (BFD_JUMP_TABLE_DYNAMIC): Change to handle dynamic symbol table, provide default definitions for dynamic relocs. * aoutx.h (howto_table_std, NAME(aout,swap_std_reloc_out), NAME(aout,swap_std_reloc_in), aout_link_input_section_std, aout_link_reloc_link_order): Handle r_jmptable and r_relative relocations.
1994-04-11 * elfcode.h (assign_file_positions_except_relocs): Don't requireIan Lance Taylor1-0/+1
the file alignment to correspond to the page size when linking with -N.
1994-04-10 * elfcode.h (write_relocs): For rela relocations, adjust theJeff Law1-0/+11
addend for relocations involving section symbols to account for the lossage of 1:1 mapping from input section symbols to output section symbols.
1994-04-07 * elfcode.h (elf_set_section_contents): Support calling the backendJeff Law1-0/+10
function elf_backend_begin_write_processing when just beginning to write an object file. * libelf.h (elf_backend_begin_write_processing): Declare. * elf{32,64}-target.h (elf_backend_begin_write_processing): Provide a default definition. (elf{32,64}_bed): Add elf_backend_begin_write_processing. * elf32-hppa.h (elf_hppa_tc_symbol): Delete extern declaration. (elf_hppa_tc_make_sections): Likewise. * elf32-hppa.c (symext_chain_built): Delete. (symext_chain_size): Renamed from symextn_contents_real_size. (elf32_hppa_backend_{begin,final}_write_processing): New functions. (add_entry_to_symext_chain): New function. (hppa_elf_set_section_contents): Ignore writes to the symbol extension section until it's been rebuilt internally. (hppa_elf_get_section_contents): Symbol extension section is no longer special. (elf_backend_{begin,final}_write_processing): Define. (elf_hppa_tc_make_sections): Simplify now that much code has migrated into elf32_hppa_backend_{being,final}_write_processing.
1994-04-05 * elfcode.h (write_shdrs_and_ehdr): Correct bfd_write check.Ian Lance Taylor1-1/+1
1994-04-05 * aoutx.h (NAME(aout,canonicalize_reloc)): Don't error out ifIan Lance Taylor1-2/+0
section->relocation is NULL; malloc might have returned NULL when given a zero size if there were no relocations. * bout.c (b_out_canonicalize_reloc): Likewise. * coffcode.h (coff_canonicalize_reloc): Likewise. * ecoff.c (ecoff_canonicalize_reloc): Likewise. * elfcode.h (elf_canonicalize_reloc): Likewise. * mipsbsd.c (MY(canonicalize_reloc)): Likewise. * i386lynx.c (NAME(lynx,canonicalize_reloc)): Likewise. * nlmcode.h (nlm_canonicalize_reloc): Likewise. * som.c (som_canonicalize_reloc): Likewise. * hp300hpux.c (MY(slurp_reloc_table)): Likewise. Also, if malloc returns NULL, don't report an error if we asked for zero bytes. * i386lynx.c (NAME(lynx,slurp_reloc_table)): If malloc returns NULL, don't report an error if we asked for zero bytes. * nlmcode.h (nlm_slurp_reloc_fixups): Likewise.
1994-04-04 Made sure that every call to bfd_read, bfd_write, and bfd_seekIan Lance Taylor1-15/+30
checks the return value and handled bfd_error correctly. These changes are not itemised.
1994-03-30Wed Mar 30 16:25:41 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)Ian Lance Taylor1-14/+19
Changes to let BFD return an error indication from get_symtab_upper_bound, bfd_canonicalize_symtab, bfd_get_reloc_upper_bound, and bfd_canonicalize_reloc. They now return long instead of unsigned int, and use -1 to indicate an error. Along the way, rename get_symtab_upper_bound to bfd_get_symtab_upper_bound. * bfd.c (bfd_get_reloc_upper_bound): Return long, and -1 on errors. (bfd_canonicalize_reloc): Likewise. * syms.c (bfd_get_symtab_upper_bound): Renamed from get_symtab_upper_bound. * targets.c (bfd_target): Renamed _get_symtab_upper_bound to _bfd_get_symtab_upper_bound, and changed it and _bfd_canonicalize_symtab and _get_reloc_upper_bound and _bfd_canonicalize_reloc to all return long. * aoutx.h (NAME(aout,get_symtab)): Return long, and -1 on errors. (NAME(aout,canonicalize_reloc)): Likewise. (NAME(aout,get_reloc_upper_bound)): Likewise. (NAME(aout,get_symtab_upper_bound)): Likewise. * bout.c (b_out_canonicalize_reloc): Likewise. (b_out_get_reloc_upper_bound): Likewise. * coffcode.h (coff_canonicalize_reloc): Likewise. * coffgen.c (coff_get_symtab_upper_bound): Likewise. (coff_get_symtab): Likewise. (coff_get_reloc_upper_bound): Likewise. * ecoff.c (ecoff_get_symtab_upper_bound): Likewise. (ecoff_get_symtab): Likewise. (ecoff_canonicalize_reloc): Likewise. * elfcode.h (elf_get_symtab_upper_bound): Likewise. (elf_get_reloc_upper_bound): Likewise. (elf_canonicalize_reloc): Likewise. (elf_get_symtab): Likewise. * hp300hpux.c (MY(get_symtab)): Likewise. (MY(get_symtab_upper_bound)): Likewise. (MY(canonicalize_reloc)): Likewise. * i386lynx.c (NAME(lynx,canonicalize_reloc)): Likewise. * ieee.c (ieee_slurp_external_symbols): Change return type to boolean. Check for errors from get_symbol. (ieee_slurp_symbol_table): Change return type to boolean. Check for errors from ieee_slurp_external_symbols. (ieee_get_symtab_upper_bound): Return long, and -1 on errors. (ieee_get_symtab): Likewise. (ieee_get_reloc_upper_bound): Likewise. (ieee_canonicalize_reloc): Likewise. * mipsbsd.c (MY(canonicalize_reloc)): Likewise. * nlmcode.h (nlm_get_symtab_upper_bound): Likewise. (nlm_get_symtab): Likewise. (nlm_get_reloc_upper_bound): Likewise. (nlm_canonicalize_reloc): Likewise. * oasys.c (oasys_get_symtab_upper_bound): Likewise. (oasys_get_symtab): Likewise. (oasys_get_reloc_upper_bound): Likewise. (oasys_canonicalize_reloc): Likewise. * som.c (som_get_symtab_upper_bound): Likewise. (som_get_symtab): Likewise. (som_get_reloc_upper_bound): Likewise. (som_canonicalize_reloc): Likewise. * srec.c (srec_get_symtab_upper_bound): Likewise. (srec_get_symtab): Likewise. (srec_get_reloc_upper_bound): Define as bfd_0l. (srec_canonicalize_reloc): Likewise. * tekhex.c (tekhex_get_symtab): Return long, and -1 on errors. (tekhex_get_symtab_upper_bound): Likewise. (tekhex_get_reloc_upper_bound): Define as bfd_0l. (tekhex_canonicalize_reloc): Likewise. * libaout.h (NAME(aout,get_symtab_upper_bound)): Change declaration to return long. (NAME(aout,get_symtab)): Likewise. (NAME(aout,canonicalize_reloc)): Likewise. (NAME(aout,get_reloc_upper_bound)): Likewise. * libcoff-in.h (coff_get_symtab_upper_bound): Likewise. (coff_get_symtab): Likewise. (coff_get_reloc_upper_bound): Likewise. * libecoff.h (ecoff_get_symtab_upper_bound): Likewise. (ecoff_get_symtab): Likewise. (ecoff_canonicalize_reloc): Likewise. * libelf.h (bfd_elf32_get_symtab_upper_bound): Likewise. (bfd_elf32_get_symtab): Likewise. (bfd_elf32_get_reloc_upper_bound): Likewise. (bfd_elf32_canonicalize_reloc): Likewise. (bfd_elf64_get_symtab_upper_bound): Likewise. (bfd_elf64_get_symtab): Likewise. (bfd_elf64_get_reloc_upper_bound): Likewise. (bfd_elf64_canonicalize_reloc): Likewise. * libnlm.h (nlmNAME(get_symtab_upper_bound)): Likewise. (nlmNAME(get_symtab)): Likewise. (nlmNAME(get_reloc_upper_bound)): Likewise. (nlmNAME(canonicalize_reloc)): Likewise. * archive.c (compute_and_write_armap): Use error_return and no_memory_return labels rather than freeing information in various places. Change storage, symcount and src_count to long. Check errors from bfd_get_symtab_upper_bound and bfd_canonicalize_symtab. * bout.c (b_out_relax_section): Change reloc_size to long. Check for errors from bfd_get_reloc_upper_bound and bfd_canonicalize_reloc. (b_out_get_relocated_section_contents): Likewise. * coff-alpha.c (alpha_ecoff_get_relocated_section_contents): Likewise. * elf32-mips.c: Likewise. * elf32-hppa.c (hppa_elf_stub_finish): Likewise. (hppa_look_for_stubs_in_section): Check for errors from bfd_get_symtab_upper_bound, bfd_canonicalize_symtab, and bfd_canonicalize_reloc. * ecofflink.c (bfd_ecoff_debug_accumulate_other): Check for errors from bfd_get_symtab_upper_bound and bfd_canonicalize_symtab. * linker.c (generic_link_read_symbols): Likewise. (_bfd_generic_final_link): Check for errors from bfd_get_reloc_upper_bound and bfd_canonicalize_reloc. * reloc.c (bfd_generic_get_relocated_section_contents): Likewise. * reloc16.c (bfd_coff_reloc16_relax_section): Likewise. (bfd_coff_reloc16_get_relocated_section_contents): Likewise. * libbfd.c (bfd_0l): New function. * libbfd-in.h (bfd_0l): Declare. * aix386-core.c: Change get_symtab_upper_bound, get_symtab, get_reloc_upper_bound, and canonicalize_reloc to use bfd_0l rather than bfd_0u. * cisco-core.c, hppabsd-core.c, hpux-core.c: Likewise. * irix-core.c, osf-core.c, ptrace-core.c, trad-core.c: Likewise. * bfd-in2.h: Rebuilt. * libbfd.h: Rebuilt. * libcoff.h: Rebuilt. * nlm32-sparc.c (nlm_sparc_read_reloc): Remove unused variables temp and name.
1994-03-26 * libbfd.c (bfd_read): Set bfd_error as appropriate for a shortJeff Law1-29/+17
read. (bfd_error_system_call or bfd_error_file_truncated). * som.c: Do not blindly set bfd_error_system_call after a failing bfd_read, bfd_write, or bfd_seek. In a few places (like som_object_p) override the error status set by bfd_read. * aix386-core.c, aout-encap,c archive.c, bout.c: Likewise. * coff-rs6000.c, coffgen.c ecoff.c, elf.c: Likewise. * elf32-hppa.c, elfcode.h, hp300hpux.c, i386lynx.c: Likewise. * nlm32-alpha.c, nlm32-i386.c, nlm32-sparc.c: Likewise. * som.c: Check return values from several bfd_{seek,read,write} calls that we just assumed were not failing.
1994-03-17 * elfcode.h (NAME(bfd_elf,write_object_contents)): Don't use spaceIan Lance Taylor1-263/+274
after NAME, since SunOS /bin/cc can't handle it.