* elf32-hppa.h (hppa_look_for_stub_in_section): Fix typo. Delete

unused symbols argument.

        * elf32-hppa.c (hppa_elf_stub_reloc): Accept asymbol ** rather
        than asymbol * for original target symbol.  All callers changed.
        Set reloc->sym_ptr_ptr appropriately.
        (hppa_elf_build_linker_stub): Set reloc->sym_ptr_ptr correctly.
        (hppa_elf_look_for_stubs_in_section): No longer need symbols
        argument.  Use the output symbols when canonicalizing the relocs,
        creating them if necessary.

        * linker.c (_bfd_generic_link_output_symbols): Do not rebuild/clobber
        the output symbols if they already exist.
This commit is contained in:
Jeff Law 1994-02-28 00:32:14 +00:00
parent 2e39abdb96
commit 6e58a4e5db
4 changed files with 68 additions and 19 deletions

View File

@ -1,3 +1,19 @@
Sun Feb 27 16:30:55 1994 Jeffrey A. Law (law@snake.cs.utah.edu)
* elf32-hppa.h (hppa_look_for_stub_in_section): Fix typo. Delete
unused symbols argument.
* elf32-hppa.c (hppa_elf_stub_reloc): Accept asymbol ** rather
than asymbol * for original target symbol. All callers changed.
Set reloc->sym_ptr_ptr appropriately.
(hppa_elf_build_linker_stub): Set reloc->sym_ptr_ptr correctly.
(hppa_elf_look_for_stubs_in_section): No longer need symbols
argument. Use the output symbols when canonicalizing the relocs,
creating them if necessary.
* linker.c (_bfd_generic_link_output_symbols): Do not
rebuild/clobber the output symbols if they already exist.
Sun Feb 27 15:22:36 1994 Stan Shebs (shebs@andros.cygnus.com)
* targets.c (BFD_SEND, BFD_SEND_FMT): Add debugging versions that

View File

@ -231,7 +231,7 @@ static elf32_hppa_stub_name_list * add_stub_by_name
static void hppa_elf_stub_finish PARAMS ((bfd *));
static void hppa_elf_stub_reloc
PARAMS ((elf32_hppa_stub_description *, bfd *, asymbol *, int,
PARAMS ((elf32_hppa_stub_description *, bfd *, asymbol **, int,
elf32_hppa_reloc_type));
static int hppa_elf_arg_reloc_needed_p
@ -2007,7 +2007,7 @@ static void
hppa_elf_stub_reloc (stub_desc, output_bfd, target_sym, offset, type)
elf32_hppa_stub_description *stub_desc;
bfd *output_bfd;
asymbol *target_sym;
asymbol **target_sym;
int offset;
elf32_hppa_reloc_type type;
{
@ -2047,7 +2047,7 @@ hppa_elf_stub_reloc (stub_desc, output_bfd, target_sym, offset, type)
/* Fill in the details. */
relent.address = offset;
relent.addend = 0;
relent.sym_ptr_ptr = &target_sym;
relent.sym_ptr_ptr = target_sym;
relent.howto = bfd_reloc_type_lookup (stub_desc->this_bfd, type);
/* Save it in the array of relocations for the stub section. */
@ -2191,7 +2191,13 @@ hppa_elf_build_linker_stub (abfd, output_bfd, link_info, reloc_entry,
old symbol (a function symbol) to the stub (the stub will call
the original function). */
stub_sym = stub_entry->sym;
reloc_entry->sym_ptr_ptr = &stub_sym;
reloc_entry->sym_ptr_ptr = bfd_zalloc (abfd, sizeof (asymbol **));
if (reloc_entry->sym_ptr_ptr == NULL)
{
bfd_set_error (bfd_error_no_memory);
abort ();
}
reloc_entry->sym_ptr_ptr[0] = stub_sym;
if (linker_stub_type == HPPA_STUB_LONG_CALL
|| (reloc_entry->howto->type != R_HPPA_PLABEL_32
&& (get_opcode(insn) == BLE
@ -2223,7 +2229,13 @@ hppa_elf_build_linker_stub (abfd, output_bfd, link_info, reloc_entry,
/* Redirect the original relocation from the old symbol (a function)
to the stub (the stub calls the function). */
reloc_entry->sym_ptr_ptr = &stub_sym;
reloc_entry->sym_ptr_ptr = bfd_zalloc (abfd, sizeof (asymbol **));
if (reloc_entry->sym_ptr_ptr == NULL)
{
bfd_set_error (bfd_error_no_memory);
abort ();
}
reloc_entry->sym_ptr_ptr[0] = stub_sym;
if (linker_stub_type == HPPA_STUB_LONG_CALL
|| (reloc_entry->howto->type != R_HPPA_PLABEL_32
&& (get_opcode (insn) == BLE
@ -2403,12 +2415,12 @@ hppa_elf_build_linker_stub (abfd, output_bfd, link_info, reloc_entry,
/* Long branch to the target function. */
NEW_INSTRUCTION (stub_entry, LDIL_XXX_31)
hppa_elf_stub_reloc (stub_entry->stub_desc,
abfd, target_sym,
abfd, reloc_entry->sym_ptr_ptr,
CURRENT_STUB_OFFSET (stub_entry),
R_HPPA_L21);
NEW_INSTRUCTION (stub_entry, BLE_XXX_0_31)
hppa_elf_stub_reloc (stub_entry->stub_desc,
abfd, target_sym,
abfd, reloc_entry->sym_ptr_ptr,
CURRENT_STUB_OFFSET (stub_entry),
R_HPPA_ABS_CALL_R17);
@ -2678,12 +2690,11 @@ hppa_elf_long_branch_needed_p (abfd, asec, reloc_entry, symbol, insn)
asymbol *
hppa_look_for_stubs_in_section (stub_bfd, abfd, output_bfd, asec,
syms, new_sym_cnt, link_info)
new_sym_cnt, link_info)
bfd *stub_bfd;
bfd *abfd;
bfd *output_bfd;
asection *asec;
asymbol **syms;
int *new_sym_cnt;
struct bfd_link_info *link_info;
{
@ -2702,7 +2713,25 @@ hppa_look_for_stubs_in_section (stub_bfd, abfd, output_bfd, asec,
arelent **reloc_vector
= (arelent **) alloca (asec->reloc_count * (sizeof (arelent *) + 1));
bfd_canonicalize_reloc (abfd, asec, reloc_vector, syms);
/* Make sure the canonical symbols are hanging around in a convient
location. */
if (bfd_get_outsymbols (abfd) == NULL)
{
size_t symsize;
symsize = get_symtab_upper_bound (abfd);
abfd->outsymbols = (asymbol **) bfd_alloc (abfd, symsize);
if (!abfd->outsymbols)
{
bfd_set_error (bfd_error_no_memory);
return false;
}
abfd->symcount = bfd_canonicalize_symtab (abfd, abfd->outsymbols);
}
/* Now get the relocations. */
bfd_canonicalize_reloc (abfd, asec, reloc_vector,
bfd_get_outsymbols (abfd));
/* Examine each relocation entry in this section. */
for (i = 0; i < asec->reloc_count; i++)

View File

@ -348,8 +348,8 @@ void elf_hppa_tc_symbol
elf32_hppa_reloc_type **hppa_elf_gen_reloc_type
PARAMS ((bfd *, elf32_hppa_reloc_type, int, int));
asymbol * hppa_look_for_stub_in_section
PARAMS ((bfd *, bfd *, bfd *, asection *, asymbol **,
asymbol * hppa_look_for_stubs_in_section
PARAMS ((bfd *, bfd *, bfd *, asection *,
int *, struct bfd_link_info *));
void elf_hppa_final_processing PARAMS ((void));

View File

@ -1619,15 +1619,19 @@ _bfd_generic_link_output_symbols (output_bfd, input_bfd, info, psymalloc)
asymbol **sym_ptr;
asymbol **sym_end;
symsize = get_symtab_upper_bound (input_bfd);
input_bfd->outsymbols = (asymbol **) bfd_alloc (input_bfd, symsize);
if (!input_bfd->outsymbols)
/* Do not clobber outsymbols if they have already been created. */
if (input_bfd->outsymbols == NULL)
{
bfd_set_error (bfd_error_no_memory);
return false;
symsize = get_symtab_upper_bound (input_bfd);
input_bfd->outsymbols = (asymbol **) bfd_alloc (input_bfd, symsize);
if (!input_bfd->outsymbols)
{
bfd_set_error (bfd_error_no_memory);
return false;
}
input_bfd->symcount = bfd_canonicalize_symtab (input_bfd,
input_bfd->outsymbols);
}
input_bfd->symcount = bfd_canonicalize_symtab (input_bfd,
input_bfd->outsymbols);
/* Create a filename symbol if we are supposed to. */
if (info->create_object_symbols_section != (asection *) NULL)