{
struct elf64_hppa_link_hash_entry *hh = hppa_elf_hash_entry (eh);
struct elf64_hppa_allocate_data *x = (struct elf64_hppa_allocate_data *)data;
+ struct bfd_link_info *info = (struct bfd_link_info *) x->info;
struct elf64_hppa_link_hash_table *hppa_info;
struct elf64_hppa_dyn_reloc_entry *rent;
bool dynamic_symbol, shared;
- hppa_info = hppa_link_hash_table (x->info);
+ hppa_info = hppa_link_hash_table (info);
if (hppa_info == NULL)
return false;
- dynamic_symbol = elf64_hppa_dynamic_symbol_p (eh, x->info);
- shared = bfd_link_pic (x->info);
+ dynamic_symbol = elf64_hppa_dynamic_symbol_p (eh, info);
+ shared = bfd_link_pic (info);
/* Take care of the GOT and PLT relocations. */
/* Discard relocs on undefined syms with non-default visibility. */
else if ((eh->root.type == bfd_link_hash_undefined
&& ELF_ST_VISIBILITY (eh->other) != STV_DEFAULT)
- || UNDEFWEAK_NO_DYNAMIC_RELOC (x->info, eh))
+ || UNDEFWEAK_NO_DYNAMIC_RELOC (info, eh))
hh->reloc_entries = NULL;
if (hh->reloc_entries == NULL)
return true;
- if (bfd_link_pic (x->info))
+ if (bfd_link_pic (info))
{
/* Discard space for relocs that have become local due to
symbol visibility changes. */
- if (!ensure_undef_dynamic (x->info, eh))
+ if (!ensure_undef_dynamic (info, eh))
return false;
}
for (rent = hh->reloc_entries; rent; rent = rent->next)
{
+ asection *sec = rent->sec;
+
switch (rent->type)
{
case R_PARISC_FPTR64:
/* Allocate one if we are building a shared library, or
we don't want an OPD entry. Ignore text relocations. */
- if ((hh->want_opd && !shared)
- || (rent->sec->flags & SEC_READONLY))
+ if ((hh->want_opd && !shared) || (sec->flags & SEC_READONLY))
continue;
break;
case R_PARISC_DIR64:
abort();
}
- if (discarded_section (rent->sec)
+ if (discarded_section (sec)
|| discarded_section (hppa_info->other_rel_sec))
continue;
continue;
}
+ if ((sec->flags & SEC_READONLY) != 0
+ && (info->flags & DF_TEXTREL) == 0)
+ {
+ info->flags |= DF_TEXTREL;
+ /* xgettext:c-format */
+ info->callbacks->minfo (_("%pB: dynamic relocation against `%pT'"
+ " in read-only section `%pA'\n"),
+ sec->owner, eh->root.root.string, sec);
+
+ if (bfd_link_textrel_check (info))
+ /* xgettext:c-format */
+ info->callbacks->einfo (_("%P: %pB: warning: relocation "
+ "against `%s' in read-only section "
+ "`%pA'\n"),
+ sec->owner, eh->root.root.string, sec);
+ }
+
hppa_info->other_rel_sec->size += sizeof (Elf64_External_Rela);
}
if (!add_dynamic_entry (DT_FLAGS, (info)->flags))
return false;
}
+
+ /* If we have a dynamic relocation against a readonly section,
+ we need a DT_TEXTREL entry. */
+ if (relocs && (info->flags & DF_TEXTREL) != 0)
+ {
+ if (!add_dynamic_entry (DT_TEXTREL, 0))
+ return false;
+ }
}
#undef add_dynamic_entry