/* We never need an opd entry for a symbol which is not
defined by this output file. */
- if (h && h->root.type == bfd_link_hash_undefined)
+ if (h && (h->root.type == bfd_link_hash_undefined
+ || h->root.u.def.section->output_section == NULL))
dyn_h->want_opd = 0;
/* If we are creating a shared library, took the address of a local
else if (x->info->shared
|| h == NULL
|| h->dynindx == -1
- || ((h->root.type == bfd_link_hash_defined
- || h->root.type == bfd_link_hash_defweak)
- && h->root.u.def.section->output_section != NULL))
+ || (h->root.type == bfd_link_hash_defined
+ || h->root.type == bfd_link_hash_defweak))
{
/* If we are creating a shared library, then we will have to
create a runtime relocation for the symbol to properly
switch (rent->type)
{
case R_PARISC_FPTR64:
- /* Allocate one iff we are not building a shared library and
- !want_opd, which by this point will be true only if we're
- actually allocating one statically in the main executable. */
+ /* Allocate one iff we are building a shared library and don't
+ want an opd entry. */
if (!x->info->shared && dyn_h->want_opd)
continue;
break;
{
struct bfd_link_info *info = (struct bfd_link_info *)data;
struct elf64_hppa_link_hash_table *hppa_info;
- struct elf_link_hash_entry *h = dyn_h->h;
+ struct elf_link_hash_entry *h = dyn_h ? dyn_h->h : NULL;
asection *sopd;
asection *sopdrel;
sopd = hppa_info->opd_sec;
sopdrel = hppa_info->opd_rel_sec;
- if (h && dyn_h && dyn_h->want_opd)
+ if (h && dyn_h->want_opd)
{
bfd_vma value;
struct bfd_link_info *info = (struct bfd_link_info *)data;
struct elf64_hppa_link_hash_table *hppa_info;
asection *sdlt, *sdltrel;
- struct elf_link_hash_entry *h = dyn_h->h;
+ struct elf_link_hash_entry *h = dyn_h ? dyn_h->h : NULL;
hppa_info = elf64_hppa_hash_table (info);
address, so there is no need to create a relocation. Just install
the proper value into the DLT, note this shortcut can not be
skipped when building a shared library. */
- if (! info->shared && h && dyn_h && dyn_h->want_dlt)
+ if (! info->shared && h && dyn_h->want_dlt)
{
bfd_vma value;
+ hppa_info->opd_sec->output_offset
+ hppa_info->opd_sec->output_section->vma);
}
- else
+ else if (h->root.u.def.section)
{
- value = (h->root.u.def.value
- + h->root.u.def.section->output_offset);
-
+ value = h->root.u.def.value + h->root.u.def.section->output_offset;
if (h->root.u.def.section->output_section)
value += h->root.u.def.section->output_section->vma;
else
value += h->root.u.def.section->vma;
}
+ else
+ /* We have an undefined function reference. */
+ value = 0;
/* We do not need to include the output offset of the DLT section
here because we are modifying the in-memory contents. */
switch (rent->type)
{
case R_PARISC_FPTR64:
- /* Allocate one iff we are not building a shared library and
- !want_opd, which by this point will be true only if we're
- actually allocating one statically in the main executable. */
+ /* Allocate one iff we are building a shared library and don't
+ want an opd entry. */
if (!info->shared && dyn_h->want_opd)
continue;
break;
We use a section symbol recorded by check_relocs as the
base symbol for the relocation. The addend is the difference
between the section symbol and the address of the .opd entry. */
- if (info->shared && rent->type == R_PARISC_FPTR64)
+ if (info->shared && rent->type == R_PARISC_FPTR64 && dyn_h->want_opd)
{
bfd_vma value, value2;