aboutsummaryrefslogtreecommitdiff
path: root/bfd/elfcode.h
AgeCommit message (Collapse)AuthorFilesLines
1997-03-14 * elfcode.h (elf_slurp_symbol_table): Don't try to read theIan Lance Taylor1-4/+6
version symbols if there aren't any.
1997-03-13 * elflink.h (elf_link_add_object_symbols): Use extsymoff whenIan Lance Taylor1-4/+86
setting ever. Sanity check the version number. Sort out copying flags and other information when adding an indirect symbol. (NAME(bfd_elf,size_dynamic_sections)): Preserve any dynamic symbols added by the backend. Clear the entire contents of the versym section. (elf_export_symbol): Ignore indirect symbols. (elf_link_output_extsym): Accept a section without an owner in an assert. * elfcode.h (elf_slurp_symbol_table): Add a sanity check on the version count. Correct the allocation of x_versymp.
1996-12-15 * elfcode.h (elf_slurp_reloc_table): Add dynamic parameter.Ian Lance Taylor1-128/+52
* elf.c (_bfd_elf_canonicalize_reloc): Pass new argument to slurp_reloc_table. (_bfd_elf_get_dynamic_reloc_upper_bound): New function. (_bfd_elf_canonicalize_dynamic_reloc): New function. * elf-bfd.h (struct elf_size_info): Update declaration of slurp_reloc_table. (_bfd_elf_get_dynamic_reloc_upper_bound): Declare. (_bfd_elf_canonicalize_dynamic_reloc): Declare. * elfxx-target.h: Use new dynamic reloc routines by default. * elf64-mips.c (mips_elf64_slurp_reloc_table): Add dynamic parameter.
1996-05-29 64-bit MIPS ELF ABI objdump support:Ian Lance Taylor1-29/+58
* elf64-mips.c: New file. * Makefile.in: Rebuild dependencies. (BFD64_BACKENDS): Add elf64-mips.o. (BFD64_BACKENDS_CFILES): Add elf64-mips.c. * config.bfd (mips*el-*-elf*) Add bfd_elf64_bigmips_vec and bfd_elf64_littlemips_vec to targ_selvecs. (mips*-*-elf*): Likewise. * confingure.in: Add bfd_elf64_bigmips_vec and bfd_elf64_littlemips_vec to vector switch. * configure: Rebuild. * elf32-mips.c (_bfd_mips_elf_section_from_shdr): New function, broken out of mips_elf_section_from_shdr. (mips_elf32_section_from_shdr): Rename from mips_elf_section_from_shdr. Call new function. (elf_backend_section_from_shdr): Update name of renamed function. * elf-bfd.h (struct elf_size_info): Change second parameter of write_out_phdrs to be const. Likewise for second parameter of swap_symbol_out. (struct bfd_elf_section_data): Add rel_hdr2 field. (bfd_elf32_swap_symbol_in): Change second parameter to be const. (bfd_elf32_swap_symbol_out): Likewise. (bfd_elf32_swap_reloc_in): Likewise. (bfd_elf32_swap_reloc_out): Likewise. (bfd_elf32_swap_reloca_in): Likewise. (bfd_elf32_swap_reloca_out): Likewise. (bfd_elf32_swap_phdr_in): Likewise. (bfd_elf32_swap_phdr_out): Likewise. (bfd_elf32_swap_dyn_in): Likewise. (bfd_elf32_swap_dyn_out): Likewise. (bfd_elf32_slurp_symbol_table): Declare. (bfd_elf32_write_shdrs_and_ehdr): Declare. (bfd_elf32_write_out_phdrs): Declare. (bfd_elf64_swap_symbol_in): Change second parameter to be const. (bfd_elf64_swap_symbol_out): Likewise. (bfd_elf64_swap_reloc_in): Likewise. (bfd_elf64_swap_reloc_out): Likewise. (bfd_elf64_swap_reloca_in): Likewise. (bfd_elf64_swap_reloca_out): Likewise. (bfd_elf64_swap_phdr_in): Likewise. (bfd_elf64_swap_phdr_out): Likewise. (bfd_elf64_swap_dyn_in): Likewise. (bfd_elf64_swap_dyn_out): Likewise. (bfd_elf64_slurp_symbol_table): Declare. (bfd_elf64_write_shdrs_and_ehdr): Declare. (bfd_elf64_write_out_phdrs): Declare. (_bfd_mips_elf_section_from_shdr): Declare. * elf.c (bfd_section_from_shdr): Remove assertion requiring SHT_REL/SHT_RELA to match use_rela_p. If there is already a reloc section for the section, add the new one to rel_hdr2. Increment reloc_count rather than setting it. * elfcode.h (elf_slurp_symbol_table): Define name as macro. Remove static declaration. (elf_write_shdrs_and_ehdr): Define name as macro. (elf_write_out_phdrs): Likewise. (elf_swap_ehdr_in, elf_swap_ehdr_out): Declare. (elf_swap_shdr_in, elf_swap_shdr_out): Declare. (elf_swap_symbol_in): Change second parameter to be const. (elf_swap_symbol_out): Likewise. (elf_swap_ehdr_in, elf_swap_ehdr_out): Likewise. (elf_swap_shdr_in, elf_swap_shdr_out): Likewise. (elf_swap_phdr_in, elf_swap_phdr_out): Likewise. (elf_swap_reloc_in, elf_swap_reloc_out): Likewise. (elf_swap_reloca_in, elf_swap_reloca_out): Likewise. (elf_write_out_phdrs): Rename from write_out_phdrs. Change second parameter to be const. Make non-static. (elf_write_shdrs_and_ehdr): Rename from write_shdrs_and_ehdr. Make non-static. (elf_slurp_symbol_table): Make non-static. (NAME(_bfd_elf,size_info)): Update names of renamed functions. * elfxx-target.h (elf_info_to_howto): Define if not defined. (elf_backend_size_info): Likewise. (elfNN_bed): Use elf_backend_size_info. * targets.c (bfd_elf64_bigmips_vec): Declare. (bfd_elf64_littlemips_vec): Declare. (bfd_target_vector): Add bfd_elf64_bigmips_vec and bfd_elf64_littlemips_vec if BFD64 is defined.
1996-02-14Wed Feb 14 16:29:07 1996 Martin Anantharaman ↵Ian Lance Taylor1-1/+122
<martin@mail.imech.uni-duisburg.de> * syms.c (stt): Add entries for zerovars, vars, and code. * elfcode.h (validate_reloc): New static function. (write_relocs): Call validate_reloc for non ELF relocs. * elfxx-target.h (elf_symbol_leading_char): Define if not defined. (TARGET_BIG_SYM): Use elf_symbol_leading_char. (TARGET_LITTLE_SYM): Likewise. * config.bfd (m68*-*-psos*): New target.
1996-01-15update copyrightsIan Lance Taylor1-1/+1
1996-01-12 * elf-bfd.h (_bfd_elf_section_from_bfd_section): Declare.Ian Lance Taylor1-2/+0
* elfcode.h (_bfd_elf_section_from_bfd_section): Don't declare.
1996-01-12 * elf.c (_bfd_elf_print_private_bfd_data): Dump contents ofIan Lance Taylor1-4/+7
dynamic section, if there is one. * elf-bfd.h (struct elf_size_info): Add swap_dyn_in field. (bfd_elf32_swap_dyn_in): Change type of second parameter to PTR. (bfd_elf64_swap_dyn_in): Likewise. * elfcode.h (elf_swap_dyn_in): Change type of second parameter to PTR. (NAME(_bfd_elf,size_info)): Initialize swap_dyn_in field.
1995-12-01 * libbfd.c (bfd_malloc, bfd_realloc): New functions.Ian Lance Taylor1-10/+4
(bfd_zmalloc): Return PTR, not char *. Take size_t, not bfd_size_type. * libbfd-in.h (bfd_malloc, bfd_realloc): Declare. (bfd_zmalloc): Change declaration. * libbfd.h: Rebuild. * Many files: Use bfd_malloc and bfd_realloc rather than malloc and realloc. Don't set bfd_error_no_memory if they fail.
1995-11-29 * opncls.c (bfd_alloc_by_size_t): Set bfd_error_no_memory ifIan Lance Taylor1-18/+33
obstack_alloc fails. (bfd_alloc_finish): Set bfd_error_no_memory if obstack_finish fails. * libbfd.c (bfd_zmalloc): Set bfd_error_no_memory if malloc fails. * Many files: don't set bfd_error_no_memory if one of the above routines fails.
1995-10-31 * libelf.h: Rename to elf-bfd.h to avoid conflict withFred Fish1-2/+2
systems that have a system <libelf.h>. * Makefile.in: Globally replace libelf.h with elf-bfd.h. * bfd.c, elf.c, elf32-arc.c, elf32-gen.c, elf32-hppa.c, elf32-hppa.h, elf32-i386.c, elf32-i860.c, elf32-m68k.c, elf32-m88k.c, elf32-mips.c, elf32-ppc.c, elf32-sparc.c, elf64-gen.c, elf64-sparc.c, elfcode.h, elflink.c, elfxx-target.h: Include elf-bfd.h rather than libelf.h. * elfxx-target.h: Change libelf.h reference to elf-bfd.h.
1995-09-08 * elfcode.h (align_file_position): Remove; not used.Ian Lance Taylor1-14/+5
1995-07-12fix some compilation warnings from sun ccKen Raeburn1-8/+8
1995-07-06Added new files elflink.c, elflink.h, elfcore.h.Ken Raeburn1-5768/+48
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data structure to elfcode.h with some misc data and callback functions. Added a pointer to that structure to the target back end data. More work can be done here. Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or _bfd_elf. Updated most call sites, sometimes defined some macros. Moved some dynamic linking support code from m68k, sparc, i386 to common files, using target back end flags to control behavior. More work can probably be done here too. Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h, elflink.h, or elflink.c. Now elfcode.h contains only .o and executable support, plus #includes of elfcore.h and elflink.h. Much of the contents of these other header files can probably still be moved from the .h files to the .c files, to get compiled only once. Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized variables, in generic and cpu-specific code.
1995-07-04 * elfcode.h (NAME(bfd_elf,record_link_assignment)): Add provideIan Lance Taylor1-1/+11
argument. * bfd-in.h (bfd_elf32_record_link_assignment): Update prototype. (bfd_elf64_record_link_assignment): Likewise. * bfd-in2.h: Rebuild. PR 7164.
1995-07-04 * libelf.h (struct elf_link_hash_table): Add needed field. RemoveIan Lance Taylor1-55/+81
saw_needed field. * elfcode.h (elf_link_add_object_symbols): If elf_dt_needed_name is an empty string, don't make a DT_NEEDED entry in the output file. Record all DT_NEEDED entries found in input dynamic objects. (elf_link_output_extsym): Don't check saw_needed when issuing warnings. * elf.c (_bfd_elf_link_hash_table_init): Initialize needed, not saw_needed. (bfd_elf_get_needed_list): New function. * bfd-in.h (struct bfd_elf_link_needed_list): Define. (bfd_elf_get_needed_list): Define. * bfd-in2.h: Rebuild. PR 7083.
1995-07-03 * bfd.c (enum bfd_error): Define bfd_error_no_armap.Ian Lance Taylor1-1/+1
(bfd_errmsgs): Add string for bfd_error_no_armap. * bfd-in2.h: Rebuild. * ecoff.c (ecoff_link_add_archive_symbols): If an archive has no armap, set bfd_error_no_armap rather than bfd_error_no_symbols. * elfcode.h (elf_link_add_archive_symbols): Likewise. * linker.c (_bfd_generic_link_add_archive_symbols): Likewise.
1995-07-03 * elfcode.h (elf_link_add_object_symbols): Permit common andIan Lance Taylor1-19/+24
indirect symbols in weakdefs BFD_ASSERT. * elf32-i386.c (elf_i386_adjust_dynamic_symbol): Simplify BFD_ASSERT to permit some legal, but odd, cases. * elf32-sparc.c (elf32_sparc_adjust_dynamic_symbol): Likewise. * elf32-m68k.c (elf_m68k_adjust_dynamic_symbol): Likewise.
1995-06-09 * elfcode.h (elf_sort_hdrs): Rewrite to be symmetrical.Steve Chamberlain1-13/+15
1995-06-08* elfcode.h (elf_fake_sections): Permit .scommon or COMMON sections as randomKen Raeburn1-78/+227
SHT_NOBITS sections, in case a linker script is strange.
1995-03-07 * elfcode.h (elf_sort_hdrs): Check SHT_NOBITS before checkingIan Lance Taylor1-13/+9
sh_size.
1995-03-07 * elfcode.h (elf_sort_hdrs): Keep SHT_NOBITS sections afterDavid Edelsohn1-3/+20
!SHT_NOBITS ones.
1995-02-08 * linker.c (generic_link_check_archive_element): Allocate commonIan Lance Taylor1-2/+2
symbol information structure. Don't bother to check for common symbol size overflow. (_bfd_generic_link_add_one_symbol): Likewise. * aoutx.h (aout_link_check_ar_symbols): Likewise. * linker.c (generic_link_check_archive_element): Adjust references to common symbol information for new structure. (_bfd_generic_link_add_one_symbol): Likewise. * aoutx.h (aout_link_check_ar_symbols): Likewise. (aout_link_add_symbols): Likewise. * ecoff.c (ecoff_link_add_externals): Likewise. * elfcode.h (elf_link_add_object_symbols): Likewise. (elf_link_output_extsym): Likewise. * sunos.c (sunos_add_one_symbol): Likewise.
1995-02-08elfcode.h (elf_sort_hdrs): Put SHT_NOBITS sections after !SHT_NOBITS.David Edelsohn1-2/+3
1995-02-06 * libelf.h (struct elf_link_hash_table): Add saw_needed field.Ian Lance Taylor1-2/+33
* elfcode.h (elf_link_add_object_symbols): Set saw_needed if DT_NEEDED seen in .dynamic section. (elf_link_output_extsym): Warn if an undefined symbol is only referenced from a dynamic object, and not making a shared object, and saw_needed is false. * elf.c (_bfd_elf_link_hash_table_init): Initialize saw_needed.
1995-02-06 * libelf.h (ELF_LINK_HASH_DEFINED_WEAK): Don't define.Ian Lance Taylor1-14/+1
* elfcode.h (elf_link_add_object_symbols): Don't clear or set ELF_LINK_HASH_DEFINED_WEAK. (elf_link_output_extsym): Don't check ELF_LINK_HASH_DEFINED_WEAK.
1995-02-06 Distinguish a weak defined symbol from a regular defined symbol.Ian Lance Taylor1-32/+153
* linker.c (enum link_action): Add DEFW. (link_action): Add bfd_link_hash_defweak column. (_bfd_generic_link_add_one_symbol): Add DEFW case. Handle bfd_link_hash_defweak in a few other cases. * Many files (bfd_link_hash_undefweak): Renamed from bfd_link_hash_weak. * aoutx.h (aout_link_write_symbols): Handle bfd_link_hash_defweak. (aout_link_write_other_symbol): Likewise. (aout_link_input_section_std): Likewise. (aout_link_input_section_ext): Likewise. * bout.c (get_value): Likewise. * coff-a29k.c (coff_a29k_relocate_section): Likewise. * coff-alpha.c (alpha_convert_external_reloc): Likewise. (alpha_relocate_section): Likewise. * coff-mips.c (mips_relocate_section): Likewise. (mips_relax_section): Likewise. (bfd_mips_ecoff_create_embedded_relocs): Likewise. * cofflink.c (coff_write_global_sym): Likewise. (_bfd_coff_generic_relocate_section): Likewise. * ecoff.c (ecoff_link_add_externals): Likewise. (ecoff_link_write_external): LIkewise. * elf32-hppa.c (elf32_hppa_relocate_section): Likewise. (elf32_hppa_size_stubs): Likewise. * elf32-i386.c (elf_i386_adjust_dynamic_symbol): Likewise. (elf_i386_relocate_section): Likewise. (elf_i386_finish_dynamic_symbol): Likewise. * elf32-mips.c (mips_elf_output_extsym): Likewise. (mips_elf_relocate_section): Likewise. * elf32-sparc.c (elf32_sparc_adjust_dynamic_symbol): Likewise. (elf32_sparc_relocate_section): Likewise. * elfcode.h (elf_link_add_object_symbols): Likewise. (elf_adjust_dynamic_symbol): Likewise. (elf_bfd_final_link): Likewise. (elf_link_output_extsym): Likewise. * i386linux.c (linux_add_one_symbol): Likewise. (linux_tally_symbols): Likewise. (linux_finish_dynamic_link): Likewise. * linker.c (_bfd_generic_link_output_symbols): Likewise. (set_symbol_from_hash): Likewise. * reloc16.c (bfd_coff_reloc16_get_value): Likewise. (bfd_perform_slip): Likewise. * sunos.c (sunos_add_one_symbol): Likewise. (sunos_scan_std_relocs): Likewise. (sunos_scan_ext_relocs): Likewise. (sunos_scan_dynamic_symbol): Likewise. (sunos_write_dynamic_symbol): Likewise.
1995-01-31 * elfcode.h (map_program_segments): Add sorted_hdrs parameter.Ian Lance Taylor1-5/+15
Search through it rather than through unsorted section headers. (assign_file_positions_except_relocs): Pass sorted_hdrs to map_program_segments.
1995-01-28 * elfcode.h (elf_link_add_object_symbols): Use *sym_hash insteadIan Lance Taylor1-2/+2
of h if we might not be doing an ELF link.
1995-01-27 * elfcode.h (elf_sort_hdrs): Correct SHF_ALLOC test.Ian Lance Taylor1-1/+3
(assign_file_positions_except_relocs): Free sorted_hdrs.
1995-01-26 * elfcode.h (elf_link_add_object_symbols): Only examine weakdef ifIan Lance Taylor1-0/+1
we are using an ELF hash table.
1995-01-26Add new relocs for PowerPC Elf support.Michael Meissner1-1/+1
Add eabi support.
1995-01-24update copyright datesIan Lance Taylor1-2/+2
1995-01-09 * elfcode.h (elf_link_add_object_symbols): It's reasonable for noIan Lance Taylor1-1/+1
flags to be set, so don't insist otherwise.
1995-01-06 * elfcode.h (elf_slurp_symbol_table): Don't set BSF_GLOBAL for anIan Lance Taylor1-2/+10
undefined or common symbol. (elf_link_add_object_symbols): Likewise.
1994-12-20* elfcode.h (assign_file_positions_except_relocs): In assertion, force allKen Raeburn1-10/+12
values to the same type.
1994-12-15 * elfcode.h (elf_map_symbols): Only use section symbols whoseIan Lance Taylor1-1/+2
value is the start of the section.
1994-12-09 * elfcode.h (elf_bfd_link_add_symbols): If the first object in theIan Lance Taylor1-6/+34
archive is not an ELF object, pass the archive to the add_symbols entry point appropriate for the first object. From Eric Youngdale <eric@aib.com>.
1994-11-13 * elfcode.h (elf_export_symbol): Also export symbols which areIan Lance Taylor1-1/+2
referenced by a regular file.
1994-11-12 * elfcode.h (NAME(bfd_elf,size_dynamic_sections)): AddIan Lance Taylor1-39/+104
export_dynamic argument, and handle it. (elf_export_symbol): New function. * bfd-in.h (bfd_elf32_size_dynamic_sections): Update declaration. (bfd_elf64_size_dynamic_sections): Update declaration. * bfd-in2.h: Rebuild.
1994-10-31 * elfcode.h (NAME(bfd_elf,size_dynamic_sections)): Create DT_INITIan Lance Taylor1-8/+33
and DT_FINI dynamic entries based on the existence of _init and _fini symbols, not on the .init and .fini sections. This is compatible with some SVR4 linkers. (elf_bfd_final_link): Corresponding change.
1994-10-29 * linker.c (_bfd_generic_link_add_archive_symbols): It's not anIan Lance Taylor1-0/+3
error if an empty archive has no symbol table. * ecoff.c (ecoff_link_add_archive_symbols): Likewise. * elfcode.h (elf_link_add_archive_symbols): Likewise.
1994-10-27 * libelf.h (struct bfd_elf_section_data): Add field dynindx.Ian Lance Taylor1-55/+56
* elfcode.h (NAME(bfd_elf,size_dynamic_sections)): Don't finalize the .dynsym, .dynstr or .hash sections until after the backend size_dynamic_sections routine, so that it can add dynamic symbols if it wants to. * elf32-i386.c (elf_i386_adjust_dynamic_symbol): Don't define the symbol to be in the .plt section when generating a shared library if it is a defined symbol. * elf32-sparc.c (elf32_sparc_adjust_dynamic_symbol): Likewise. (elf32_sparc_size_dynamic_sections): When generating a shared library, allocate space for a dynamic symbol for each output section, storing the index in the dynindx field of the ELF section data. Adjust the other dynindx fields to account for this. (elf32_sparc_adjust_dynindx): New static function. (elf32_sparc_relocate_section): When copying a reloc into a shared library, use the original addend as appropriate. Convert an R_SPARC_32 reloc into an R_SPARC_RELATIVE reloc. Use the dynamic symbol index of the output section, not the normal symbol index. (elf32_sparc_finish_dynamic_sections): Don't die if a section does not exist when setting the value of the dynamic tags. Write out a dynamic symbol for each output section.
1994-10-21 Fix the ELF linker to not require an interpreter if no dynamicIan Lance Taylor1-135/+181
objects were seen, even when linking PIC code. * libelf.h (ELF_LINK_HASH_NEEDS_PLT): Define. (struct elf_link_hash_table): Add field dynamic_sections_created. * elfcode.h (elf_link_record_dynamic_symbol): Create dynstr if it doesn't already exist. (elf_link_add_object_symbols): Create dynamic sections based on dynamic_sections_created field, not dynobj field. Don't bother to set dynobj. (elf_link_create_dynamic_sections): If dynamic sections were already created, don't do anything. If dynobj is already set, use it; otherwise, set it to the bfd argument. Don't initialize dynsymcount. Only create dynstr if it does not exist. Set dynamic_sections_created to true. (NAME(bfd_elf,size_dynamic_sections)): Skip most of this function if no dynamic objects were seen. (elf_adjust_dynamic_symbol): If a symbol has the ELF_LINK_HASH_NEEDS_PLT flag set, let the backend adjust it. (elf_bfd_final_link): Change most decisions based on dynobj to check dynamic_sections_created instead. (elf_link_output_extsym): Only handle dynamic symbols if a dynamic object was seen. * elf.c (_bfd_elf_link_hash_table_init): Initialize new field dynamic_sections_created. Set dynsymcount to 1, not 0. * elf32-i386.c (elf_i386_create_dynamic_sections): Call elf_i386_create_got_section rather than creating the .got and .got.plt sections. (elf_i386_create_got_section): New static function. (elf_i386_check_relocs): Just call elf_i386_create_got_section if a GOT table is needed, not bfd_elf32_link_create_dynamic_sections. Only create the .rel.got section, and only make space for a reloc, for a global symbol or when generating a shared object. For a R_386_PLT32 reloc, just set the ELF_LINK_HASH_NEEDS_PLT flag. (elf_i386_adjust_dynamic_symbol): Rework initial assertion to permit ELF_LINK_HASH_NEEDS_PLT non dynamic symbols. Create a procedure linkage table entry for such symbols. But, if no dynamic objects were seen, never create a PLT entry. (elf_i386_size_dynamic_sections): If no dynamic objects were seen, skip most of this function, and force the size of the .rel.got section to zero. (elf_i386_relocate_section): For a R_386_GOT32 reloc against a global symbol when no dynamic object was seen, initialize the contents of the .got section. For a R_386_GOT32 against a local symbol, only create a R_386_RELATIVE reloc when generating a shared object. Treat a R_386_PLT32 reloc against a symbol for which we did not create a PLT entry as a R_386_PC32 reloc. (elf_i386_finish_dynamic_sections): Only fiddle with the dynamic entries and the PLT if we saw a dynamic object. * elf32-sparc.c (elf_sparc_howto_table): Fix R_SPARC_PC22 by setting rightshift to 10. Fix R_SPARC_WPLT20 by setting rightshift to 2, size to 2, bitsize to 30, and dst_mask to 0x3fffffff. (elf32_sparc_create_dynamic_sections): Don't set the size of the .plt section. Call elf32_sparc_create_got_section rather than creating the .got section. (elf32_sparc_check_relocs): Call elf32_sparc_create_got_section if a GOT table is needed, not bfd_elf32_link_create_dynamic_sections. Only create the .rela.got section, and only make space for a reloc, for a global symbol or when generating a shared object. Set the alignment of the .rela.got section to 2. For a R_SPARC_WPLT30 reloc, just set the ELF_LINK_HASH_NEEDS_PLT flag. (elf32_sparc_adjust_dynamic_symbol): Rework initial assertion to permit ELF_LINK_HASH_NEDS_PLT non dynamic symbols. Create a procedure linkage table for such symbols. But, if no dynamic objects were seen, never create a PLT entry. Initialize the size of the .plt section. (elf32_sparc_size_dynamic_sections): If no dynamic objects were seen, skip most of this function, and force the size of the .rela.got section to zero. Strip empty reloc sections, and strip an empty .plt section. (elf32_sparc_relocate_section): For a GOT reloc against a global symbol when no dynamic object was seen, initialize the contents of the .got section. For a GOT reloc against a local symbol, only create a R_SPARC_RELATIVE reloc when generating a shared object. Treat a R_SPARC_WPLT30 reloc against a symbol for which we did not create a PLT entry as a R_SPARC_WDISP30 reloc. (elf32_sparc_finish_dynamic_sections): Only fiddle with the dynamic entries and the PLT if we saw a dynamic object.
1994-10-20 * elfcode.h (elf_map_symbols): Don't worry about section symbolsIan Lance Taylor1-82/+77
in a section not owned by any BFD. (elf_section_from_bfd_section): Separate out loop which calls backend routine. Check bfd_section and call the backend routine even for a section not owned by any BFD. * elf32-mips.c (mips_elf_section_from_bfd_section): Handle .acommon section.
1994-10-17 Use a hash table when writing out ELF symbol names.Ian Lance Taylor1-160/+173
* elfcode.h (elf_stringtab_init): New static function. (bfd_new_strtab, bfd_add_to_strtab, bfd_add_2_to_strtab): Remove. Change all callers to use elf_stringtab_init or _bfd_stringtab_add, and get stringtab lengths using _bfd_stringtab_size. (elf_fake_sections): Change ignored argument to pointer to boolean, and set the boolean to true if an error occurs. If an error has already occurred, don't do anything. (assign_section_numbers): Just set sh_size, not contents. (elf_compute_section_file_positions): Pass the address of a boolean to elf_fake_sections. Pass the address of a bfd_strtab_hash to swap_out_syms. Write out the .strtab section. (prep_headers): Change shstrtab to bfd_strtab_hash. (swap_out_syms): Take a pointer to a bfd_strtab_hash as an argument. Set it to the symbol names. (NAME(bfd_elf,write_object_contents)): Write out the section header names using _bfd_stringtab_emit. (elf_debug_section): Remove first argument; get the section name via the bfd_section pointer. Change caller. (elf_bfd_final_link): Write out the symbol names using _bfd_stringtab_emit. Likewise for the .dynstr section contents. Free the symbol names at the end of the function. (elf_link_input_bfd): Remove the last argument, output_names, from relocate_section. Save the old symbol contents before calling elf_link_output_sym, and restore them afterward. * libelf.h (struct elf_link_hash_table): Change dynstr field to struct bfd_strtab_hash. (struct elf_backend_data): Remove last argument, output_names, from elf_backend_relocate_section field. (struct strtab): Don't define. (struct elf_obj_tdata): Change strtab_ptr field to struct bfd_strtab_hash. * elf32-hppa.c (elf32_hppa_relocate_section): Remove last argument, output_names. * elf32-i386.c (elf_i386_relocate_section): Likewise. * elf32-mips.c (mips_elf_relocate_section): Likewise. * elf32-sparc.c (elf32_sparc_relocate_section): Likewise.
1994-10-17 * elfcode.h (elf_swap_shdr_in): Use rawdata, not bfd_section.Ian Lance Taylor1-124/+69
Clear contents field. (bfd_section_from_shdr): In SHT_STRTAB case, check bfd_section, not rawdata. Don't set rawdata if e_shstrndx. Use bfd_section rather than rawdata in commented out code. In SHT_REL[A] case, don't bother to check elf_section_data of section returned by section_from_elf_index. (elf_fake_sections): Set bfd_section, not rawdata. Don't set size. (elf_map_symbols): Don't set elf_num_section_syms. Don't create section symbols that already exist. (assign_file_position_for_section): Use bfd_section, not rawdata. (section_from_elf_index): Just check bfd_section field. (elf_section_from_bfd_section): Likewise. (elf_debug_section): Don't print rawdata, contents, or size. (elf_link_add_object_symbols): Don't error out if section_from_elf_index returns NULL. (elf_bfd_final_link): Check return value from section_from_elf_index against NULL, not bfd_is_abs_section. (elf_link_input_bfd): Don't check section_from_elf_index return value. * libelf.h (struct elf_obj_tdata): Remove num_section_syms field. (elf_num_section_syms): Don't define. * elf.c (elf_get_str_section): Store section contents in contents field rather than rawdata field. (elf_string_from_elf_section): Likewise. (_bfd_elf_make_section_from_shdr): Store BFD section pointer in bfd_section field rather than rawdata field. * elf32-hppa.c (elf32_hppa_read_symext_info): Use bfd_section rather than rawdata. (elf32_hppa_size_stubs): Likewise. * elf32-mips.c (mips_elf_final_write_processing): Use bfd_section rathern than rawdata. (mips_elf_section_from_shdr): Likewise. (mips_elf_section_processing): Likewise. (mips_elf_section_from_bfd_section): Remove rawdata check.
1994-10-12* opncls.c (bfd_realloc): Deleted, since it's broken and fixing it would makeKen Raeburn1-0/+4
it slow. Besides, it isn't used much. * elfcode.h (elf_map_symbols): Always allocate new storage for the symbol table.
1994-10-10* cofflink.c (_bfd_coff_final_link): Cast argument to bfd_h_put_32 to correctKen Raeburn1-2/+6
type. (coff_read_string_table): Cast argument to bfd_h_get_32 to correct type. * elfcode.h (elf_link_output_extsym): Cast argument to bfd_elf_hash to correct type.
1994-09-30 * elfcode.h (elf_bfd_final_link): Remove assertion when a nonIan Lance Taylor1-1/+3
SEC_IN_MEMORY section is found in dynobj. This can happen when linking PIC compiled code.