From 31bd8f254f562e84719c8b015fbd6e4fb371ab33 Mon Sep 17 00:00:00 2001 From: Jeff Law Date: Thu, 24 Jun 1999 20:01:44 +0000 Subject: [PATCH] =?utf8?q?=C3=B0=20=20=20=20=20=20=20=20=20*=20elf-hppa.c?= =?utf8?q?=20(elf=5Fhppa=5Ffinal=5Fwrite=5Fprocessing):=20New=20function.?= =?utf8?q?=20=20=20=20=20=20=20=20=20*=20elf32-hppa.c:=20Remove=20everythi?= =?utf8?q?ng=20related=20to=20symbol=20extension=20=20=20=20=20=20=20=20?= =?utf8?q?=20sections=20&=20records.=20=20Use=20the=20common=20elf=5Fhppa?= =?utf8?q?=5Ffinal=5Fwrite=5Fprocessing.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- bfd/elf32-hppa.c | 1235 +--------------------------------------------- 1 file changed, 18 insertions(+), 1217 deletions(-) diff --git a/bfd/elf32-hppa.c b/bfd/elf32-hppa.c index a259840fdac..192dd47fbae 100644 --- a/bfd/elf32-hppa.c +++ b/bfd/elf32-hppa.c @@ -35,50 +35,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "elf-hppa.h" -/* The internal type of a symbol table extension entry. */ -typedef unsigned long symext_entryS; - -/* The external type of a symbol table extension entry. */ -#define ELF32_PARISC_SX_SIZE (4) -#define ELF32_PARISC_SX_GET(bfd, addr) bfd_h_get_32 ((bfd), (addr)) -#define ELF32_PARISC_SX_PUT(bfd, val, addr) \ - bfd_h_put_32 ((bfd), (val), (addr)) - -/* HPPA symbol table extension entry types */ -enum elf32_hppa_symextn_types -{ - PARISC_SXT_NULL, - PARISC_SXT_SYMNDX, - PARISC_SXT_ARG_RELOC, -}; - -/* These macros compose and decompose the value of a symextn entry: - - entry_type = ELF32_PARISC_SX_TYPE(word); - entry_value = ELF32_PARISC_SX_VAL(word); - word = ELF32_PARISC_SX_WORD(type,val); */ - -#define ELF32_PARISC_SX_TYPE(p) ((p) >> 24) -#define ELF32_PARISC_SX_VAL(p) ((p) & 0xFFFFFF) -#define ELF32_PARISC_SX_WORD(type,val) (((type) << 24) + (val & 0xFFFFFF)) - -/* The following was added facilitate implementation of the .hppa_symextn - section. This section is built after the symbol table is built in the - elf_write_object_contents routine (called from bfd_close). It is built - so late because it requires information that is not known until - the symbol and string table sections have been allocated, and - the symbol table has been built. */ - -#define SYMEXTN_SECTION_NAME ".PARISC.symext" - -struct symext_chain - { - symext_entryS entry; - struct symext_chain *next; - }; - -typedef struct symext_chain symext_chainS; - /* We use three different hash tables to hold information for linking PA ELF objects. @@ -88,11 +44,7 @@ typedef struct symext_chain symext_chainS; The second is the stub hash table which is derived from the base BFD hash table. The stub hash table holds the information - necessary to build the linker stubs during a link. - - The last hash table keeps track of argument location information needed - to build hash tables. Each function with nonzero argument location - bits will have an entry in this table. */ + necessary to build the linker stubs during a link. */ /* Hash table for linker stubs. */ @@ -128,23 +80,6 @@ struct elf32_hppa_stub_hash_table }; -/* Hash table for argument location information. */ - -struct elf32_hppa_args_hash_entry -{ - /* Base hash table entry structure. */ - struct bfd_hash_entry root; - - /* The argument location bits for this entry. */ - int arg_bits; -}; - -struct elf32_hppa_args_hash_table -{ - /* The hash table itself. */ - struct bfd_hash_table root; -}; - struct elf32_hppa_link_hash_entry { struct elf_link_hash_entry root; @@ -158,9 +93,6 @@ struct elf32_hppa_link_hash_table /* The stub hash table. */ struct elf32_hppa_stub_hash_table *stub_hash_table; - /* The argument relocation bits hash table. */ - struct elf32_hppa_args_hash_table *args_hash_table; - /* A count of the number of output symbols. */ unsigned int output_symbol_count; @@ -169,32 +101,6 @@ struct elf32_hppa_link_hash_table int global_sym_defined; }; -/* FIXME. */ -#define ARGUMENTS 0 -#define RETURN_VALUE 1 - -/* The various argument relocations that may be performed. */ -typedef enum -{ - /* No relocation. */ - NO, - /* Relocate 32 bits from GR to FP register. */ - GF, - /* Relocate 64 bits from a GR pair to FP pair. */ - GD, - /* Relocate 32 bits from FP to GR. */ - FG, - /* Relocate 64 bits from FP pair to GR pair. */ - DG, -} arg_reloc_type; - -/* What is being relocated (eg which argument or the return value). */ -typedef enum -{ - ARG0, ARG1, ARG2, ARG3, RET, -} arg_reloc_location; - - /* ELF32/HPPA relocation support This file contains ELF32/HPPA relocation support as specified @@ -214,25 +120,6 @@ static unsigned long hppa_elf_relocate_insn static bfd_reloc_status_type hppa_elf_reloc PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd*, char **)); -static boolean elf32_hppa_set_section_contents - PARAMS ((bfd *, sec_ptr, PTR, file_ptr, bfd_size_type)); - -static boolean elf32_hppa_backend_symbol_table_processing - PARAMS ((bfd *, elf_symbol_type *, unsigned int)); - -static void elf32_hppa_backend_begin_write_processing - PARAMS ((bfd *, struct bfd_link_info *)); - -static void elf32_hppa_backend_final_write_processing - PARAMS ((bfd *, boolean)); - -static void add_entry_to_symext_chain - PARAMS ((bfd *, unsigned int, unsigned int, symext_chainS **, - symext_chainS **)); - -static void -elf_hppa_tc_make_sections PARAMS ((bfd *, symext_chainS *)); - static boolean hppa_elf_is_local_label_name PARAMS ((bfd *, const char *)); static boolean elf32_hppa_add_symbol_hook @@ -251,10 +138,6 @@ static struct bfd_hash_entry * elf32_hppa_stub_hash_newfunc PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *)); -static struct bfd_hash_entry * -elf32_hppa_args_hash_newfunc - PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *)); - static boolean elf32_hppa_relocate_section PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, @@ -270,71 +153,11 @@ elf32_hppa_stub_hash_table_init static boolean elf32_hppa_build_one_stub PARAMS ((struct bfd_hash_entry *, PTR)); -static boolean -elf32_hppa_read_symext_info - PARAMS ((bfd *, Elf_Internal_Shdr *, struct elf32_hppa_args_hash_table *, - Elf_Internal_Sym *)); - static unsigned int elf32_hppa_size_of_stub - PARAMS ((unsigned int, unsigned int, bfd_vma, bfd_vma, const char *)); - -static boolean elf32_hppa_arg_reloc_needed - PARAMS ((unsigned int, unsigned int, arg_reloc_type [])); + PARAMS ((bfd_vma, bfd_vma, const char *)); static void elf32_hppa_name_of_stub - PARAMS ((unsigned int, unsigned int, bfd_vma, bfd_vma, char *)); - -static boolean elf32_hppa_size_symext PARAMS ((struct bfd_hash_entry *, PTR)); - -static boolean elf32_hppa_link_output_symbol_hook - PARAMS ((bfd *, struct bfd_link_info *, const char *, - Elf_Internal_Sym *, asection *)); - -/* Where (what register type) is an argument comming from? */ -typedef enum -{ - AR_NO, - AR_GR, - AR_FR, - AR_FU, - AR_FPDBL1, - AR_FPDBL2, -} arg_location; - -/* Horizontal represents the callee's argument location information, - vertical represents caller's argument location information. Value at a - particular X,Y location represents what (if any) argument relocation - needs to be performed to make caller and callee agree. */ - -static CONST arg_reloc_type arg_mismatches[6][6] = -{ - {NO, NO, NO, NO, NO, NO}, - {NO, NO, GF, NO, GD, NO}, - {NO, FG, NO, NO, NO, NO}, - {NO, NO, NO, NO, NO, NO}, - {NO, DG, NO, NO, NO, NO}, - {NO, DG, NO, NO, NO, NO}, -}; - -/* Likewise, but reversed for the return value. */ -static CONST arg_reloc_type ret_mismatches[6][6] = -{ - {NO, NO, NO, NO, NO, NO}, - {NO, NO, FG, NO, DG, NO}, - {NO, GF, NO, NO, NO, NO}, - {NO, NO, NO, NO, NO, NO}, - {NO, GD, NO, NO, NO, NO}, - {NO, GD, NO, NO, NO, NO}, -}; - -/* Misc static crud for symbol extension records. */ -static symext_chainS *symext_rootP; -static symext_chainS *symext_lastP; -static bfd_size_type symext_chain_size; - -/* FIXME: We should be able to try this static variable! */ -static bfd_byte *symextn_contents; - + PARAMS ((bfd_vma, bfd_vma, char *)); /* For linker stub hash tables. */ #define elf32_hppa_stub_hash_lookup(table, string, create, copy) \ @@ -347,24 +170,6 @@ static bfd_byte *symextn_contents; (boolean (*) PARAMS ((struct bfd_hash_entry *, PTR))) (func), \ (info))) -/* For linker args hash tables. */ -#define elf32_hppa_args_hash_lookup(table, string, create, copy) \ - ((struct elf32_hppa_args_hash_entry *) \ - bfd_hash_lookup (&(table)->root, (string), (create), (copy))) - -#define elf32_hppa_args_hash_traverse(table, func, info) \ - (bfd_hash_traverse \ - (&(table)->root, \ - (boolean (*) PARAMS ((struct bfd_hash_entry *, PTR))) (func), \ - (info))) - -#define elf32_hppa_args_hash_table_init(table, newfunc) \ - (bfd_hash_table_init \ - (&(table)->root, \ - (struct bfd_hash_entry *(*) PARAMS ((struct bfd_hash_entry *, \ - struct bfd_hash_table *, \ - const char *))) (newfunc))) - /* For HPPA linker hash table. */ #define elf32_hppa_link_hash_lookup(table, string, create, copy, follow)\ @@ -384,10 +189,6 @@ static bfd_byte *symextn_contents; ((struct elf32_hppa_link_hash_table *) ((p)->hash)) -/* Extract specific argument location bits for WHICH from - the full argument location in AR. */ -#define EXTRACT_ARBITS(ar, which) ((ar) >> (8 - ((which) * 2))) & 3 - /* Assorted hash table functions. */ /* Initialize an entry in the stub hash table. */ @@ -442,38 +243,6 @@ elf32_hppa_stub_hash_table_init (table, stub_bfd, newfunc) return (bfd_hash_table_init (&table->root, newfunc)); } -/* Initialize an entry in the argument location hash table. */ - -static struct bfd_hash_entry * -elf32_hppa_args_hash_newfunc (entry, table, string) - struct bfd_hash_entry *entry; - struct bfd_hash_table *table; - const char *string; -{ - struct elf32_hppa_args_hash_entry *ret; - - ret = (struct elf32_hppa_args_hash_entry *) entry; - - /* Allocate the structure if it has not already been allocated by a - subclass. */ - if (ret == NULL) - ret = ((struct elf32_hppa_args_hash_entry *) - bfd_hash_allocate (table, - sizeof (struct elf32_hppa_args_hash_entry))); - if (ret == NULL) - return NULL; - - /* Call the allocation method of the superclass. */ - ret = ((struct elf32_hppa_args_hash_entry *) - bfd_hash_newfunc ((struct bfd_hash_entry *) ret, table, string)); - - /* Initialize the local fields. */ - if (ret) - ret->arg_bits = 0; - - return (struct bfd_hash_entry *) ret; -} - /* Create the derived linker hash table. The PA ELF port uses the derived hash table to keep information specific to the PA ELF linker (without using static variables). */ @@ -495,7 +264,6 @@ elf32_hppa_link_hash_table_create (abfd) return NULL; } ret->stub_hash_table = NULL; - ret->args_hash_table = NULL; ret->output_symbol_count = 0; ret->global_value = 0; ret->global_sym_defined = 0; @@ -702,13 +470,6 @@ elf32_hppa_relocate_section (output_bfd, info, input_bfd, input_section, sym_name = bfd_section_name (input_bfd, sym_sec); } - /* If args_hash_table is NULL, then we have encountered some - kind of link error (ex. undefined symbols). Do not try to - apply any relocations, continue the loop so we can notify - the user of several errors in a single attempted link. */ - if (elf32_hppa_hash_table (info)->args_hash_table == NULL) - continue; - r = elf32_hppa_bfd_final_link_relocate (howto, input_bfd, output_bfd, input_section, contents, rel->r_offset, relocation, @@ -769,25 +530,6 @@ elf32_hppa_relocate_section (output_bfd, info, input_bfd, input_section, return true; } -/* Set the contents of a particular section at a particular location. */ - -static boolean -elf32_hppa_set_section_contents (abfd, section, location, offset, count) - bfd *abfd; - sec_ptr section; - PTR location; - file_ptr offset; - bfd_size_type count; -{ - /* Ignore write requests for the symbol extension section until we've - had the chance to rebuild it ourselves. */ - if (!strcmp (section->name, ".PARISC.symextn") && !symext_chain_size) - return true; - else - return _bfd_elf_set_section_contents (abfd, section, location, - offset, count); -} - /* Actually perform a relocation. NOTE this is (mostly) superceeded by elf32_hppa_bfd_final_link_relocate which is called by the new fast linker. */ @@ -936,9 +678,6 @@ elf32_hppa_bfd_final_link_relocate (howto, input_bfd, output_bfd, { bfd_vma location; unsigned int len, caller_args, callee_args; - arg_reloc_type arg_reloc_types[5]; - struct elf32_hppa_args_hash_table *args_hash_table; - struct elf32_hppa_args_hash_entry *args_hash; char *new_name, *stub_name; /* Get the field selector right. We'll need it in a minute. */ @@ -955,8 +694,6 @@ elf32_hppa_bfd_final_link_relocate (howto, input_bfd, output_bfd, input_section->output_offset + input_section->output_section->vma); - /* Now look for the argument relocation bits associated with the - target. */ len = strlen (sym_name) + 1; if (is_local) len += 9; @@ -969,32 +706,9 @@ elf32_hppa_bfd_final_link_relocate (howto, input_bfd, output_bfd, if (is_local) sprintf (new_name + len - 10, "_%08x", (int)sym_sec); - args_hash_table = elf32_hppa_hash_table (info)->args_hash_table; - - args_hash = elf32_hppa_args_hash_lookup (args_hash_table, - new_name, false, false); - if (args_hash == NULL) - callee_args = 0; - else - callee_args = args_hash->arg_bits; - - /* If this is a CALL relocation, then get the caller's bits - from the addend. Else use the magic 0x155 value for PLABELS. - - Also we don't care about the destination (value) for PLABELS. */ - if (r_type == R_PARISC_PCREL17F) - caller_args = HPPA_R_ARG_RELOC (addend); - else - { - caller_args = 0x155; - location = value; - } - /* Any kind of linker stub needed? */ if (((int)(value - location) > 0x3ffff) - || ((int)(value - location) < (int)0xfffc0000) - || elf32_hppa_arg_reloc_needed (caller_args, callee_args, - arg_reloc_types)) + || ((int)(value - location) < (int)0xfffc0000)) { struct elf32_hppa_stub_hash_table *stub_hash_table; struct elf32_hppa_stub_hash_entry *stub_hash; @@ -1007,8 +721,7 @@ elf32_hppa_bfd_final_link_relocate (howto, input_bfd, output_bfd, stub_name = bfd_malloc (len); if (!stub_name) return bfd_reloc_notsupported; - elf32_hppa_name_of_stub (caller_args, callee_args, - location, value, stub_name); + elf32_hppa_name_of_stub (location, value, stub_name); strcat (stub_name, new_name); free (new_name); @@ -1026,7 +739,6 @@ elf32_hppa_bfd_final_link_relocate (howto, input_bfd, output_bfd, if (stub_hash != NULL) { - if (r_type == R_PARISC_PCREL17F) { unsigned long delay_insn; @@ -1098,28 +810,9 @@ elf32_hppa_bfd_final_link_relocate (howto, input_bfd, output_bfd, return bfd_reloc_dangerous; } } - else - { - /* PLABEL stuff is easy. */ - - value = (stub_hash->offset - + stub_section->output_offset - + stub_section->output_section->vma); - /* We don't need the RP adjustment for PLABELs. */ - value += 4; - if (r_type == R_PARISC_PLABEL32) - r_format = 32; - else if (r_type == R_PARISC_PLABEL21L) - r_format = 21; - else if (r_type == R_PARISC_PLABEL14R) - r_format = 14; - - r_pcrel = 0; - addend = 0; - } - } - else - return bfd_reloc_notsupported; + else + return bfd_reloc_notsupported; + } } goto do_basic_type_1; } @@ -1150,490 +843,6 @@ hppa_elf_is_local_label_name (abfd, name) return (name[0] == 'L' && name[1] == '$'); } -/* Do any backend specific processing when beginning to write an object - file. For PA ELF we need to determine the size of the symbol extension - section *before* any other output processing happens. */ - -static void -elf32_hppa_backend_begin_write_processing (abfd, info) - bfd *abfd; - struct bfd_link_info *info; -{ - unsigned int i; - asection *symextn_sec; - - /* Size up the symbol extension section. */ - if ((abfd->outsymbols == NULL - && info == NULL) - || symext_chain_size != 0) - return; - - if (info == NULL) - { - /* We were not called from the BFD ELF linker code, so we need - to examine the output BFD's outsymbols. - - Note we can not build the symbol extensions now as the symbol - map hasn't been set up. */ - for (i = 0; i < abfd->symcount; i++) - { - elf_symbol_type *symbol = (elf_symbol_type *)abfd->outsymbols[i]; - - /* Only functions ever need an entry in the symbol extension - section. */ - if (!(symbol->symbol.flags & BSF_FUNCTION)) - continue; - - /* And only if they specify the locations of their arguments. */ - if (symbol->tc_data.hppa_arg_reloc == 0) - continue; - - /* Yup. This function symbol needs an entry. */ - symext_chain_size += 2 * ELF32_PARISC_SX_SIZE; - } - } - else if (info->relocateable == true) - { - struct elf32_hppa_args_hash_table *table; - table = elf32_hppa_hash_table (info)->args_hash_table; - - /* Determine the size of the symbol extension section. */ - elf32_hppa_args_hash_traverse (table, - elf32_hppa_size_symext, - &symext_chain_size); - } - - /* Now create the section and set its size. We'll fill in the - contents later. */ - symextn_sec = bfd_get_section_by_name (abfd, SYMEXTN_SECTION_NAME); - if (symextn_sec == NULL) - symextn_sec = bfd_make_section (abfd, SYMEXTN_SECTION_NAME); - - bfd_set_section_flags (abfd, symextn_sec, - SEC_LOAD | SEC_HAS_CONTENTS | SEC_DATA); - symextn_sec->output_section = symextn_sec; - symextn_sec->output_offset = 0; - bfd_set_section_alignment (abfd, symextn_sec, 2); - bfd_set_section_size (abfd, symextn_sec, symext_chain_size); -} - -/* Called for each entry in the args location hash table. For each - entry we bump the size pointer by 2 records (16 bytes). */ - -static boolean -elf32_hppa_size_symext (gen_entry, in_args) - struct bfd_hash_entry *gen_entry; - PTR in_args; -{ - bfd_size_type *sizep = (bfd_size_type *)in_args; - - *sizep += 2 * ELF32_PARISC_SX_SIZE; - return true; -} - -/* Backend routine called by the linker for each output symbol. - - For PA ELF we use this opportunity to add an appropriate entry - to the symbol extension chain for function symbols. */ - -static boolean -elf32_hppa_link_output_symbol_hook (abfd, info, name, sym, section) - bfd *abfd; - struct bfd_link_info *info; - const char *name; - Elf_Internal_Sym *sym; - asection *section; -{ - char *new_name; - unsigned int len, index; - struct elf32_hppa_args_hash_table *args_hash_table; - struct elf32_hppa_args_hash_entry *args_hash; - - /* If the args hash table is NULL, then we've encountered an error - of some sorts (for example, an undefined symbol). In that case - we've got nothing else to do. - - NOTE: elf_link_output_symbol will abort if we return false here! */ - if (elf32_hppa_hash_table (info)->args_hash_table == NULL) - return true; - - index = elf32_hppa_hash_table (info)->output_symbol_count++; - - /* We need to look up this symbol in the args hash table to see if - it has argument relocation bits. */ - if (ELF_ST_TYPE (sym->st_info) != STT_FUNC) - return true; - - /* We know it's a function symbol of some kind. */ - len = strlen (name) + 1; - if (ELF_ST_BIND (sym->st_info) == STB_LOCAL) - len += 9; - - new_name = bfd_malloc (len); - if (new_name == NULL) - return false; - - strcpy (new_name, name); - if (ELF_ST_BIND (sym->st_info) == STB_LOCAL) - sprintf (new_name + len - 10, "_%08x", (int)section); - - /* Now that we have the unique name, we can look it up in the - args hash table. */ - args_hash_table = elf32_hppa_hash_table (info)->args_hash_table; - args_hash = elf32_hppa_args_hash_lookup (args_hash_table, new_name, - false, false); - free (new_name); - if (args_hash == NULL) - return true; - - /* We know this symbol has arg reloc bits. */ - add_entry_to_symext_chain (abfd, args_hash->arg_bits, - index, &symext_rootP, &symext_lastP); - return true; -} - -/* Perform any processing needed late in the object file writing process. - For PA ELF we build and set the contents of the symbol extension - section. */ - -static void -elf32_hppa_backend_final_write_processing (abfd, linker) - bfd *abfd; - boolean linker; -{ - asection *symextn_sec; - unsigned int i; - - /* Now build the symbol extension section. */ - if (symext_chain_size == 0) - return; - - if (! linker) - { - /* We were not called from the backend linker, so we still need - to build the symbol extension chain. - - Look at each symbol, adding the appropriate information to the - symbol extension section list as necessary. */ - for (i = 0; i < abfd->symcount; i++) - { - elf_symbol_type *symbol = (elf_symbol_type *) abfd->outsymbols[i]; - - /* Only functions ever need an entry in the symbol extension - section. */ - if (!(symbol->symbol.flags & BSF_FUNCTION)) - continue; - - /* And only if they specify the locations of their arguments. */ - if (symbol->tc_data.hppa_arg_reloc == 0) - continue; - - /* Add this symbol's information to the chain. */ - add_entry_to_symext_chain (abfd, symbol->tc_data.hppa_arg_reloc, - symbol->symbol.udata.i, &symext_rootP, - &symext_lastP); - } - } - - /* Now fill in the contents of the symbol extension section. */ - elf_hppa_tc_make_sections (abfd, symext_rootP); - - /* And attach that as the section's contents. */ - symextn_sec = bfd_get_section_by_name (abfd, SYMEXTN_SECTION_NAME); - if (symextn_sec == (asection *) 0) - abort(); - - symextn_sec->contents = (void *)symextn_contents; - - bfd_set_section_contents (abfd, symextn_sec, symextn_sec->contents, - symextn_sec->output_offset, symextn_sec->_raw_size); -} - -/* Update the symbol extention chain to include the symbol pointed to - by SYMBOLP if SYMBOLP is a function symbol. Used internally and by GAS. */ - -static void -add_entry_to_symext_chain (abfd, arg_reloc, sym_idx, symext_root, symext_last) - bfd *abfd; - unsigned int arg_reloc; - unsigned int sym_idx; - symext_chainS **symext_root; - symext_chainS **symext_last; -{ - symext_chainS *symextP; - - /* Allocate memory and initialize this entry. */ - symextP = (symext_chainS *) bfd_alloc (abfd, sizeof (symext_chainS) * 2); - if (!symextP) - abort(); /* FIXME */ - - symextP[0].entry = ELF32_PARISC_SX_WORD (PARISC_SXT_SYMNDX, sym_idx); - symextP[0].next = &symextP[1]; - - symextP[1].entry = ELF32_PARISC_SX_WORD (PARISC_SXT_ARG_RELOC, arg_reloc); - symextP[1].next = NULL; - - /* Now update the chain itself so it can be walked later to build - the symbol extension section. */ - if (*symext_root == NULL) - { - *symext_root = &symextP[0]; - *symext_last = &symextP[1]; - } - else - { - (*symext_last)->next = &symextP[0]; - *symext_last = &symextP[1]; - } -} - -/* Build the symbol extension section. */ - -static void -elf_hppa_tc_make_sections (abfd, symext_root) - bfd *abfd; - symext_chainS *symext_root; -{ - symext_chainS *symextP; - unsigned int i; - asection *symextn_sec; - - symextn_sec = bfd_get_section_by_name (abfd, SYMEXTN_SECTION_NAME); - - /* Grab some memory for the contents of the symbol extension section - itself. */ - symextn_contents = (bfd_byte *) bfd_zalloc (abfd, - symextn_sec->_raw_size); - if (!symextn_contents) - abort(); /* FIXME */ - - /* Fill in the contents of the symbol extension chain. */ - for (i = 0, symextP = symext_root; symextP; symextP = symextP->next, ++i) - ELF32_PARISC_SX_PUT (abfd, (bfd_vma) symextP->entry, - symextn_contents + i * ELF32_PARISC_SX_SIZE); - - return; -} - -/* Do some PA ELF specific work after reading in the symbol table. - In particular attach the argument relocation from the - symbol extension section to the appropriate symbols. */ - -static boolean -elf32_hppa_backend_symbol_table_processing (abfd, esyms,symcnt) - bfd *abfd; - elf_symbol_type *esyms; - unsigned int symcnt; -{ - Elf32_Internal_Shdr *symextn_hdr = - bfd_elf_find_section (abfd, SYMEXTN_SECTION_NAME); - unsigned int i, current_sym_idx = 0; - - /* If no symbol extension existed, then all symbol extension information - is assumed to be zero. */ - if (symextn_hdr == NULL) - { - for (i = 0; i < symcnt; i++) - esyms[i].tc_data.hppa_arg_reloc = 0; - return (true); - } - - /* FIXME: Why not use bfd_get_section_contents here? Also should give - memory back when we're done. */ - /* Allocate a buffer of the appropriate size for the symextn section. */ - symextn_hdr->contents = bfd_zalloc(abfd,symextn_hdr->sh_size); - if (!symextn_hdr->contents) - return false; - - /* Read in the symextn section. */ - if (bfd_seek (abfd, symextn_hdr->sh_offset, SEEK_SET) == -1) - return false; - if (bfd_read ((PTR) symextn_hdr->contents, 1, symextn_hdr->sh_size, abfd) - != symextn_hdr->sh_size) - return false; - - /* Parse entries in the symbol extension section, updating the symtab - entries as we go */ - for (i = 0; i < symextn_hdr->sh_size / ELF32_PARISC_SX_SIZE; i++) - { - symext_entryS se = - ELF32_PARISC_SX_GET (abfd, - ((unsigned char *)symextn_hdr->contents - + i * ELF32_PARISC_SX_SIZE)); - unsigned int se_value = ELF32_PARISC_SX_VAL (se); - unsigned int se_type = ELF32_PARISC_SX_TYPE (se); - - switch (se_type) - { - case PARISC_SXT_NULL: - break; - - case PARISC_SXT_SYMNDX: - if (se_value >= symcnt) - { - bfd_set_error (bfd_error_bad_value); - return (false); - } - current_sym_idx = se_value - 1; - break; - - case PARISC_SXT_ARG_RELOC: - esyms[current_sym_idx].tc_data.hppa_arg_reloc = se_value; - break; - - default: - bfd_set_error (bfd_error_bad_value); - return (false); - } - } - return (true); -} - -/* Read and attach the symbol extension information for the symbols - in INPUT_BFD to the argument location hash table. Handle locals - if DO_LOCALS is true; likewise for globals when DO_GLOBALS is true. */ - -static boolean -elf32_hppa_read_symext_info (input_bfd, symtab_hdr, args_hash_table, local_syms) - bfd *input_bfd; - Elf_Internal_Shdr *symtab_hdr; - struct elf32_hppa_args_hash_table *args_hash_table; - Elf_Internal_Sym *local_syms; -{ - asection *symextn_sec; - bfd_byte *contents; - unsigned int i, n_entries, current_index = 0; - - /* Get the symbol extension section for this BFD. If no section exists - then there's nothing to do. Likewise if the section exists, but - has no contents. */ - symextn_sec = bfd_get_section_by_name (input_bfd, SYMEXTN_SECTION_NAME); - if (symextn_sec == NULL) - return true; - - /* Done separately so we can turn off SEC_HAS_CONTENTS (see below). */ - if (symextn_sec->_raw_size == 0) - { - symextn_sec->flags &= ~SEC_HAS_CONTENTS; - return true; - } - - contents = (bfd_byte *) bfd_malloc ((size_t) symextn_sec->_raw_size); - if (contents == NULL) - return false; - - /* How gross. We turn off SEC_HAS_CONTENTS for the input symbol extension - sections to keep the generic ELF/BFD code from trying to do anything - with them. We have to undo that hack temporarily so that we can read - in the contents with the generic code. */ - symextn_sec->flags |= SEC_HAS_CONTENTS; - if (bfd_get_section_contents (input_bfd, symextn_sec, contents, - 0, symextn_sec->_raw_size) == false) - { - symextn_sec->flags &= ~SEC_HAS_CONTENTS; - free (contents); - return false; - } - - /* Gross. Turn off SEC_HAS_CONTENTS for the input symbol extension - sections (see above). */ - symextn_sec->flags &= ~SEC_HAS_CONTENTS; - - n_entries = symextn_sec->_raw_size / ELF32_PARISC_SX_SIZE; - for (i = 0; i < n_entries; i++) - { - symext_entryS entry = - ELF32_PARISC_SX_GET (input_bfd, contents + i * ELF32_PARISC_SX_SIZE); - unsigned int value = ELF32_PARISC_SX_VAL (entry); - unsigned int type = ELF32_PARISC_SX_TYPE (entry); - struct elf32_hppa_args_hash_entry *args_hash; - - switch (type) - { - case PARISC_SXT_NULL: - break; - - case PARISC_SXT_SYMNDX: - if (value >= symtab_hdr->sh_size / sizeof (Elf32_External_Sym)) - { - bfd_set_error (bfd_error_bad_value); - free (contents); - return false; - } - current_index = value; - break; - - case PARISC_SXT_ARG_RELOC: - if (current_index < symtab_hdr->sh_info) - { - Elf_Internal_Shdr *hdr; - char *new_name; - const char *sym_name; - asection *sym_sec; - unsigned int len; - - hdr = elf_elfsections (input_bfd)[local_syms[current_index].st_shndx]; - sym_sec = hdr->bfd_section; - sym_name = bfd_elf_string_from_elf_section (input_bfd, - symtab_hdr->sh_link, - local_syms[current_index].st_name); - len = strlen (sym_name) + 10; - new_name = bfd_malloc (len); - if (new_name == NULL) - { - free (contents); - return false; - } - strcpy (new_name, sym_name); - sprintf (new_name + len - 10, "_%08x", (int)sym_sec); - - /* This is a global symbol with argument location info. - We need to enter it into the hash table. */ - args_hash = elf32_hppa_args_hash_lookup (args_hash_table, - new_name, true, - true); - free (new_name); - if (args_hash == NULL) - { - free (contents); - return false; - } - args_hash->arg_bits = value; - break; - } - else if (current_index >= symtab_hdr->sh_info) - { - struct elf_link_hash_entry *h; - - current_index -= symtab_hdr->sh_info; - h = elf_sym_hashes(input_bfd)[current_index]; - /* This is a global symbol with argument location - information. We need to enter it into the hash table. */ - args_hash = elf32_hppa_args_hash_lookup (args_hash_table, - h->root.root.string, - true, true); - if (args_hash == NULL) - { - bfd_set_error (bfd_error_bad_value); - free (contents); - return false; - } - args_hash->arg_bits = value; - break; - } - else - break; - - default: - bfd_set_error (bfd_error_bad_value); - free (contents); - return false; - } - } - free (contents); - return true; -} - /* Undo the generic ELF code's subtraction of section->vma from the value of each external symbol. */ @@ -1656,117 +865,11 @@ elf32_hppa_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp) for a call from LOCATION to DESTINATION. Copy the name into STUB_NAME. */ static void -elf32_hppa_name_of_stub (caller, callee, location, destination, stub_name) - unsigned int caller, callee; +elf32_hppa_name_of_stub (location, destination, stub_name) bfd_vma location, destination; char *stub_name; { - arg_reloc_type arg_reloc_types[5]; - - if (elf32_hppa_arg_reloc_needed (caller, callee, arg_reloc_types)) - { - arg_reloc_location i; - /* Fill in the basic template. */ - strcpy (stub_name, "__XX_XX_XX_XX_XX_stub_"); - - /* Now fix the specifics. */ - for (i = ARG0; i <= RET; i++) - switch (arg_reloc_types[i]) - { - case NO: - stub_name[3 * i + 2] = 'N'; - stub_name[3 * i + 3] = 'O'; - break; - case GF: - stub_name[3 * i + 2] = 'G'; - stub_name[3 * i + 3] = 'F'; - break; - case FG: - stub_name[3 * i + 2] = 'F'; - stub_name[3 * i + 3] = 'G'; - break; - case GD: - stub_name[3 * i + 2] = 'G'; - stub_name[3 * i + 3] = 'D'; - break; - case DG: - stub_name[3 * i + 2] = 'D'; - stub_name[3 * i + 3] = 'G'; - break; - } - } - else - strcpy (stub_name, "_____long_branch_stub_"); -} - -/* Determine if an argument relocation stub is needed to perform a - call assuming the argument relocation bits for caller and callee - are in CALLER and CALLEE. Place the type of relocations (if any) - into stub_types_p. */ - -static boolean -elf32_hppa_arg_reloc_needed (caller, callee, stub_types) - unsigned int caller, callee; - arg_reloc_type stub_types[5]; -{ - /* Special case for no relocations. */ - if (caller == 0 || callee == 0) - return 0; - else - { - arg_location caller_loc[5]; - arg_location callee_loc[5]; - - /* Extract the location information for the argument and return - value on both the caller and callee sides. */ - caller_loc[ARG0] = EXTRACT_ARBITS (caller, ARG0); - callee_loc[ARG0] = EXTRACT_ARBITS (callee, ARG0); - caller_loc[ARG1] = EXTRACT_ARBITS (caller, ARG1); - callee_loc[ARG1] = EXTRACT_ARBITS (callee, ARG1); - caller_loc[ARG2] = EXTRACT_ARBITS (caller, ARG2); - callee_loc[ARG2] = EXTRACT_ARBITS (callee, ARG2); - caller_loc[ARG3] = EXTRACT_ARBITS (caller, ARG3); - callee_loc[ARG3] = EXTRACT_ARBITS (callee, ARG3); - caller_loc[RET] = EXTRACT_ARBITS (caller, RET); - callee_loc[RET] = EXTRACT_ARBITS (callee, RET); - - /* Check some special combinations. This is necessary to - deal with double precision FP arguments. */ - if (caller_loc[ARG0] == AR_FU || caller_loc[ARG1] == AR_FU) - { - caller_loc[ARG0] = AR_FPDBL1; - caller_loc[ARG1] = AR_NO; - } - if (caller_loc[ARG2] == AR_FU || caller_loc[ARG3] == AR_FU) - { - caller_loc[ARG2] = AR_FPDBL2; - caller_loc[ARG3] = AR_NO; - } - if (callee_loc[ARG0] == AR_FU || callee_loc[ARG1] == AR_FU) - { - callee_loc[ARG0] = AR_FPDBL1; - callee_loc[ARG1] = AR_NO; - } - if (callee_loc[ARG2] == AR_FU || callee_loc[ARG3] == AR_FU) - { - callee_loc[ARG2] = AR_FPDBL2; - callee_loc[ARG3] = AR_NO; - } - - /* Now look up any relocation needed for each argument and the - return value. */ - stub_types[ARG0] = arg_mismatches[caller_loc[ARG0]][callee_loc[ARG0]]; - stub_types[ARG1] = arg_mismatches[caller_loc[ARG1]][callee_loc[ARG1]]; - stub_types[ARG2] = arg_mismatches[caller_loc[ARG2]][callee_loc[ARG2]]; - stub_types[ARG3] = arg_mismatches[caller_loc[ARG3]][callee_loc[ARG3]]; - stub_types[RET] = ret_mismatches[caller_loc[RET]][callee_loc[RET]]; - - return (stub_types[ARG0] != NO - || stub_types[ARG1] != NO - || stub_types[ARG2] != NO - || stub_types[ARG3] != NO - || stub_types[RET] != NO); - } + strcpy (stub_name, "_____long_branch_stub_"); } /* Compute the size of the stub needed to call from LOCATION to DESTINATION @@ -1774,62 +877,16 @@ elf32_hppa_arg_reloc_needed (caller, callee, stub_types) CALLEE. Return zero if no stub is needed to perform such a call. */ static unsigned int -elf32_hppa_size_of_stub (callee, caller, location, destination, sym_name) - unsigned int callee, caller; +elf32_hppa_size_of_stub (location, destination, sym_name) bfd_vma location, destination; const char *sym_name; { - arg_reloc_type arg_reloc_types[5]; - - /* Determine if a long branch or argument relocation stub is needed. - If an argument relocation stub is needed, the relocation will be - stored into arg_reloc_types. */ + /* Determine if a long branch stub is needed. */ if (!(((int)(location - destination) > 0x3ffff) - || ((int)(location - destination) < (int)0xfffc0000) - || elf32_hppa_arg_reloc_needed (caller, callee, arg_reloc_types))) + || ((int)(location - destination) < (int)0xfffc0000))) return 0; - /* Some kind of stub is needed. Determine how big it needs to be. - First check for argument relocation stubs as they also handle - long calls. Then check for long calls to millicode and finally - the normal long calls. */ - if (arg_reloc_types[ARG0] != NO - || arg_reloc_types[ARG1] != NO - || arg_reloc_types[ARG2] != NO - || arg_reloc_types[ARG3] != NO - || arg_reloc_types[RET] != NO) - { - /* Some kind of argument relocation stub is needed. */ - unsigned int len = 16; - arg_reloc_location i; - - /* Each GR or FG relocation takes 2 insns, each GD or DG - relocation takes 3 insns. Plus 4 more insns for the - RP adjustment, ldil & (be | ble) and copy. */ - for (i = ARG0; i <= RET; i++) - switch (arg_reloc_types[i]) - { - case GF: - case FG: - len += 8; - break; - - case GD: - case DG: - len += 12; - break; - - default: - break; - } - - /* Extra instructions are needed if we're relocating a return value. */ - if (arg_reloc_types[RET] != NO) - len += 12; - - return len; - } - else if (!strncmp ("$$", sym_name, 2) + if (!strncmp ("$$", sym_name, 2) && strcmp ("$$dyncall", sym_name)) return 12; else @@ -1870,131 +927,7 @@ elf32_hppa_build_one_stub (gen_entry, in_args) + entry->target_section->output_offset + entry->target_section->output_section->vma); - if (strncmp ("_____long_branch_stub_", entry->root.string, 22)) - { - /* This must be an argument or return value relocation stub. */ - unsigned long insn; - arg_reloc_location i; - bfd_byte *begin_loc = loc; - - /* First the return pointer adjustment. Depending on exact calling - sequence this instruction may be skipped. */ - bfd_put_32 (stub_bfd, LDO_M4_R31_R31, loc); - loc += 4; - - /* If we are relocating a return value, then we're going to have - to return into the stub. So we have to save off the user's - return pointer into the stack at RP'. */ - if (strncmp (entry->root.string + 14, "NO", 2)) - { - bfd_put_32 (stub_bfd, STW_R31_M8R30, loc); - loc += 4; - } - - /* Iterate over the argument relocations, emitting instructions - to move them around as necessary. */ - for (i = ARG0; i <= ARG3; i++) - { - if (!strncmp (entry->root.string + 3 * i + 2, "GF", 2)) - { - bfd_put_32 (stub_bfd, STW_ARG_M16R30 | ((26 - i) << 16), loc); - bfd_put_32 (stub_bfd, FLDW_M16R30_FARG | (4 + i), loc + 4); - loc += 8; - } - else if (!strncmp (entry->root.string + 3 * i + 2, "FG", 2)) - { - bfd_put_32 (stub_bfd, FSTW_FARG_M16R30 | (4 + i), loc); - bfd_put_32 (stub_bfd, LDW_M16R30_ARG | ((26 - i) << 16), loc + 4); - loc += 8; - } - else if (!strncmp (entry->root.string + 3 * i + 2, "GD", 2)) - { - bfd_put_32 (stub_bfd, STW_ARG_M12R30 | ((26 - i) << 16), loc); - bfd_put_32 (stub_bfd, STW_ARG_M16R30 | ((25 - i) << 16), loc + 4); - bfd_put_32 (stub_bfd, FLDD_M16R30_FARG | (5 + i), loc + 8); - loc += 12; - } - else if (!strncmp (entry->root.string + 3 * i + 2, "DG", 2)) - { - bfd_put_32 (stub_bfd, FSTD_FARG_M16R30 | (5 + i), loc); - bfd_put_32 (stub_bfd, LDW_M12R30_ARG | ((26 - i) << 16), loc + 4); - bfd_put_32 (stub_bfd, LDW_M16R30_ARG | ((25 - i) << 16), loc + 8); - loc += 12; - } - } - - /* Load the high bits of the target address into %r1. */ - insn = hppa_rebuild_insn (stub_bfd, LDIL_R1, - hppa_field_adjust (sym_value, 0, e_lrsel), 21); - bfd_put_32 (stub_bfd, insn, loc); - loc += 4; - - /* If we are relocating a return value, then we're going to have - to return into the stub, then perform the return value relocation. */ - if (strncmp (entry->root.string + 14, "NO", 2)) - { - /* To return to the stub we "ble" to the target and copy the return - pointer from %r31 into %r2. */ - insn = hppa_rebuild_insn (stub_bfd, - BLE_SR4_R1, - hppa_field_adjust (sym_value, 0, - e_rrsel) >> 2, - 17); - bfd_put_32 (stub_bfd, insn, loc); - bfd_put_32 (stub_bfd, COPY_R31_R2, loc + 4); - - /* Reload the return pointer for our caller from the stack. */ - bfd_put_32 (stub_bfd, LDW_M8R30_R31, loc + 8); - loc += 12; - - /* Perform the return value relocation. */ - if (!strncmp (entry->root.string + 14, "GF", 2)) - { - bfd_put_32 (stub_bfd, STW_ARG_M16R30 | (28 << 16), loc); - bfd_put_32 (stub_bfd, FLDW_M16R30_FARG | 4, loc + 4); - loc += 8; - } - else if (!strncmp (entry->root.string + 14, "FG", 2)) - { - bfd_put_32 (stub_bfd, FSTW_FARG_M16R30 | 4, loc); - bfd_put_32 (stub_bfd, LDW_M16R30_ARG | (28 << 16), loc + 4); - loc += 8; - } - else if (!strncmp (entry->root.string + 2, "GD", 2)) - { - bfd_put_32 (stub_bfd, STW_ARG_M12R30 | (28 << 16), loc); - bfd_put_32 (stub_bfd, STW_ARG_M16R30 | (29 << 16), loc + 4); - bfd_put_32 (stub_bfd, FLDD_M16R30_FARG | 4, loc + 8); - loc += 12; - } - else if (!strncmp (entry->root.string + 2, "DG", 2)) - { - bfd_put_32 (stub_bfd, FSTD_FARG_M16R30 | 4, loc); - bfd_put_32 (stub_bfd, LDW_M12R30_ARG | (28 << 16), loc + 4); - bfd_put_32 (stub_bfd, LDW_M16R30_ARG | (29 << 16), loc + 8); - loc += 12; - } - /* Branch back to the user's code now. */ - bfd_put_32 (stub_bfd, BV_N_0_R31, loc); - loc += 4; - } - else - { - /* No return value relocation, so we can simply "be" to the - target and copy out return pointer into %r2. */ - insn = hppa_rebuild_insn (stub_bfd, BE_SR4_R1, - hppa_field_adjust (sym_value, 0, - e_rrsel) >> 2, 17); - bfd_put_32 (stub_bfd, insn, loc); - bfd_put_32 (stub_bfd, COPY_R31_R2, loc + 4); - loc += 8; - } - - /* Update the location and offsets. */ - stub_hash_table->location += (loc - begin_loc); - stub_hash_table->offset += (loc - begin_loc); - } - else + if (1) { /* Create one of two variant long branch stubs. One for $$dyncall and normal calls, the other for calls to millicode. */ @@ -2098,7 +1031,6 @@ elf32_hppa_size_stubs (stub_bfd, output_bfd, link_info) Elf32_External_Sym *ext_syms, *esym; unsigned int i, index, bfd_count = 0; struct elf32_hppa_stub_hash_table *stub_hash_table = 0; - struct elf32_hppa_args_hash_table *args_hash_table = 0; /* Create and initialize the stub hash table. */ stub_hash_table = ((struct elf32_hppa_stub_hash_table *) @@ -2110,19 +1042,8 @@ elf32_hppa_size_stubs (stub_bfd, output_bfd, link_info) elf32_hppa_stub_hash_newfunc)) goto error_return; - /* Likewise for the argument location hash table. */ - args_hash_table = ((struct elf32_hppa_args_hash_table *) - bfd_malloc (sizeof (struct elf32_hppa_args_hash_table))); - if (!args_hash_table) - goto error_return; - - if (!elf32_hppa_args_hash_table_init (args_hash_table, - elf32_hppa_args_hash_newfunc)) - goto error_return; - /* Attach the hash tables to the main hash table. */ elf32_hppa_hash_table(link_info)->stub_hash_table = stub_hash_table; - elf32_hppa_hash_table(link_info)->args_hash_table = args_hash_table; /* Count the number of input BFDs. */ for (input_bfd = link_info->input_bfds; @@ -2130,88 +1051,6 @@ elf32_hppa_size_stubs (stub_bfd, output_bfd, link_info) input_bfd = input_bfd->link_next) bfd_count++; - /* We want to read in symbol extension records only once. To do this - we need to read in the local symbols in parallel and save them for - later use; so hold pointers to the local symbols in an array. */ - all_local_syms - = (Elf_Internal_Sym **) bfd_malloc (sizeof (Elf_Internal_Sym *) - * bfd_count); - if (all_local_syms == NULL) - goto error_return; - memset (all_local_syms, 0, sizeof (Elf_Internal_Sym *) * bfd_count); - - /* Walk over all the input BFDs adding entries to the args hash table - for all the external functions. */ - for (input_bfd = link_info->input_bfds, index = 0; - input_bfd != NULL; - input_bfd = input_bfd->link_next, index++) - { - /* We'll need the symbol table in a second. */ - symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; - if (symtab_hdr->sh_info == 0) - continue; - - /* We need an array of the local symbols attached to the input bfd. - Unfortunately, we're going to have to read & swap them in. */ - local_syms - = (Elf_Internal_Sym *) bfd_malloc (symtab_hdr->sh_info - * sizeof (Elf_Internal_Sym)); - if (local_syms == NULL) - { - for (i = 0; i < bfd_count; i++) - if (all_local_syms[i]) - free (all_local_syms[i]); - free (all_local_syms); - goto error_return; - } - all_local_syms[index] = local_syms; - - ext_syms - = (Elf32_External_Sym *) bfd_malloc (symtab_hdr->sh_info - * sizeof (Elf32_External_Sym)); - if (ext_syms == NULL) - { - for (i = 0; i < bfd_count; i++) - if (all_local_syms[i]) - free (all_local_syms[i]); - free (all_local_syms); - goto error_return; - } - - if (bfd_seek (input_bfd, symtab_hdr->sh_offset, SEEK_SET) != 0 - || bfd_read (ext_syms, 1, - (symtab_hdr->sh_info - * sizeof (Elf32_External_Sym)), input_bfd) - != (symtab_hdr->sh_info * sizeof (Elf32_External_Sym))) - { - for (i = 0; i < bfd_count; i++) - if (all_local_syms[i]) - free (all_local_syms[i]); - free (all_local_syms); - free (ext_syms); - goto error_return; - } - - /* Swap the local symbols in. */ - isym = local_syms; - esym = ext_syms; - for (i = 0; i < symtab_hdr->sh_info; i++, esym++, isym++) - bfd_elf32_swap_symbol_in (input_bfd, esym, isym); - - /* Now we can free the external symbols. */ - free (ext_syms); - - if (elf32_hppa_read_symext_info (input_bfd, symtab_hdr, args_hash_table, - local_syms) == false) - { - for (i = 0; i < bfd_count; i++) - if (all_local_syms[i]) - free (all_local_syms[i]); - free (all_local_syms); - goto error_return; - } - } - /* Magic as we know the stub bfd only has one section. */ stub_sec = stub_bfd->sections; @@ -2311,11 +1150,10 @@ elf32_hppa_size_stubs (stub_bfd, output_bfd, link_info) irelaend = irela + section->reloc_count; for (; irela < irelaend; irela++) { - long r_type, callee_args, caller_args, size_of_stub; + long r_type, size_of_stub; unsigned long r_index; struct elf_link_hash_entry *hash; struct elf32_hppa_stub_hash_entry *stub_hash; - struct elf32_hppa_args_hash_entry *args_hash; Elf_Internal_Sym *sym; asection *sym_sec; const char *sym_name; @@ -2411,24 +1249,6 @@ elf32_hppa_size_stubs (stub_bfd, output_bfd, link_info) } } - args_hash = elf32_hppa_args_hash_lookup (args_hash_table, - sym_name, false, false); - - /* Get both caller and callee argument information. */ - if (args_hash == NULL) - callee_args = 0; - else - callee_args = args_hash->arg_bits; - - /* For calls get the caller's bits from the addend of - the call relocation. For PLABELS the caller's bits - are assumed to have all args & return values in general - registers (0x155). */ - if (r_type == R_PARISC_PCREL17F) - caller_args = HPPA_R_ARG_RELOC (irela->r_addend); - else - caller_args = 0x155; - /* Now determine where the call point is. */ location = (section->output_offset + section->output_section->vma @@ -2441,9 +1261,7 @@ elf32_hppa_size_stubs (stub_bfd, output_bfd, link_info) /* Determine what (if any) linker stub is needed and its size (in bytes). */ - size_of_stub = elf32_hppa_size_of_stub (callee_args, - caller_args, - location, + size_of_stub = elf32_hppa_size_of_stub (location, destination, sym_name); if (size_of_stub != 0) @@ -2470,8 +1288,7 @@ elf32_hppa_size_stubs (stub_bfd, output_bfd, link_info) free (all_local_syms); goto error_return; } - elf32_hppa_name_of_stub (caller_args, callee_args, - location, destination, stub_name); + elf32_hppa_name_of_stub (location, destination, stub_name); strcat (stub_name + 22, sym_name); /* Because sym_name was malloced above for local symbols. */ @@ -2535,11 +1352,6 @@ error_return: elf32_hppa_hash_table(link_info)->stub_hash_table = NULL; free (stub_hash_table); } - if (args_hash_table) - { - elf32_hppa_hash_table(link_info)->args_hash_table = NULL; - free (args_hash_table); - } /* Set the size of the stub section to zero since we're never going to create them. Avoids losing when we try to get its contents too. */ @@ -2553,20 +1365,9 @@ error_return: #define elf_info_to_howto elf_hppa_info_to_howto #define elf_info_to_howto_rel elf_hppa_info_to_howto_rel -/* Symbol extension stuff. */ -#define bfd_elf32_set_section_contents elf32_hppa_set_section_contents -#define elf_backend_symbol_table_processing \ - elf32_hppa_backend_symbol_table_processing -#define elf_backend_begin_write_processing \ - elf32_hppa_backend_begin_write_processing -#define elf_backend_final_write_processing \ - elf32_hppa_backend_final_write_processing - /* Stuff for the BFD linker. */ #define elf_backend_relocate_section elf32_hppa_relocate_section #define elf_backend_add_symbol_hook elf32_hppa_add_symbol_hook -#define elf_backend_link_output_symbol_hook \ - elf32_hppa_link_output_symbol_hook #define bfd_elf32_bfd_link_hash_table_create \ elf32_hppa_link_hash_table_create -- 2.30.2