if (cie->per_encoding != DW_EH_PE_omit)
{
+ struct elf_link_hash_entry *h;
bool per_binds_local;
/* Work out the address of personality routine, or at least
else
#endif
r_symndx = ELF32_R_SYM (rel->r_info);
- if (r_symndx >= cookie->locsymcount
- || ELF_ST_BIND (cookie->locsyms[r_symndx].st_info) != STB_LOCAL)
- {
- struct elf_link_hash_entry *h;
- r_symndx -= cookie->extsymoff;
- h = cookie->sym_hashes[r_symndx];
+ h = NULL;
+ if (r_symndx >= cookie->extsymoff)
+ h = elf_sym_hashes (cookie->abfd)[r_symndx - cookie->extsymoff];
+ if (h != NULL)
+ {
while (h->root.type == bfd_link_hash_indirect
|| h->root.type == bfd_link_hash_warning)
h = (struct elf_link_hash_entry *) h->root.u.i.link;
return true;
}
-static struct elf_link_hash_entry *
-get_link_hash_entry (struct elf_link_hash_entry ** sym_hashes,
- unsigned int symndx,
- unsigned int ext_sym_start)
+struct elf_link_hash_entry *
+_bfd_elf_get_link_hash_entry (struct elf_link_hash_entry **sym_hashes,
+ unsigned int symndx,
+ unsigned int ext_sym_start)
{
if (sym_hashes == NULL
/* Guard against corrupt input. See PR 32636 for an example. */
struct elf_link_hash_entry *h = sym_hashes[symndx - ext_sym_start];
- /* The hash might be empty. See PR 32641 for an example of this. */
+ /* The hash might be empty when bad_symtab. Also see PR32641. */
if (h == NULL)
return NULL;
return h;
}
-struct elf_link_hash_entry *
-_bfd_elf_get_link_hash_entry (struct elf_link_hash_entry ** sym_hashes,
- unsigned int symndx,
- Elf_Internal_Shdr * symtab_hdr)
-{
- if (symtab_hdr == NULL)
- return NULL;
-
- return get_link_hash_entry (sym_hashes, symndx, symtab_hdr->sh_info);
-}
-
static struct elf_link_hash_entry *
-get_ext_sym_hash_from_cookie (struct elf_reloc_cookie *cookie, unsigned long r_symndx)
+get_ext_sym_hash_from_cookie (struct elf_reloc_cookie *cookie,
+ unsigned int symndx)
{
- if (cookie == NULL || cookie->sym_hashes == NULL)
+ if (cookie == NULL)
return NULL;
- if (r_symndx >= cookie->locsymcount
- || ELF_ST_BIND (cookie->locsyms[r_symndx].st_info) != STB_LOCAL)
- return get_link_hash_entry (cookie->sym_hashes, r_symndx, cookie->extsymoff);
-
- return NULL;
+ return _bfd_elf_get_link_hash_entry (cookie->sym_hashes, symndx,
+ cookie->extsymoff);
}
asection *
/* It is a global symbol: set its link type
to "defined" and give it a value. */
- h = get_link_hash_entry (elf_sym_hashes (bfd_with_globals), symidx, extsymoff);
+ h = _bfd_elf_get_link_hash_entry (elf_sym_hashes (bfd_with_globals), symidx,
+ extsymoff);
if (h == NULL)
return false;
h->root.type = bfd_link_hash_defined;
{
struct elf_link_hash_entry *h;
- h = get_link_hash_entry (sym_hashes, symndx, extsymoff);
+ h = _bfd_elf_get_link_hash_entry (sym_hashes, symndx,
+ extsymoff);
if (h == NULL)
{
_bfd_error_handler
|| (elf_bad_symtab (input_bfd)
&& flinfo->sections[r_symndx] == NULL))
{
- h = get_link_hash_entry (sym_hashes, r_symndx, extsymoff);
+ h = _bfd_elf_get_link_hash_entry (sym_hashes, r_symndx,
+ extsymoff);
/* Badly formatted input files can contain relocs that
reference non-existant symbols. Check here so that
reloc to point to the global hash table entry
for this symbol. The symbol index is then
set at the end of bfd_elf_final_link. */
- rh = get_link_hash_entry (elf_sym_hashes (input_bfd),
- r_symndx, extsymoff);
+ rh = _bfd_elf_get_link_hash_entry (sym_hashes, r_symndx,
+ extsymoff);
if (rh == NULL)
{
/* FIXME: Generate an error ? */
goto error_return;
}
- h = _bfd_elf_get_link_hash_entry (sym_hashes, r_symndx, symtab_hdr);
+ h = _bfd_elf_get_link_hash_entry (sym_hashes, r_symndx,
+ symtab_hdr->sh_info);
if (X86_NEED_DYNAMIC_RELOC_TYPE_P (is_x86_64, r_type)
&& NEED_DYNAMIC_RELOCATION_P (is_x86_64, info, true, h, sec,
else
{
/* Get H and SEC for GENERATE_DYNAMIC_RELOCATION_P below. */
- h = _bfd_elf_get_link_hash_entry (sym_hashes, r_symndx, symtab_hdr);
+ h = _bfd_elf_get_link_hash_entry (sym_hashes, r_symndx,
+ symtab_hdr->sh_info);
if (h == NULL)
{
/* FIXMEL: Issue an error message ? */