From 43c40ab2d9b6b20ab3cb16e4211de4112437b380 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Tue, 8 Jul 2003 13:10:51 +0000 Subject: [PATCH] * elf-bfd.h (struct elf_obj_tdata): Move linker_section_pointers.. * elf32-ppc.c (struct ppc_elf_obj_tdata): ..to here. New. (ppc_elf_tdata): Define. (elf_local_ptr_offsets): Adjust. (ppc_elf_mkobject): New function. (bfd_elf32_mkobject): Define. --- bfd/ChangeLog | 9 ++++++++- bfd/elf-bfd.h | 4 ---- bfd/elf32-ppc.c | 28 ++++++++++++++++++++++++++-- 3 files changed, 34 insertions(+), 7 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index fe29a94b948..c5a8cc7151d 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,5 +1,12 @@ 2003-07-08 Alan Modra + * elf-bfd.h (struct elf_obj_tdata): Move linker_section_pointers.. + * elf32-ppc.c (struct ppc_elf_obj_tdata): ..to here. New. + (ppc_elf_tdata): Define. + (elf_local_ptr_offsets): Adjust. + (ppc_elf_mkobject): New function. + (bfd_elf32_mkobject): Define. + * elfcode.h (elf_object_p): Allocate tdata via _bfd_set_format. * elfcore.h (elf_core_file_p): Likewise. * section.c (bfd_section_init): Remove prototype. @@ -159,7 +166,7 @@ (elf_s390_relocate_section): Likewise. * elf64-s390.c: Same changes as for elf32-s390.c. * reloc.c: Add long displacement relocations BFD_RELOC_390_20, - BFD_RELOC_390_GOT20, BFD_RELOC_390_GOTPLT20 and + BFD_RELOC_390_GOT20, BFD_RELOC_390_GOTPLT20 and BFD_RELOC_390_TLS_GOTIE20. * bfd-in2.h: Regenerate. * libbfd.h: Likewise. diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h index f3e64c1d9cf..b118524a834 100644 --- a/bfd/elf-bfd.h +++ b/bfd/elf-bfd.h @@ -1202,10 +1202,6 @@ struct elf_obj_tdata /* Symbol version references to external objects. */ Elf_Internal_Verneed *verref; - /* A mapping from local symbols to offsets into the various linker - sections added. This is index by the symbol index. */ - void **linker_section_pointers; - /* The Irix 5 support uses two virtual sections, which represent text/data symbols defined in dynamic objects. */ asymbol *elf_data_symbol; diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c index 716ad705f16..0f38e115a7a 100644 --- a/bfd/elf32-ppc.c +++ b/bfd/elf32-ppc.c @@ -109,9 +109,32 @@ typedef struct elf_linker_section_pointers bfd_boolean written_address_p; } elf_linker_section_pointers_t; +struct ppc_elf_obj_tdata +{ + struct elf_obj_tdata elf; + + /* A mapping from local symbols to offsets into the various linker + sections added. This is index by the symbol index. */ + elf_linker_section_pointers_t **linker_section_pointers; +}; + +#define ppc_elf_tdata(bfd) \ + ((struct ppc_elf_obj_tdata *) (bfd)->tdata.any) + #define elf_local_ptr_offsets(bfd) \ - ((elf_linker_section_pointers_t **) \ - (elf_tdata (bfd)->linker_section_pointers)) + (ppc_elf_tdata (bfd)->linker_section_pointers) + +/* Override the generic function because we store some extras. */ + +static bfd_boolean +ppc_elf_mkobject (bfd *abfd) +{ + bfd_size_type amt = sizeof (struct ppc_elf_obj_tdata); + abfd->tdata.any = bfd_zalloc (abfd, amt); + if (abfd->tdata.any == NULL) + return FALSE; + return TRUE; +} /* The PPC linker needs to keep track of the number of relocs that it decides to copy as dynamic relocs in check_relocs for each symbol. @@ -6022,6 +6045,7 @@ ppc_elf_final_write_processing (bfd *abfd, bfd_boolean linker ATTRIBUTE_UNUSED) #define elf_backend_plt_header_size PLT_INITIAL_ENTRY_SIZE #define elf_backend_rela_normal 1 +#define bfd_elf32_mkobject ppc_elf_mkobject #define bfd_elf32_bfd_merge_private_bfd_data ppc_elf_merge_private_bfd_data #define bfd_elf32_bfd_relax_section ppc_elf_relax_section #define bfd_elf32_bfd_reloc_type_lookup ppc_elf_reloc_type_lookup -- 2.30.2