+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
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
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;
{
/* 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. */
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
/* 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
/* 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);
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;
{
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++)
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)