binutils-gdb/bfd/elf32-ppc.h

22 lines
966 B
C
Raw Normal View History

* elf32-ppc.h: New file. * elf32-ppc.c: Include elf32-ppc.h. (NOP, CROR_151515, CROR_313131, TP_OFFSET, DTP_OFFSET): Define. (struct ppc_elf_link_hash_entry): Rename "root" to "elf". Adjust uses. Add "tls_mask" field. (TLS_GD, TLS_LD, TLS_TPREL, TLS_DTPREL, TLS_TLS, TLS_TPRELGD): Define. (struct ppc_elf_link_hash_table): Rename "root" to "elf". Adjust uses. Add got, relgot, plt, relplt, dynbss, relbss, dynsbss, relsbss, sdata, sdata2, tls_sec, tls_get_addr, tlsld_got fields. Make use of htab shortcuts throughout file. (ppc_elf_link_hash_newfunc): Init tls_mask field. (ppc_elf_link_hash_table_create): Init new fields. (ppc_elf_copy_indirect_symbol): Copy tls_mask. (ppc_elf_howto_raw): Add tls relocs. (ppc_elf_reloc_type_lookup): Handle them. (ppc_elf_unhandled_reloc): New function. (ppc_elf_create_got): Stash got section pointer in hash table, return status. Make .rela.got too. (ppc_elf_create_dynamic_sections): Stash section pointers in htab. (ppc_elf_adjust_dynamic_symbol): Only set up copy relocs when NON_GOT_REF set. Don't allocate space in .plt here.. (allocate_dynrelocs): ..do so here instead, properly ref-counting and not allocating plt entries unnecessarily. Allocate got entries here. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (ppc_elf_size_dynamic_sections): Allocate local got entries. Pass "info" during allocate_dynrelocs hash traversal. Use htab section shortcuts rather than searching for named sections. Get rid of "plt" and "strip" booleans. (update_local_sym_info, bad_shared_reloc): New functions. (ppc_elf_check_relocs): Handle TLS relocs. Move .rela.got creation to ppc_elf_create_got. Don't mark got or plt reloc syms dynamic, do so in allocate_dynreloc. Use update_local_sym_info and bad_shared_reloc. Disallow R_PPC_EMB_RELSDA, R_PPC_EMB_NADDR32, R_PPC_EMB_NADDR16, R_PPC_EMB_NADDR16_LO, R_PPC_EMB_NADDR16_HI and R_PPC_EMB_NADDR16_HA in shared libs. R_PPC_PLTREL32 is a plt reloc too. Refcount all relocs that might use a plt entry. Set NON_GOT_REF too. Enumerate all do-nothing relocs. (ppc_elf_gc_sweep_hook): Simplify removal of dynrelocs. Handle tls relocs and all plt relocs. (ppc_elf_tls_setup, ppc_elf_tls_optimize): New functions. (ppc_elf_finish_dynamic_symbol): Don't build got entries here. (ppc_elf_finish_dynamic_sections): Rewrite tag code using htab shortcuts. (ppc_elf_relocate_section): Tidy. Handle TLS relocs. Use bfd_elf_local_sym_name. Simplify unresolved reloc code. Build got entries and got relocs here. Warn on non-zero got reloc addend. Split out branch taken/not taken reloc code into a separate switch and correct offset calculation. Allow BRTAKEN/BRNTAKEN dynamic relocs. Split out HA reloc adjustments to separate switch statement. Don't warn on reloc overflow if we've already warned about undefined. Don't rebuild sym name when reporting errors. Report all possible errors from _bfd_final_link_relocate. (bfd_elf32_bfd_final_link): Don't define.
2003-02-18 07:06:17 +01:00
/* PowerPC-specific support for 64-bit ELF.
Copyright 2003 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
* bfd-in.h (_bfd_elf_tls_setup): Declare. * bfd-in2.h: Regenerate. * elf-bfd.h (struct elf_link_tls_segment): Delete. (struct elf_link_hash_table): Add tls_sec and tls_size. * elf.c (_bfd_elf_link_hash_table_init): Init tls_sec and tls_size. * elflink.c (_bfd_elf_tls_setup): New function. * elflink.h (struct elf_final_link_info): Remove first_tls_sec. (elf_bfd_final_link): Don't set first_tls_sec here. Update code saving tls segment info, round segment size up. (elf_link_output_extsym): Adjust code using tls segment info. (elf_link_input_bfd): Likewise. * elf32-i386.c (dtpoff_base, tpoff): Likewise. * elf32-s390.c (dtpoff_base, tpoff): Likewise. * elf32-sh.c (dtpoff_base, tpoff): Likewise. * elf32-sparc.c (dtpoff_base, tpoff): Likewise. * elf64-s390.c (dtpoff_base, tpoff): Likewise. * elf64-x86-64.c (dtpoff_base, tpoff): Likewise. * elfxx-ia64.c (elfNN_ia64_tprel_base): Likewise. (elfNN_ia64_dtprel_base): Likewise. * elf64-alpha.c (alpha_get_dtprel_base): Likewise. (alpha_get_tprel_base): Likewise. (struct alpha_relax_info): Remove tls_segment. (elf64_alpha_relax_got_load): Adjust invocation of alpha_get_dtprel_base and alpha_get_tprel_base. (elf64_alpha_relax_tls_get_addr): Likewise. (elf64_alpha_relax_section): Likewise. (elf64_alpha_relocate_section): Likewise. (elf64_alpha_relax_find_tls_segment): Delete. * elf32-ppc.c (struct ppc_elf_link_hash_table): Remove tls_sec. (ppc_elf_tls_setup): Call _bfd_elf_tls_setup. Return section. (ppc_elf_relocate_section): Adjust to use elf.tls_sec. * elf32-ppc.h (ppc_elf_tls_setup): Update. * elf64-ppc.c (struct ppc_link_hash_table): Remove tls_sec. (ppc64_elf_tls_setup): Call _bfd_elf_tls_setup. Return section. (ppc64_elf_tls_optimize): Adjust to use elf.tls_sec. (ppc64_elf_relocate_section): Likewise. * elf64-ppc.h (ppc64_elf_tls_setup): Update. * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Call _bfd_elf_tls_setup.
2003-11-04 07:16:39 +01:00
asection *ppc_elf_tls_setup (bfd *, struct bfd_link_info *);
bfd_boolean ppc_elf_tls_optimize (bfd *, struct bfd_link_info *);