summaryrefslogtreecommitdiff
path: root/bfd/elf64-ppc.h
Commit message (Collapse)AuthorAgeFilesLines
* * elflink.h (elf_gc_mark): Pass in the section whose relocs we areAlan Modra2002-07-011-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | examining to gc_mark_hook, rather than the bfd. (elf_gc_sections): Adjust. * elf-bfd.h (struct elf_backend_data <gc_mark_hook>): Likewise. * elf-m10300.c (mn10300_elf_gc_mark_hook): Likewise. * elf32-arm.h (elf32_arm_gc_mark_hook): Likewise. * elf32-avr.c (elf32_avr_gc_mark_hook): Likewise. * elf32-cris.c (cris_elf_gc_mark_hook): Likewise. * elf32-d10v.c (elf32_d10v_gc_mark_hook): Likewise. * elf32-fr30.c (fr30_elf_gc_mark_hook): Likewise. * elf32-hppa.c (elf32_hppa_gc_mark_hook): Likewise. * elf32-i386.c (elf_i386_gc_mark_hook): Likewise. * elf32-m32r.c (m32r_elf_gc_mark_hook): Likewise. * elf32-m68k.c (elf_m68k_gc_mark_hook): Likewise. * elf32-mcore.c (mcore_elf_gc_mark_hook): Likewise. * elf32-openrisc.c (openrisc_elf_gc_mark_hook): Likewise. * elf32-ppc.c (ppc_elf_gc_mark_hook): Likewise. * elf32-s390.c (elf_s390_gc_mark_hook): Likewise. * elf32-sh.c (sh_elf_gc_mark_hook): Likewise. * elf32-sparc.c (elf32_sparc_gc_mark_hook): Likewise. * elf32-v850.c (v850_elf_gc_mark_hook): Likewise. * elf32-vax.c (elf_vax_gc_mark_hook): Likewise. * elf32-xstormy16.c (xstormy16_elf_gc_mark_hook): Likewise. * elf64-mmix.c (mmix_elf_gc_mark_hook): Likewise. * elf64-ppc.c (ppc64_elf_gc_mark_hook): Likewise. * elf64-s390.c (elf_s390_gc_mark_hook): Likewise. * elf64-sh64.c (sh_elf64_gc_mark_hook): Likewise. * elfxx-mips.c (_bfd_mips_elf_gc_mark_hook): Likewise. * elfxx-mips.h (_bfd_mips_elf_gc_mark_hook): Likewise. * elf64-x86-64.c (elf64_x86_64_gc_mark_hook): Likewise. * elf32-frv.c (elf32_frv_gc_mark_hook): Likewise. Also remove redundant local sym tests. * elf64-ppc.c (struct ppc_link_hash_entry): Add is_entry. (link_hash_newfunc): Init is_entry. (ppc64_elf_copy_indirect_symbol): Copy is_entry. (ppc64_elf_link_hash_table_create): Init all_local_syms. (create_linkage_sections): Use bfd_make_section_anyway rather than bfd_make_section. (ppc64_elf_mark_entry_syms): New function. (ppc64_elf_check_relocs): Don't bother testing elf_bad_symtab. Set up opd entry to function section map. (ppc64_elf_gc_mark_hook): Special case opd section relocs, and relocs that reference the opd section. (edit_opd): New function. (ppc64_elf_size_dynamic_sections): Call get_local_syms and edit_opd. (ppc64_elf_setup_section_lists): Don't calculate htab->bfd_count here. (get_local_syms): Do so here. Exit if we already have local syms. Remove bogus comment imported from elf32-hppa.c. Don't attempt to read local syms on non-ELF input. (ppc64_elf_size_stubs): Call _bfd_elf64_link_read_relocs rather than duplicating it's function here. Adjust free of internal relocs to suit. (ppc64_elf_relocate_section): Adjust local syms in opd section. * elf64-ppc.h (ppc64_elf_mark_entry_syms): Declare. * elf32-hppa.c (elf32_hppa_size_stubs): Call _bfd_elf32_link_read_relocs rather than duplicating it's function here. Adjust free of internal relocs to suit.
* * elf64-ppc.c (ppc64_elf_addr16_ha_reloc): Delete.Alan Modra2002-05-021-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (ppc64_elf_ha_reloc): New function. (ppc64_elf_brtaken_reloc): New function. (ppc64_elf_sectoff_reloc): New function. (ppc64_elf_sectoff_ha_reloc): New function. (ppc64_elf_toc_reloc): New function. (ppc64_elf_toc_ha_reloc): New function. (ppc64_elf_toc64_reloc): New function. (ppc64_elf_unhandled_reloc): New function. (ppc64_elf_howto_raw): Use the above. <R_PPC64_RELATIVE>: Mark pc_relative, pcrel_offset. <R_PPC64_SECTOFF>: Not pc_relative or pcrel_offset. Fix dst_mask. <R_PPC64_SECTOFF_DS>: Likewise. (IS_ABSOLUTE_RELOC): Update. (struct ppc_link_hash_table): Add have_undefweak. (ppc64_elf_link_hash_table_create): Init. (func_desc_adjust): Set have_undefweak. (ppc64_elf_func_desc_adjust): Call func_desc_adjust earlier. Only add the .sfpr blr when have_undefweak. (ppc64_elf_setup_section_lists): Check hash table flavour. (ppc64_elf_next_input_section): Move output_section->owner test to ppc64elf.em. (ppc64_elf_set_toc): Rename to ppc64_elf_toc, remove info param and relocatable test. Return TOCstart and don't set elf_gp. (ppc64_elf_relocate_section): Correct BRTAKEN/BRNTAKEN branch offset calculation. Add assert on weak sym branch tweaks. * elf64-ppc.h (ppc64_elf_set_toc): Delete. (ppc64_elf_toc): Declare. (ppc64_elf_next_input_section): Update. * emultempl/ppc64elf.em (gld${EMULATION_NAME}_after_allocation): Adjust for ppc64_elf_set_toc change. #include libbfd.h. (build_section_lists): Do output_section tests here.
* * elf64-ppc.c (CROR_151515, CROR_313131): Define.Alan Modra2002-05-011-3/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (ppc64_elf_relocate_section): Use them. Don't look for plt calls on R_PPC64_ADDR24 relocs. Require a nop or no link reg on plt call branches. Correct undefined weak destination. (ppc64_elf_func_desc_adjust): Always create at least one blr in .sfpr, and correct case where either only savef* or restf* is needed. Long branch stubs, multiple stub sections. * elf64-ppc.h (ppc64_elf_setup_section_lists): Declare. (ppc64_elf_next_input_section): Declare. * elf64-ppc.c: Move linker-only prototypes. (STUB_SUFFIX): Define. (enum ppc_stub_type): New. (struct ppc_stub_hash_entry): New. (struct ppc_branch_hash_entry): New. (struct ppc_link_hash_entry): Add stub_cache, oh. (struct ppc_link_hash_table): Add stub_hash_table etc. Remove sstub. Add sbrlt, srelbrlt, has_14bit_branch, stub_iteration. Rename plt_overflow to stub_error. (ppc_stub_hash_lookup): Define. (ppc_branch_hash_lookup): Define. (stub_hash_newfunc): New function. (branch_hash_newfunc): New function. (link_hash_newfunc): Init new fields. (ppc64_elf_link_hash_table_create): Likewise. (ppc64_elf_link_hash_table_free): New function. (ppc_stub_name): New function. (ppc_get_stub_entry): New function. (ppc_add_stub): New function. (create_linkage_sections): Use bfd_make_section_anyway. Create .branch_lt and .rela.branch_lt sections. Don't create .stub. (ppc64_elf_check_relocs): Set has_14bit_branch on R_PPC64_REL14*, and set up for plt call stubs. Link func and func desc syms. (ppc64_elf_gc_sweep_hook): Handle REL14* as per REL24. (func_desc_adjust): Avoid hash lookup when func desc sym available via shortcut, and set links when processing. (ppc64_elf_hide_symbol): Likewise. (allocate_dynrelocs): Don't allocate stub section here. (ppc64_elf_size_dynamic_sections): Handle sbrlt and srelbrlt. Remove sstub code. (ppc_type_of_stub): New function. (build_one_stub): Delete. (ppc_build_one_stub): New function. (ppc_size_one_stub): New function. (ppc64_elf_setup_section_lists): New function. (ppc64_elf_next_input_section): New function. (group_sections): New function. (get_local_syms): New function. (ppc64_elf_size_stubs): Rewrite. (ppc64_elf_build_stubs): Rewrite. (ppc64_elf_relocate_section): Look up stub entry for REL24 relocs. Don't propagate REL14* to dynamic objects. Look for long branch stubs if REL14* or REL24 relocs won't reach. (bfd_elf64_bfd_link_hash_table_free): Define.
* * elflink.c (_bfd_elf_create_dynamic_sections): Don't set SEC_CODEAlan Modra2002-01-161-0/+22
when plt_not_loaded. * elf64-ppc.c (ppc64_elf_create_dynamic_sections): No need to clear .plt SEC_CODE here. Create .stub and correct .glink flags. (PLT_INITIAL_ENTRY_SIZE): Set to 24. (ppc64_elf_glink_code): Delete. (PPC64_ELF_GLINK_SIZE): Delete. (ADDIS_R12_R2, STD_R2_40R1, LD_R11_0R12, LD_R2_0R12, MTCTR_R11, BCTR, ADDIS_R12_R12_1, LD_R2_40R1, NOP, LI_R0_0, B_DOT, LIS_R0_0, ORI_R0_R0_0): Define. (PLT_CALL_STUB_SIZE, GLINK_CALL_STUB_SIZE): Define. (struct ppc_link_hash_table): Add sstub and plt_overflow. (ppc64_elf_link_hash_table_create): Init them. (ppc64_elf_check_relocs <R_PPC64_REL24>): Refcount .plt entry. Don't copy to shared lib. (ppc64_elf_check_relocs): Call bfd_set_error on errors. (ppc64_elf_gc_sweep_hook <R_PPC64_REL24>): Sweep plt refcount. (allocate_dynrelocs <plt>): Don't change function sym here. Make room for .stub and .glink code. (ppc64_elf_size_dynamic_sections): Handle .stub. Make entry for DT_PPC64_GLINK. (ppc64_elf_final_link): Rename to ppc64_elf_set_toc. Don't call bfd_elf64_bfd_final_link. (bfd_elf64_bfd_final_link): Don't define. (ppc64_elf_size_stubs): New. (build_plt_stub): New. (build_one_stub): New. (ppc64_elf_build_stubs): New. (ppc64_elf_relocate_section <toc relocs>): Remove assert. (ppc64_elf_relocate_section): Don't copy R_PPC64_REL24 relocs. (ppc64_elf_finish_dynamic_symbol): Don't build stubs here. Set DT_PPC64_GLINK entry. Tweak DT_PLTGOT, DT_JMPREL, DT_PLTRELSZ in case output sections not separate. Adjust DT_RELASZ to not include plt relocs. Set reserved got entry. Set got and plt entry size. (elf_backend_got_header_size): Set to 8. * elf64-ppc.h: New file.