+2002-07-09 Hans-Peter Nilsson <hp@axis.com>
+
+ * elf32-cris.c (cris_elf_relocate_section): Move sanity-check for
+ NULL sym_hashes to just before use.
+ <case R_CRIS_32_GOTREL>: In test for local symbol, accept also
+ symbol with non-default visibility.
+ <case R_CRIS_32_GOTREL, case R_CRIS_32_PLT_GOTREL>: Ditto.
+ <case R_CRIS_8_PCREL, case R_CRIS_16_PCREL, case R_CRIS_32_PCREL>:
+ Ditto.
+ (cris_elf_gc_sweep_hook): Only decrease h->plt.refcount for
+ symbol with non-default visibility.
+ (cris_elf_check_relocs): At tests for local symbol before
+ increasing h->plt.refcount, also check for non-default
+ visibility. Ditto when checking for local symbol to eliminate
+ pc-relative runtime relocs.
+
2002-07-08 Alan Modra <amodra@bigpond.net.au>
* elf.c: Formatting.
sym_hashes = elf_sym_hashes (input_bfd);
relend = relocs + input_section->reloc_count;
- /* It seems this can happen with erroneous or unsupported input (mixing
- a.out and elf in an archive, for example.) */
- if (sym_hashes == NULL)
- return false;
-
sgot = NULL;
splt = NULL;
sreloc = NULL;
}
else
{
+ /* It seems this can happen with erroneous or unsupported input
+ (mixing a.out and elf in an archive, for example.) */
+ if (sym_hashes == NULL)
+ return false;
+
h = sym_hashes [r_symndx - symtab_hdr->sh_info];
while (h->root.type == bfd_link_hash_indirect
case R_CRIS_32_GOTREL:
/* This relocation must only be performed against local symbols. */
- if (h != NULL)
+ if (h != NULL && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
{
(*_bfd_error_handler)
(_("%s: relocation %s is not allowed for global symbol: `%s' from %s section"),
/* Resolve a PLT_PCREL reloc against a local symbol directly,
without using the procedure linkage table. */
- if (h == NULL)
+ if (h == NULL || ELF_ST_VISIBILITY (h->other) != STV_DEFAULT)
break;
if (h->plt.offset == (bfd_vma) -1
/* Resolve a PLT_GOTREL reloc against a local symbol directly,
without using the procedure linkage table. */
- if (h == NULL)
+ if (h == NULL || ELF_ST_VISIBILITY (h->other) != STV_DEFAULT)
break;
if (h->plt.offset == (bfd_vma) -1
case R_CRIS_16_PCREL:
case R_CRIS_32_PCREL:
/* If the symbol was local, we need no shlib-specific handling. */
- if (h == NULL)
+ if (h == NULL || ELF_ST_VISIBILITY (h->other) != STV_DEFAULT)
break;
/* Fall through. */
if (r_symndx >= symtab_hdr->sh_info)
{
h = sym_hashes[r_symndx - symtab_hdr->sh_info];
- if (h->plt.refcount > 0)
+ if (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
+ && h->plt.refcount > 0)
--h->plt.refcount;
}
break;
/* If this is a local symbol, we resolve it directly without
creating a procedure linkage table entry. */
- if (h == NULL)
+ if (h == NULL || ELF_ST_VISIBILITY (h->other) != STV_DEFAULT)
continue;
h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT;
/* Make sure a plt entry is created for this symbol if it
turns out to be a function defined by a dynamic object. */
- h->plt.refcount++;
+ if (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
+ h->plt.refcount++;
}
/* If we are creating a shared library and this is not a local
|| r_type == R_CRIS_32_PCREL)
{
/* If the symbol is local, then we can eliminate the reloc. */
- if (h == NULL)
+ if (h == NULL || ELF_ST_VISIBILITY (h->other) != STV_DEFAULT)
break;
/* If this is with -Bsymbolic and the symbol isn't weak, and