case R_PPC64_TOC16_HA:
case R_PPC64_TOC16_LO_DS:
sec->has_toc_reloc = 1;
- if (h != NULL && !bfd_link_pic (info))
+ if (h != NULL && bfd_link_executable (info))
{
/* We may need a copy reloc. */
h->non_got_ref = 1;
case R_PPC64_UADDR32:
case R_PPC64_UADDR64:
case R_PPC64_TOC:
- if (h != NULL && !bfd_link_pic (info))
+ if (h != NULL && bfd_link_executable (info))
/* We may need a copy reloc. */
h->non_got_ref = 1;
dynamic library if we manage to avoid copy relocs for the
symbol. */
dodyn:
- if ((bfd_link_pic (info)
- && (must_be_dyn_reloc (info, r_type)
- || (h != NULL
- && (!SYMBOLIC_BIND (info, h)
- || h->root.type == bfd_link_hash_defweak
- || !h->def_regular))))
- || (ELIMINATE_COPY_RELOCS
- && !bfd_link_pic (info)
- && h != NULL
- && (h->root.type == bfd_link_hash_defweak
- || !h->def_regular))
+ if ((h != NULL
+ && (h->root.type == bfd_link_hash_defweak
+ || !h->def_regular))
+ || (h != NULL
+ && !bfd_link_executable (info)
+ && !SYMBOLIC_BIND (info, h))
+ || (bfd_link_pic (info)
+ && must_be_dyn_reloc (info, r_type))
|| (!bfd_link_pic (info)
&& ifunc != NULL))
{
only references to the symbol are via the global offset table.
For such cases we need not do anything here; the relocations will
be handled correctly by relocate_section. */
- if (bfd_link_pic (info))
+ if (!bfd_link_executable (info))
return TRUE;
/* If there are no references to this symbol that do not use the
return FALSE;
}
- if ((bfd_link_pic (info)
- && (must_be_dyn_reloc (info, r_type)
- || (h != NULL
- && (!SYMBOLIC_BIND (info, h)
- || h->root.type == bfd_link_hash_defweak
- || !h->def_regular))))
- || (ELIMINATE_COPY_RELOCS
- && !bfd_link_pic (info)
- && h != NULL
- && (h->root.type == bfd_link_hash_defweak
- || !h->def_regular)))
+ if ((h != NULL
+ && (h->root.type == bfd_link_hash_defweak
+ || !h->def_regular))
+ || (h != NULL
+ && !bfd_link_executable (info)
+ && !SYMBOLIC_BIND (info, h))
+ || (bfd_link_pic (info)
+ && must_be_dyn_reloc (info, r_type))
+ || (!bfd_link_pic (info)
+ && (h != NULL
+ ? h->type == STT_GNU_IFUNC
+ : ELF_ST_TYPE (sym->st_info) == STT_GNU_IFUNC)))
;
else
return TRUE;
for (gent = h->got.glist; gent != NULL; gent = gent->next)
if (!gent->is_indirect)
{
- /* Make sure this symbol is output as a dynamic symbol. */
+ /* Ensure we catch all the cases where this symbol should
+ be made dynamic. */
if (!ensure_undef_dynamic (info, h))
return FALSE;
be defined in regular objects. For the normal shared case,
discard space for relocs that have become local due to symbol
visibility changes. */
-
if (bfd_link_pic (info))
{
/* Relocs that use pc_count are those that appear on a call
if (eh->dyn_relocs != NULL)
{
- /* Make sure this symbol is output as a dynamic symbol. */
+ /* Ensure we catch all the cases where this symbol
+ should be made dynamic. */
if (!ensure_undef_dynamic (info, h))
return FALSE;
}
}
- else if (ELIMINATE_COPY_RELOCS && h->type != STT_GNU_IFUNC)
+
+ /* For a fixed position executable, discard space for
+ relocs against symbols which are not dynamic. */
+ else if (h->type != STT_GNU_IFUNC)
{
- /* For the non-pic case, discard space for relocs against
- symbols which turn out to need copy relocs or are not
- dynamic. */
if (h->dynamic_adjusted
&& !h->def_regular
&& !ELF_COMMON_DEF_P (h))
{
- /* Make sure this symbol is output as a dynamic symbol. */
+ /* Ensure we catch all the cases where this symbol
+ should be made dynamic. */
if (!ensure_undef_dynamic (info, h))
return FALSE;
+ /* But if that didn't work out, discard dynamic relocs. */
if (h->dynindx == -1)
eh->dyn_relocs = NULL;
}