* reloc.c: Add PPC and PPC64 TLS relocs.

* libbfd.h: Regenerate.
	* bfd-in2.h: Regenerate.
	* elf64-ppc.c (TP_OFFSET, DTP_OFFSET): Declare.
	(ppc64_elf_howto_raw): Add TLS howto's.  Adjust R_PPC64_NONE to be
	against a 32 bit field.
	(ppc64_elf_reloc_type_lookup): Handle TLS relocs.
	(_ppc64_elf_section_data): Add t_symndx and comments.
	(ppc64_elf_section_data): Use elf_section_data macro.
	(ppc64_elf_new_section_hook): American spelling.
	(struct got_entry, struct plt_entry): New.
	(MUST_BE_DYN_RELOC): Rename from IS_ABSOLUTE_RELOC.
	(struct ppc_stub_hash_entry): Add "addend" field.
	(struct ppc_link_hash_entry): Add "tls_type".
	(TLS_TLS, TLS_GD_LD, TLS_LD, TLS_TPREL, TLS_DTPREL,
	TLS_EXPLICIT): Define.
	(struct ppc_link_hash_table): Add tls_sec, tls_get_addr, tlsld_got.
	(link_hash_newfunc): Init new fields.
	(ppc64_elf_link_hash_table_create): Likewise.  Set init_relcount and
	init_offset to NULL.
	(ppc64_elf_copy_indirect_symbol): Copy got and plt info.  Don't call
	_bfd_elf_link_hash_copy_indirect, rather insert relevant code from
	there.
	(update_local_sym_info, update_plt_info): New functions.
	(ppc64_elf_check_relocs): Use them.  Handle TLS relocs.  Adjust GOT
	handling to use got.glist rather than got.refcount.  Likewise for PLT.
	(ppc64_elf_gc_sweep_hook): Handle TLS relocs, new GOT and PLT lists.
	(func_desc_adjust): Adjust for new PLT list.
	(ppc64_elf_adjust_dynamic_symbol): Likewise.
	(get_sym_h, get_tls_type): New functions.
	(ppc64_elf_edit_opd): Remove unused variable.  Use get_sym_h.
	(ppc64_elf_tls_optimize): New function.
	(allocate_dynrelocs): Adjust for new PLT and GOT lists.  Allocate
	TLS relocs.
	(ppc64_elf_size_dynamic_sections): Likewise.
	(ppc_type_of_stub): Adjust for new PLT list.
	(ppc_build_one_stub): Likewise.
	(ppc64_elf_size_stubs): Likewise.  Use get_sym_h.  Treat __tls_get_addr
	calls specially.
	(ppc64_elf_relocate_section): Adjust for new GOT and PLT lists.  Handle
	TLS relocs.  Report local syms using bfd_elf_local_sym_name.  Don't
	init GOT entries that have a reloc.  Generate GOT relocs here..
	(ppc64_elf_finish_dynamic_symbol): ..not here.  Adjust for PLT list.
	* elf64-ppc.h (ppc64_elf_tls_optimize): Declare.
This commit is contained in:
Alan Modra
2003-02-04 14:50:50 +00:00
parent 5255ffd3df
commit 411e1bfb66
6 changed files with 2629 additions and 471 deletions

View File

@ -1,3 +1,50 @@
2003-02-05 Alan Modra <amodra@bigpond.net.au>
* reloc.c: Add PPC and PPC64 TLS relocs.
* libbfd.h: Regenerate.
* bfd-in2.h: Regenerate.
* elf64-ppc.c (TP_OFFSET, DTP_OFFSET): Declare.
(ppc64_elf_howto_raw): Add TLS howto's. Adjust R_PPC64_NONE to be
against a 32 bit field.
(ppc64_elf_reloc_type_lookup): Handle TLS relocs.
(_ppc64_elf_section_data): Add t_symndx and comments.
(ppc64_elf_section_data): Use elf_section_data macro.
(ppc64_elf_new_section_hook): American spelling.
(struct got_entry, struct plt_entry): New.
(MUST_BE_DYN_RELOC): Rename from IS_ABSOLUTE_RELOC.
(struct ppc_stub_hash_entry): Add "addend" field.
(struct ppc_link_hash_entry): Add "tls_type".
(TLS_TLS, TLS_GD_LD, TLS_LD, TLS_TPREL, TLS_DTPREL,
TLS_EXPLICIT): Define.
(struct ppc_link_hash_table): Add tls_sec, tls_get_addr, tlsld_got.
(link_hash_newfunc): Init new fields.
(ppc64_elf_link_hash_table_create): Likewise. Set init_relcount and
init_offset to NULL.
(ppc64_elf_copy_indirect_symbol): Copy got and plt info. Don't call
_bfd_elf_link_hash_copy_indirect, rather insert relevant code from
there.
(update_local_sym_info, update_plt_info): New functions.
(ppc64_elf_check_relocs): Use them. Handle TLS relocs. Adjust GOT
handling to use got.glist rather than got.refcount. Likewise for PLT.
(ppc64_elf_gc_sweep_hook): Handle TLS relocs, new GOT and PLT lists.
(func_desc_adjust): Adjust for new PLT list.
(ppc64_elf_adjust_dynamic_symbol): Likewise.
(get_sym_h, get_tls_type): New functions.
(ppc64_elf_edit_opd): Remove unused variable. Use get_sym_h.
(ppc64_elf_tls_optimize): New function.
(allocate_dynrelocs): Adjust for new PLT and GOT lists. Allocate
TLS relocs.
(ppc64_elf_size_dynamic_sections): Likewise.
(ppc_type_of_stub): Adjust for new PLT list.
(ppc_build_one_stub): Likewise.
(ppc64_elf_size_stubs): Likewise. Use get_sym_h. Treat __tls_get_addr
calls specially.
(ppc64_elf_relocate_section): Adjust for new GOT and PLT lists. Handle
TLS relocs. Report local syms using bfd_elf_local_sym_name. Don't
init GOT entries that have a reloc. Generate GOT relocs here..
(ppc64_elf_finish_dynamic_symbol): ..not here. Adjust for PLT list.
* elf64-ppc.h (ppc64_elf_tls_optimize): Declare.
2003-02-04 Andreas Schwab <schwab@suse.de> 2003-02-04 Andreas Schwab <schwab@suse.de>
* elf32-m68k.c (elf_m68k_hash_entry): Define. * elf32-m68k.c (elf_m68k_hash_entry): Define.

View File

@ -2488,6 +2488,48 @@ to compensate for the borrow when the low bits are added. */
BFD_RELOC_PPC64_PLTGOT16_DS, BFD_RELOC_PPC64_PLTGOT16_DS,
BFD_RELOC_PPC64_PLTGOT16_LO_DS, BFD_RELOC_PPC64_PLTGOT16_LO_DS,
/* PowerPC and PowerPC64 thread-local storage relocations. */
BFD_RELOC_PPC_TLS,
BFD_RELOC_PPC_DTPMOD,
BFD_RELOC_PPC_TPREL16,
BFD_RELOC_PPC_TPREL16_LO,
BFD_RELOC_PPC_TPREL16_HI,
BFD_RELOC_PPC_TPREL16_HA,
BFD_RELOC_PPC_TPREL,
BFD_RELOC_PPC_DTPREL16,
BFD_RELOC_PPC_DTPREL16_LO,
BFD_RELOC_PPC_DTPREL16_HI,
BFD_RELOC_PPC_DTPREL16_HA,
BFD_RELOC_PPC_DTPREL,
BFD_RELOC_PPC_GOT_TLSGD16,
BFD_RELOC_PPC_GOT_TLSGD16_LO,
BFD_RELOC_PPC_GOT_TLSGD16_HI,
BFD_RELOC_PPC_GOT_TLSGD16_HA,
BFD_RELOC_PPC_GOT_TLSLD16,
BFD_RELOC_PPC_GOT_TLSLD16_LO,
BFD_RELOC_PPC_GOT_TLSLD16_HI,
BFD_RELOC_PPC_GOT_TLSLD16_HA,
BFD_RELOC_PPC_GOT_TPREL16,
BFD_RELOC_PPC_GOT_TPREL16_LO,
BFD_RELOC_PPC_GOT_TPREL16_HI,
BFD_RELOC_PPC_GOT_TPREL16_HA,
BFD_RELOC_PPC_GOT_DTPREL16,
BFD_RELOC_PPC_GOT_DTPREL16_LO,
BFD_RELOC_PPC_GOT_DTPREL16_HI,
BFD_RELOC_PPC_GOT_DTPREL16_HA,
BFD_RELOC_PPC64_TPREL16_DS,
BFD_RELOC_PPC64_TPREL16_LO_DS,
BFD_RELOC_PPC64_TPREL16_HIGHER,
BFD_RELOC_PPC64_TPREL16_HIGHERA,
BFD_RELOC_PPC64_TPREL16_HIGHEST,
BFD_RELOC_PPC64_TPREL16_HIGHESTA,
BFD_RELOC_PPC64_DTPREL16_DS,
BFD_RELOC_PPC64_DTPREL16_LO_DS,
BFD_RELOC_PPC64_DTPREL16_HIGHER,
BFD_RELOC_PPC64_DTPREL16_HIGHERA,
BFD_RELOC_PPC64_DTPREL16_HIGHEST,
BFD_RELOC_PPC64_DTPREL16_HIGHESTA,
/* IBM 370/390 relocations */ /* IBM 370/390 relocations */
BFD_RELOC_I370_D12, BFD_RELOC_I370_D12,

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
/* PowerPC64-specific support for 64-bit ELF. /* PowerPC64-specific support for 64-bit ELF.
Copyright 2002 Free Software Foundation, Inc. Copyright 2002, 2003 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library. This file is part of BFD, the Binary File Descriptor library.
@ -21,6 +21,8 @@ bfd_boolean ppc64_elf_mark_entry_syms
PARAMS ((struct bfd_link_info *)); PARAMS ((struct bfd_link_info *));
bfd_boolean ppc64_elf_edit_opd bfd_boolean ppc64_elf_edit_opd
PARAMS ((bfd *, struct bfd_link_info *)); PARAMS ((bfd *, struct bfd_link_info *));
bfd_boolean ppc64_elf_tls_optimize
PARAMS ((bfd *, struct bfd_link_info *));
bfd_vma ppc64_elf_toc bfd_vma ppc64_elf_toc
PARAMS ((bfd *)); PARAMS ((bfd *));
int ppc64_elf_setup_section_lists int ppc64_elf_setup_section_lists

View File

@ -991,6 +991,46 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
"BFD_RELOC_PPC64_TOC16_LO_DS", "BFD_RELOC_PPC64_TOC16_LO_DS",
"BFD_RELOC_PPC64_PLTGOT16_DS", "BFD_RELOC_PPC64_PLTGOT16_DS",
"BFD_RELOC_PPC64_PLTGOT16_LO_DS", "BFD_RELOC_PPC64_PLTGOT16_LO_DS",
"BFD_RELOC_PPC_TLS",
"BFD_RELOC_PPC_DTPMOD",
"BFD_RELOC_PPC_TPREL16",
"BFD_RELOC_PPC_TPREL16_LO",
"BFD_RELOC_PPC_TPREL16_HI",
"BFD_RELOC_PPC_TPREL16_HA",
"BFD_RELOC_PPC_TPREL",
"BFD_RELOC_PPC_DTPREL16",
"BFD_RELOC_PPC_DTPREL16_LO",
"BFD_RELOC_PPC_DTPREL16_HI",
"BFD_RELOC_PPC_DTPREL16_HA",
"BFD_RELOC_PPC_DTPREL",
"BFD_RELOC_PPC_GOT_TLSGD16",
"BFD_RELOC_PPC_GOT_TLSGD16_LO",
"BFD_RELOC_PPC_GOT_TLSGD16_HI",
"BFD_RELOC_PPC_GOT_TLSGD16_HA",
"BFD_RELOC_PPC_GOT_TLSLD16",
"BFD_RELOC_PPC_GOT_TLSLD16_LO",
"BFD_RELOC_PPC_GOT_TLSLD16_HI",
"BFD_RELOC_PPC_GOT_TLSLD16_HA",
"BFD_RELOC_PPC_GOT_TPREL16",
"BFD_RELOC_PPC_GOT_TPREL16_LO",
"BFD_RELOC_PPC_GOT_TPREL16_HI",
"BFD_RELOC_PPC_GOT_TPREL16_HA",
"BFD_RELOC_PPC_GOT_DTPREL16",
"BFD_RELOC_PPC_GOT_DTPREL16_LO",
"BFD_RELOC_PPC_GOT_DTPREL16_HI",
"BFD_RELOC_PPC_GOT_DTPREL16_HA",
"BFD_RELOC_PPC64_TPREL16_DS",
"BFD_RELOC_PPC64_TPREL16_LO_DS",
"BFD_RELOC_PPC64_TPREL16_HIGHER",
"BFD_RELOC_PPC64_TPREL16_HIGHERA",
"BFD_RELOC_PPC64_TPREL16_HIGHEST",
"BFD_RELOC_PPC64_TPREL16_HIGHESTA",
"BFD_RELOC_PPC64_DTPREL16_DS",
"BFD_RELOC_PPC64_DTPREL16_LO_DS",
"BFD_RELOC_PPC64_DTPREL16_HIGHER",
"BFD_RELOC_PPC64_DTPREL16_HIGHERA",
"BFD_RELOC_PPC64_DTPREL16_HIGHEST",
"BFD_RELOC_PPC64_DTPREL16_HIGHESTA",
"BFD_RELOC_I370_D12", "BFD_RELOC_I370_D12",
"BFD_RELOC_CTOR", "BFD_RELOC_CTOR",
"BFD_RELOC_ARM_PCREL_BRANCH", "BFD_RELOC_ARM_PCREL_BRANCH",

View File

@ -2392,6 +2392,89 @@ ENUMX
ENUMDOC ENUMDOC
Power(rs6000) and PowerPC relocations. Power(rs6000) and PowerPC relocations.
ENUM
BFD_RELOC_PPC_TLS
ENUMX
BFD_RELOC_PPC_DTPMOD
ENUMX
BFD_RELOC_PPC_TPREL16
ENUMX
BFD_RELOC_PPC_TPREL16_LO
ENUMX
BFD_RELOC_PPC_TPREL16_HI
ENUMX
BFD_RELOC_PPC_TPREL16_HA
ENUMX
BFD_RELOC_PPC_TPREL
ENUMX
BFD_RELOC_PPC_DTPREL16
ENUMX
BFD_RELOC_PPC_DTPREL16_LO
ENUMX
BFD_RELOC_PPC_DTPREL16_HI
ENUMX
BFD_RELOC_PPC_DTPREL16_HA
ENUMX
BFD_RELOC_PPC_DTPREL
ENUMX
BFD_RELOC_PPC_GOT_TLSGD16
ENUMX
BFD_RELOC_PPC_GOT_TLSGD16_LO
ENUMX
BFD_RELOC_PPC_GOT_TLSGD16_HI
ENUMX
BFD_RELOC_PPC_GOT_TLSGD16_HA
ENUMX
BFD_RELOC_PPC_GOT_TLSLD16
ENUMX
BFD_RELOC_PPC_GOT_TLSLD16_LO
ENUMX
BFD_RELOC_PPC_GOT_TLSLD16_HI
ENUMX
BFD_RELOC_PPC_GOT_TLSLD16_HA
ENUMX
BFD_RELOC_PPC_GOT_TPREL16
ENUMX
BFD_RELOC_PPC_GOT_TPREL16_LO
ENUMX
BFD_RELOC_PPC_GOT_TPREL16_HI
ENUMX
BFD_RELOC_PPC_GOT_TPREL16_HA
ENUMX
BFD_RELOC_PPC_GOT_DTPREL16
ENUMX
BFD_RELOC_PPC_GOT_DTPREL16_LO
ENUMX
BFD_RELOC_PPC_GOT_DTPREL16_HI
ENUMX
BFD_RELOC_PPC_GOT_DTPREL16_HA
ENUMX
BFD_RELOC_PPC64_TPREL16_DS
ENUMX
BFD_RELOC_PPC64_TPREL16_LO_DS
ENUMX
BFD_RELOC_PPC64_TPREL16_HIGHER
ENUMX
BFD_RELOC_PPC64_TPREL16_HIGHERA
ENUMX
BFD_RELOC_PPC64_TPREL16_HIGHEST
ENUMX
BFD_RELOC_PPC64_TPREL16_HIGHESTA
ENUMX
BFD_RELOC_PPC64_DTPREL16_DS
ENUMX
BFD_RELOC_PPC64_DTPREL16_LO_DS
ENUMX
BFD_RELOC_PPC64_DTPREL16_HIGHER
ENUMX
BFD_RELOC_PPC64_DTPREL16_HIGHERA
ENUMX
BFD_RELOC_PPC64_DTPREL16_HIGHEST
ENUMX
BFD_RELOC_PPC64_DTPREL16_HIGHESTA
ENUMDOC
PowerPC and PowerPC64 thread-local storage relocations.
ENUM ENUM
BFD_RELOC_I370_D12 BFD_RELOC_I370_D12
ENUMDOC ENUMDOC