aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf32-sparc.c
AgeCommit message (Collapse)AuthorFilesLines
1997-03-24 * elf32-sparc.c (elf32_sparc_size_dynamic_sections): Don'tIan Lance Taylor1-15/+29
count section symbols for sections that were created by the linker, or are not allocatable or not loadable. (elf32_sparc_finish_dynamic_sections): Output output section symbols for section for which we made space for them.
1997-03-21 * elf32-sparc.c (elf32_sparc_size_dynamic_sections): If there isIan Lance Taylor1-9/+20
no .rela.plt section, don't output a DT_PLTGOT dynamic entry. Handles the case of a shared library with no function calls.
1997-01-03Fri Jan 3 16:58:31 1997 Richard Henderson <rth@tamu.edu>Ian Lance Taylor1-21/+19
elf64-alpha multiple .got rewrite: * elf-bfd.h (struct elf_backend_data): Add always_size_sections entry. (bfd_elf*_mkobject): Don't define here ... * elfxx-target.h: ... but rather here. Default always_size_sections hook to NULL. * elf.c (elf_mkobject): Rename to bfd_elf_mkobject, since that was what the #defines in elf-bfd.h transmuted it to anyway. * section.c: Add SEC_LINKER_CREATED flag. * bfd-in2.h: Rebuild. * elf32-i386.c (elf_i386_check_relocs): Add SEC_LINKER_CREATED to relocation section flags. (elf_i386_size_dynamic_sections): Use SEC_LINKER_CREATED instead of SEC_IN_MEMORY to recognize generated bits. * elf32-m68k.c (elf_m68k_check_relocs, elf_m68k_size_dynamic_sections): Likewise. * elf32-mips.c (mips_elf_final_link, mips_elf_create_dynamic_sections, mips_elf_create_compact_rel_section, mips_elf_create_got_section, mips_elf_check_relocs, mips_elf_size_dynamic_sections): Likewise. * elf32-ppc.c (ppc_elf_create_linker_section, ppc_elf_size_dynamic_sections): Likewise. * elf32-sparc.c (elf32_sparc_check_relocs, elf32_sparc_size_dynamic_sections): Likewise. * elflink.c (_bfd_elf_create_got_section): Add SEC_LINKER_CREATED to section flags. (_bfd_elf_create_dynamic_sections): Likewise. (_bfd_elf_make_linker_section_rela): Likewise. * elflink.h (elf_link_create_dynamic_sections): Likewise. (bfd_elf,size_dynamic_sections): Call the always_size_sections hook. (elf_bfd_final_link): Use SEC_LINKER_CREATED instead of SEC_IN_MEMORY to identify generated bits. (elf_link_input_bfd): Likewise. * elf64-alpha.c: Rewrite everything touching relocations.
1996-04-02 * elf-bfd.h (struct elf_link_hash_table): Add hgot field.Ian Lance Taylor1-72/+231
* elf.c (_bfd_elf_link_hash_table_init): Initialize hgot field. * elflink.c (_bfd_elf_create_got_section): Store the _GLOBAL_OFFSET_TABLE_ hash table entry in the hgot field. * elf32-sparc.c (elf32_sparc_check_relocs): If the size of the global offset table goes over 0x1000, set the value of _GLOBAL_OFFSET_TABLE_ to 0x1000 into the section. (elf32_sparc_relocate_section): Subtract the offset of _GLOBAL_OFFSET_TABLE_ when handling GOT relocations. PR 9323.
1996-01-29 * elf32-i386.c (elf_i386_relocate_section): If -Bsymbolic, whenIan Lance Taylor1-82/+59
copying relocs into a shared object, treat a defined global symbol as a local symbol. * elf32-m68k.c (elf_m68k_relocate_section): Likewise. * elf32-mips.c (mips_elf_relocate_section): Likewise. * elf32-sparc.c (elf32_sparc_relocate_section): Likewise.
1996-01-22 * archures.c (bfd_mach_sparc_v9): Renamed from bfd_mach_sparc64.David Edelsohn1-0/+165
start-sanitize-v8plus (bfd_mach_sparc_{v8plus,v8plusa}): Define. end-sanitize-v8plus (bfd_mach_sparc_v9a): Define. * bfd-in2.h: Regenerated. * aoutx.h (aout,machine_type): bfd_mach_sparc64 renamed to bfd_mach_sparc_v9. * config.bfd (sparc64-*-sysv4*,sparc64-*-solaris2*): Set targ_defvec to bfd_elf32_sparc_vec. * cpu-sparc.c (arch_info_struct): Renamed from sparc_arch_info. start-sanitize-v8plus Add v8plus{,a} support. end-sanitize-v8plus Add v9a support. start-sanitize-v8plus * elf32-sparc.h: #include "elf/sparc.h". (elf32_sparc_set_private_flags, elf32_sparc_copy_private_bfd_data, elf32_sparc_merge_private_bfd_data, elf32_sparc_object_p, elf32_sparc_final_write_processing): New functions. (bfd_elf32_bfd_set_private_flags, bfd_elf32_bfd_copy_private_bfd_data, bfd_elf32_bfd_merge_private_bfd_data, elf_backend_object_p, elf_backend_final_write_processing): Define. end-sanitize-v8plus
1996-01-20Update copyright.David Edelsohn1-1/+1
1996-01-20Oops. Forgot sanitization.David Edelsohn1-0/+2
1996-01-20 * elf32-sparc.c (ELF_MACHINE_ALT1): Define.David Edelsohn1-3/+1
1995-11-29 * opncls.c (bfd_alloc_by_size_t): Set bfd_error_no_memory ifIan Lance Taylor1-8/+2
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-11-27 * elf32-i386.c (elf_backend_plt_readonly): Set correctly, to 1.Ian Lance Taylor1-27/+57
* elf32-sparc.c (elf_backend_plt_readonly): Set correctly, to 0. PR 8513.
1995-07-07fsf address update, but not in COPYING filesKen Raeburn1-1/+1
1995-07-06Added new files elflink.c, elflink.h, elfcore.h.Ken Raeburn1-130/+11
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-03 * elfcode.h (elf_link_add_object_symbols): Permit common andIan Lance Taylor1-16/+8
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-07-03 * elf32-i386.c (elf_i386_adjust_dynamic_symbol): CorrectIan Lance Taylor1-16/+17
BFD_ASSERT to handle __start_SECNAME symbols automatically defined by the linker. * elf32-sparc.c (elf32_sparc_adjust_dynamic_symbol): Likewise. * elf32-m68k.c (elf_m68k_adjust_dynamic_symbol): Likewise.
1995-03-13 * elf32-sparc.c (elf32_sparc_size_dynamic_sections): Only writeIan Lance Taylor1-12/+27
out PLTRELSZ, PLTREL and JMPREL relocs if there is a .rela.plt section. Solaris 2.4 apparently does not handle empty reloc information correctly.
1995-01-12Change "reloc_howto_type" typedef to be "const", since all uses of it are (orKen Raeburn1-1/+1
should be) anyways.
1994-12-20 * elf32-i386.c (elf_i386_relocate_section): Correct and expand theIan Lance Taylor1-8/+42
list of cases for which relocation need not be computed. * elf32-sparc.c (elf32_sparc_relocate_section): Likewise.
1994-10-27 * libelf.h (struct bfd_elf_section_data): Add field dynindx.Ian Lance Taylor1-32/+126
* 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-21fix BFD_ASSERT callsIan Lance Taylor1-3/+3
1994-10-21 Fix the ELF linker to not require an interpreter if no dynamicIan Lance Taylor1-225/+354
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-10* elf32-sparc.c (elf_sparc_howto_table): The PC10, PC22, and WPLT30 relocationsKen Raeburn1-134/+655
are PC-relative.
1994-07-22 * aoutx.h (aout_link_check_ar_symbols): When changing a symbol toIan Lance Taylor1-44/+16
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-06-23 Preliminary support for generating shared libraries, from EricIan Lance Taylor1-8/+13
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-05-19 Add support for ELF shared libraries. Loosely based on work byIan Lance Taylor1-31/+719
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.
1993-07-20* elf32-sparc.c (elf_sparc_howto_table): Don't use "^&" beforeKen Raeburn1-24/+24
function name; it's valid without, and some compilers give warnings with it there.
1993-07-19* elf.c, elfcode.h, libelf.h: Serious reorganization.Ken Raeburn1-0/+151
Deleted `thunk' structure, merged into tdata, duplicate data eliminated. Rearranged functions, grouping by function. Broke up many functions in elfcode.h, re-ordered many parts of file writing to handle unpredictable state of section relocation table as provided by various applications. Still needs cleanup: Merge functions back together, split out data structure with only data that is used only when writing out object file. * elf.c (bfd_elf_generic_reloc): New function, taken from coff-mips.c. * elf32-sparc.c (elf_sparc_howto_table): Use it, to work around bfd_perform_relocation lossage.