ELF: Consolidate readonly_dynrelocs

All readonly_dynrelocs implementations are the same.  Consolidate them
to a single _bfd_elf_readonly_dynrelocs.

	PR ld/26067
	* elf-bfd.h (_bfd_elf_readonly_dynrelocs): New.
	* elf32-arm.c (readonly_dynrelocs): Removed.
	(maybe_set_textrel): Replace readonly_dynrelocs with
	_bfd_elf_readonly_dynrelocs.
	* elf32-csky.c (readonly_dynrelocs): Removed.
	(maybe_set_textrel): Replace readonly_dynrelocs with
	_bfd_elf_readonly_dynrelocs.
	*  elf32-hppa.c(readonly_dynrelocs): Removed.
	(alias_readonly_dynrelocs): Replace readonly_dynrelocs with
	_bfd_elf_readonly_dynrelocs.
	(maybe_set_textrel): Likewise.
	* elf32-lm32.c (readonly_dynrelocs): Removed.
	(lm32_elf_adjust_dynamic_symbol): Replace readonly_dynrelocs
	with _bfd_elf_readonly_dynrelocs.
	(maybe_set_textrel): Likewise.
	* elf32-m32r.c (readonly_dynrelocs): Removed.
	(m32r_elf_adjust_dynamic_symbol): Replace readonly_dynrelocs
	with _bfd_elf_readonly_dynrelocs.
	(maybe_set_textrel): Likewise.
	* elf32-metag.c (readonly_dynrelocs): Removed.
	(elf_metag_adjust_dynamic_symbol): Replace readonly_dynrelocs
	with _bfd_elf_readonly_dynrelocs.
	(maybe_set_textrel): Likewise.
	* elf32-microblaze.c (readonly_dynrelocs): Removed.
	(microblaze_elf_adjust_dynamic_symbol): Replace readonly_dynrelocs
	with _bfd_elf_readonly_dynrelocs.
	* elf32-nds32.c (readonly_dynrelocs): Removed.
	(nds32_elf_adjust_dynamic_symbol): Replace readonly_dynrelocs
	with _bfd_elf_readonly_dynrelocs.
	(maybe_set_textrel): Likewise.
	* elf32-or1k.c (readonly_dynrelocs): Removed.
	(or1k_elf_adjust_dynamic_symbol): Replace readonly_dynrelocs
	with _bfd_elf_readonly_dynrelocs.
	* elf32-ppc.c (readonly_dynrelocs): Removed.
	(alias_readonly_dynrelocs): Replace readonly_dynrelocs with
	_bfd_elf_readonly_dynrelocs.
	(ppc_elf_adjust_dynamic_symbol): Likewise.
	(maybe_set_textrel): Likewise.
	* elf32-s390.c (readonly_dynrelocs): Removed.
	(elf_s390_adjust_dynamic_symbol): Replace readonly_dynrelocs
	with _bfd_elf_readonly_dynrelocs.
	(maybe_set_textrel): Likewise.
	* elf32-sh.c (readonly_dynrelocs): Removed.
	(sh_elf_adjust_dynamic_symbol): Replace readonly_dynrelocs with
	_bfd_elf_readonly_dynrelocs.
	(maybe_set_textrel): Likewise.
	* elf32-tic6x.c (readonly_dynrelocs): Removed.
	(maybe_set_textrel): Replace readonly_dynrelocs with
	_bfd_elf_readonly_dynrelocs.
	* elf32-tilepro.c (readonly_dynrelocs): Removed.
	(tilepro_elf_adjust_dynamic_symbol): Replace readonly_dynrelocs
	with _bfd_elf_readonly_dynrelocs.
	(maybe_set_textrel): Likewise.
	* elf64-ppc.c (readonly_dynrelocs): Removed.
	(alias_readonly_dynrelocs): Replace readonly_dynrelocs with
	_bfd_elf_readonly_dynrelocs.
	(ppc64_elf_adjust_dynamic_symbol): Likewise.
	(maybe_set_textrel): Likewise.
	* elf64-s390.c (readonly_dynrelocs): Removed.
	(elf_s390_adjust_dynamic_symbol): Replace readonly_dynrelocs
	with _bfd_elf_readonly_dynrelocs.
	(maybe_set_textrel): Likewise.
	* elflink.c (_bfd_elf_readonly_dynrelocs): New.
	* elfnn-aarch64.c (readonly_dynrelocs): Removed.
	(maybe_set_textrel): Replace readonly_dynrelocs with
	_bfd_elf_readonly_dynrelocs.
	* elfnn-riscv.c (readonly_dynrelocs): Removed.
	(riscv_elf_adjust_dynamic_symbol): Replace readonly_dynrelocs
	with _bfd_elf_readonly_dynrelocs.
	(maybe_set_textrel): Likewise.
	* elfxx-sparc.c (readonly_dynrelocs): Removed.
	(_bfd_sparc_elf_adjust_dynamic_symbol): Replace
	readonly_dynrelocs with _bfd_elf_readonly_dynrelocs.
	(maybe_set_textrel): Likewise.
	* elfxx-tilegx.c (readonly_dynrelocs): Removed.
	(tilegx_elf_adjust_dynamic_symbol): Replace readonly_dynrelocs
	with _bfd_elf_readonly_dynrelocs.
	(maybe_set_textrel): Likewise.
	* elfxx-x86.c (readonly_dynrelocs): Removed.
	(maybe_set_textrel): Replace readonly_dynrelocs with
	_bfd_elf_readonly_dynrelocs.
	(_bfd_x86_elf_adjust_dynamic_symbol): Likewise.
This commit is contained in:
H.J. Lu 2020-06-03 07:00:55 -07:00
parent 1949ad044a
commit 5dbc8b372f
24 changed files with 145 additions and 398 deletions

View File

@ -1,3 +1,89 @@
2020-06-03 H.J. Lu <hongjiu.lu@intel.com>
PR ld/26067
* elf-bfd.h (_bfd_elf_readonly_dynrelocs): New.
* elf32-arm.c (readonly_dynrelocs): Removed.
(maybe_set_textrel): Replace readonly_dynrelocs with
_bfd_elf_readonly_dynrelocs.
* elf32-csky.c (readonly_dynrelocs): Removed.
(maybe_set_textrel): Replace readonly_dynrelocs with
_bfd_elf_readonly_dynrelocs.
* elf32-hppa.c(readonly_dynrelocs): Removed.
(alias_readonly_dynrelocs): Replace readonly_dynrelocs with
_bfd_elf_readonly_dynrelocs.
(maybe_set_textrel): Likewise.
* elf32-lm32.c (readonly_dynrelocs): Removed.
(lm32_elf_adjust_dynamic_symbol): Replace readonly_dynrelocs
with _bfd_elf_readonly_dynrelocs.
(maybe_set_textrel): Likewise.
* elf32-m32r.c (readonly_dynrelocs): Removed.
(m32r_elf_adjust_dynamic_symbol): Replace readonly_dynrelocs
with _bfd_elf_readonly_dynrelocs.
(maybe_set_textrel): Likewise.
* elf32-metag.c (readonly_dynrelocs): Removed.
(elf_metag_adjust_dynamic_symbol): Replace readonly_dynrelocs
with _bfd_elf_readonly_dynrelocs.
(maybe_set_textrel): Likewise.
* elf32-microblaze.c (readonly_dynrelocs): Removed.
(microblaze_elf_adjust_dynamic_symbol): Replace readonly_dynrelocs
with _bfd_elf_readonly_dynrelocs.
* elf32-nds32.c (readonly_dynrelocs): Removed.
(nds32_elf_adjust_dynamic_symbol): Replace readonly_dynrelocs
with _bfd_elf_readonly_dynrelocs.
(maybe_set_textrel): Likewise.
* elf32-or1k.c (readonly_dynrelocs): Removed.
(or1k_elf_adjust_dynamic_symbol): Replace readonly_dynrelocs
with _bfd_elf_readonly_dynrelocs.
* elf32-ppc.c (readonly_dynrelocs): Removed.
(alias_readonly_dynrelocs): Replace readonly_dynrelocs with
_bfd_elf_readonly_dynrelocs.
(ppc_elf_adjust_dynamic_symbol): Likewise.
(maybe_set_textrel): Likewise.
* elf32-s390.c (readonly_dynrelocs): Removed.
(elf_s390_adjust_dynamic_symbol): Replace readonly_dynrelocs
with _bfd_elf_readonly_dynrelocs.
(maybe_set_textrel): Likewise.
* elf32-sh.c (readonly_dynrelocs): Removed.
(sh_elf_adjust_dynamic_symbol): Replace readonly_dynrelocs with
_bfd_elf_readonly_dynrelocs.
(maybe_set_textrel): Likewise.
* elf32-tic6x.c (readonly_dynrelocs): Removed.
(maybe_set_textrel): Replace readonly_dynrelocs with
_bfd_elf_readonly_dynrelocs.
* elf32-tilepro.c (readonly_dynrelocs): Removed.
(tilepro_elf_adjust_dynamic_symbol): Replace readonly_dynrelocs
with _bfd_elf_readonly_dynrelocs.
(maybe_set_textrel): Likewise.
* elf64-ppc.c (readonly_dynrelocs): Removed.
(alias_readonly_dynrelocs): Replace readonly_dynrelocs with
_bfd_elf_readonly_dynrelocs.
(ppc64_elf_adjust_dynamic_symbol): Likewise.
(maybe_set_textrel): Likewise.
* elf64-s390.c (readonly_dynrelocs): Removed.
(elf_s390_adjust_dynamic_symbol): Replace readonly_dynrelocs
with _bfd_elf_readonly_dynrelocs.
(maybe_set_textrel): Likewise.
* elflink.c (_bfd_elf_readonly_dynrelocs): New.
* elfnn-aarch64.c (readonly_dynrelocs): Removed.
(maybe_set_textrel): Replace readonly_dynrelocs with
_bfd_elf_readonly_dynrelocs.
* elfnn-riscv.c (readonly_dynrelocs): Removed.
(riscv_elf_adjust_dynamic_symbol): Replace readonly_dynrelocs
with _bfd_elf_readonly_dynrelocs.
(maybe_set_textrel): Likewise.
* elfxx-sparc.c (readonly_dynrelocs): Removed.
(_bfd_sparc_elf_adjust_dynamic_symbol): Replace
readonly_dynrelocs with _bfd_elf_readonly_dynrelocs.
(maybe_set_textrel): Likewise.
* elfxx-tilegx.c (readonly_dynrelocs): Removed.
(tilegx_elf_adjust_dynamic_symbol): Replace readonly_dynrelocs
with _bfd_elf_readonly_dynrelocs.
(maybe_set_textrel): Likewise.
* elfxx-x86.c (readonly_dynrelocs): Removed.
(maybe_set_textrel): Replace readonly_dynrelocs with
_bfd_elf_readonly_dynrelocs.
(_bfd_x86_elf_adjust_dynamic_symbol): Likewise.
2020-06-03 H.J. Lu <hongjiu.lu@intel.com>
* elfxx-x86.h (GENERATE_DYNAMIC_RELOCATION_P): Silence

View File

@ -2874,6 +2874,8 @@ extern bfd_boolean _bfd_elf_write_secondary_reloc_section
extern unsigned int _bfd_elf_symbol_section_index
(bfd *, elf_symbol_type *);
extern asection *_bfd_elf_readonly_dynrelocs
(struct elf_link_hash_entry *);
/* Large common section. */
extern asection _bfd_elf_large_com_section;

View File

@ -16089,23 +16089,6 @@ elf32_arm_find_inliner_info (bfd * abfd,
return found;
}
/* Find dynamic relocs for H that apply to read-only sections. */
static asection *
readonly_dynrelocs (struct elf_link_hash_entry *h)
{
struct elf_dyn_relocs *p;
for (p = h->dyn_relocs; p != NULL; p = p->next)
{
asection *s = p->sec->output_section;
if (s != NULL && (s->flags & SEC_READONLY) != 0)
return p->sec;
}
return NULL;
}
/* Adjust a symbol defined by a dynamic object and referenced by a
regular object. The current definition is in some section of the
dynamic object, but we're not including those sections. We have to
@ -16730,7 +16713,7 @@ maybe_set_textrel (struct elf_link_hash_entry *h, void *info_p)
if (h->root.type == bfd_link_hash_indirect)
return TRUE;
sec = readonly_dynrelocs (h);
sec = _bfd_elf_readonly_dynrelocs (h);
if (sec != NULL)
{
struct bfd_link_info *info = (struct bfd_link_info *) info_p;

View File

@ -1893,21 +1893,6 @@ csky_allocate_dynrelocs (struct elf_link_hash_entry *h, PTR inf)
return TRUE;
}
static asection *
readonly_dynrelocs (struct elf_link_hash_entry *h)
{
struct elf_dyn_relocs *p;
for (p = h->dyn_relocs; p != NULL; p = p->next)
{
asection *s = p->sec->output_section;
if (s != NULL && (s->flags & SEC_READONLY) != 0)
return p->sec;
}
return NULL;
}
/* Set DF_TEXTREL if we find any dynamic relocs that apply to
read-only sections. */
@ -1919,7 +1904,7 @@ maybe_set_textrel (struct elf_link_hash_entry *h, void *info_p)
if (h->root.type == bfd_link_hash_indirect)
return TRUE;
sec = readonly_dynrelocs (h);
sec = _bfd_elf_readonly_dynrelocs (h);
if (sec != NULL)
{
struct bfd_link_info *info = (struct bfd_link_info *) info_p;

View File

@ -1654,23 +1654,6 @@ elf32_hppa_hide_symbol (struct bfd_link_info *info,
}
}
/* Find any dynamic relocs that apply to read-only sections. */
static asection *
readonly_dynrelocs (struct elf_link_hash_entry *eh)
{
struct elf_dyn_relocs *hdh_p;
for (hdh_p = eh->dyn_relocs; hdh_p != NULL; hdh_p = hdh_p->next)
{
asection *sec = hdh_p->sec->output_section;
if (sec != NULL && (sec->flags & SEC_READONLY) != 0)
return hdh_p->sec;
}
return NULL;
}
/* Return true if we have dynamic relocs against H or any of its weak
aliases, that apply to read-only sections. Cannot be used after
size_dynamic_sections. */
@ -1681,7 +1664,7 @@ alias_readonly_dynrelocs (struct elf_link_hash_entry *eh)
struct elf32_hppa_link_hash_entry *hh = hppa_elf_hash_entry (eh);
do
{
if (readonly_dynrelocs (&hh->eh))
if (_bfd_elf_readonly_dynrelocs (&hh->eh))
return TRUE;
hh = hppa_elf_hash_entry (hh->eh.u.alias);
} while (hh != NULL && &hh->eh != eh);
@ -2106,7 +2089,7 @@ maybe_set_textrel (struct elf_link_hash_entry *eh, void *inf)
if (eh->root.type == bfd_link_hash_indirect)
return TRUE;
sec = readonly_dynrelocs (eh);
sec = _bfd_elf_readonly_dynrelocs (eh);
if (sec != NULL)
{
struct bfd_link_info *info = (struct bfd_link_info *) inf;

View File

@ -1599,23 +1599,6 @@ lm32_elf_reloc_type_class (const struct bfd_link_info *info ATTRIBUTE_UNUSED,
}
}
/* Find dynamic relocs for H that apply to read-only sections. */
static asection *
readonly_dynrelocs (struct elf_link_hash_entry *h)
{
struct elf_dyn_relocs *p;
for (p = h->dyn_relocs; p != NULL; p = p->next)
{
asection *s = p->sec->output_section;
if (s != NULL && (s->flags & SEC_READONLY) != 0)
return p->sec;
}
return NULL;
}
/* Adjust a symbol defined by a dynamic object and referenced by a
regular object. The current definition is in some section of the
dynamic object, but we're not including those sections. We have to
@ -1702,7 +1685,7 @@ lm32_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
/* If we don't find any dynamic relocs in read-only sections, then
we'll be keeping the dynamic relocs and avoiding the copy reloc. */
if (0 && !readonly_dynrelocs (h))
if (0 && !_bfd_elf_readonly_dynrelocs (h))
{
h->non_got_ref = 0;
return TRUE;
@ -1942,7 +1925,7 @@ maybe_set_textrel (struct elf_link_hash_entry *h, void *info_p)
if (h->root.type == bfd_link_hash_indirect)
return TRUE;
sec = readonly_dynrelocs (h);
sec = _bfd_elf_readonly_dynrelocs (h);
if (sec != NULL)
{
struct bfd_link_info *info = (struct bfd_link_info *) info_p;

View File

@ -1700,23 +1700,6 @@ m32r_elf_copy_indirect_symbol (struct bfd_link_info *info,
}
/* Find dynamic relocs for H that apply to read-only sections. */
static asection *
readonly_dynrelocs (struct elf_link_hash_entry *h)
{
struct elf_dyn_relocs *p;
for (p = h->dyn_relocs; p != NULL; p = p->next)
{
asection *s = p->sec->output_section;
if (s != NULL && (s->flags & SEC_READONLY) != 0)
return p->sec;
}
return NULL;
}
/* Adjust a symbol defined by a dynamic object and referenced by a
regular object. The current definition is in some section of the
dynamic object, but we're not including those sections. We have to
@ -1807,7 +1790,7 @@ m32r_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
/* If we don't find any dynamic relocs in read-only sections, then
we'll be keeping the dynamic relocs and avoiding the copy reloc. */
if (0 && !readonly_dynrelocs (h))
if (0 && !_bfd_elf_readonly_dynrelocs (h))
{
h->non_got_ref = 0;
return TRUE;
@ -2047,7 +2030,7 @@ maybe_set_textrel (struct elf_link_hash_entry *h, void *info_p)
if (h->root.type == bfd_link_hash_indirect)
return TRUE;
sec = readonly_dynrelocs (h);
sec = _bfd_elf_readonly_dynrelocs (h);
if (sec != NULL)
{
struct bfd_link_info *info = (struct bfd_link_info *) info_p;

View File

@ -2435,23 +2435,6 @@ elf_metag_copy_indirect_symbol (struct bfd_link_info *info,
_bfd_elf_link_hash_copy_indirect (info, eh_dir, eh_ind);
}
/* Find dynamic relocs for H that apply to read-only sections. */
static asection *
readonly_dynrelocs (struct elf_link_hash_entry *h)
{
struct elf_dyn_relocs *p;
for (p = h->dyn_relocs; p != NULL; p = p->next)
{
asection *s = p->sec->output_section;
if (s != NULL && (s->flags & SEC_READONLY) != 0)
return p->sec;
}
return NULL;
}
/* Adjust a symbol defined by a dynamic object and referenced by a
regular object. The current definition is in some section of the
dynamic object, but we're not including those sections. We have to
@ -2527,7 +2510,7 @@ elf_metag_adjust_dynamic_symbol (struct bfd_link_info *info,
/* If we don't find any dynamic relocs in read-only sections, then
we'll be keeping the dynamic relocs and avoiding the copy reloc. */
if (!readonly_dynrelocs (eh))
if (!_bfd_elf_readonly_dynrelocs (eh))
{
eh->non_got_ref = 0;
return TRUE;
@ -2778,7 +2761,7 @@ maybe_set_textrel (struct elf_link_hash_entry *h, void *info_p)
if (h->root.type == bfd_link_hash_indirect)
return TRUE;
sec = readonly_dynrelocs (h);
sec = _bfd_elf_readonly_dynrelocs (h);
if (sec != NULL)
{
struct bfd_link_info *info = (struct bfd_link_info *) info_p;

View File

@ -2614,23 +2614,6 @@ microblaze_elf_copy_indirect_symbol (struct bfd_link_info *info,
_bfd_elf_link_hash_copy_indirect (info, dir, ind);
}
/* Find dynamic relocs for H that apply to read-only sections. */
static asection *
readonly_dynrelocs (struct elf_link_hash_entry *h)
{
struct elf_dyn_relocs *p;
for (p = h->dyn_relocs; p != NULL; p = p->next)
{
asection *s = p->sec->output_section;
if (s != NULL && (s->flags & SEC_READONLY) != 0)
return p->sec;
}
return NULL;
}
static bfd_boolean
microblaze_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
struct elf_link_hash_entry *h)
@ -2709,7 +2692,7 @@ microblaze_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
/* If we don't find any dynamic relocs in read-only sections, then
we'll be keeping the dynamic relocs and avoiding the copy reloc. */
if (!readonly_dynrelocs (h))
if (!_bfd_elf_readonly_dynrelocs (h))
{
h->non_got_ref = 0;
return TRUE;

View File

@ -3920,24 +3920,6 @@ nds32_elf_copy_indirect_symbol (struct bfd_link_info *info,
_bfd_elf_link_hash_copy_indirect (info, dir, ind);
}
/* Find dynamic relocs for H that apply to read-only sections. */
static asection *
readonly_dynrelocs (struct elf_link_hash_entry *h)
{
struct elf_dyn_relocs *p;
for (p = h->dyn_relocs; p != NULL; p = p->next)
{
asection *s = p->sec->output_section;
if (s != NULL && (s->flags & SEC_READONLY) != 0)
return p->sec;
}
return NULL;
}
/* Adjust a symbol defined by a dynamic object and referenced by a
regular object. The current definition is in some section of the
dynamic object, but we're not including those sections. We have to
@ -4023,7 +4005,7 @@ nds32_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
/* If we don't find any dynamic relocs in read-only sections, then
we'll be keeping the dynamic relocs and avoiding the copy reloc. */
if (!readonly_dynrelocs (h))
if (!_bfd_elf_readonly_dynrelocs (h))
{
h->non_got_ref = 0;
return TRUE;
@ -4315,7 +4297,7 @@ maybe_set_textrel (struct elf_link_hash_entry *h, void *info_p)
if (h->root.type == bfd_link_hash_indirect)
return TRUE;
sec = readonly_dynrelocs (h);
sec = _bfd_elf_readonly_dynrelocs (h);
if (sec != NULL)
{
struct bfd_link_info *info = (struct bfd_link_info *) info_p;

View File

@ -2547,25 +2547,6 @@ or1k_elf_reloc_type_class (const struct bfd_link_info *info ATTRIBUTE_UNUSED,
}
}
/* Find dynamic relocs for H that apply to read-only sections. */
static asection *
readonly_dynrelocs (struct elf_link_hash_entry *h)
{
struct elf_dyn_relocs *sec_relocs;
for (sec_relocs = h->dyn_relocs;
sec_relocs != NULL;
sec_relocs = sec_relocs->next)
{
asection *s = sec_relocs->sec->output_section;
if (s != NULL && (s->flags & SEC_READONLY) != 0)
return sec_relocs->sec;
}
return NULL;
}
/* Adjust a symbol defined by a dynamic object and referenced by a
regular object. The current definition is in some section of the
dynamic object, but we're not including those sections. We have to
@ -2652,7 +2633,7 @@ or1k_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
/* If we don't find any dynamic relocs in read-only sections, then
we'll be keeping the dynamic relocs and avoiding the copy reloc. */
if (!readonly_dynrelocs (h))
if (!_bfd_elf_readonly_dynrelocs (h))
{
h->non_got_ref = 0;
return TRUE;
@ -2949,7 +2930,7 @@ maybe_set_textrel (struct elf_link_hash_entry *h, void *info_p)
if (h->root.type == bfd_link_hash_indirect)
return TRUE;
sec = readonly_dynrelocs (h);
sec = _bfd_elf_readonly_dynrelocs (h);
if (sec != NULL)
{
struct bfd_link_info *info = (struct bfd_link_info *) info_p;

View File

@ -4694,23 +4694,6 @@ ppc_elf_tls_optimize (bfd *obfd ATTRIBUTE_UNUSED,
return TRUE;
}
/* Find dynamic relocs for H that apply to read-only sections. */
static asection *
readonly_dynrelocs (struct elf_link_hash_entry *h)
{
struct elf_dyn_relocs *p;
for (p = h->dyn_relocs; p != NULL; p = p->next)
{
asection *s = p->sec->output_section;
if (s != NULL && (s->flags & SEC_READONLY) != 0)
return p->sec;
}
return NULL;
}
/* Return true if we have dynamic relocs against H or any of its weak
aliases, that apply to read-only sections. Cannot be used after
size_dynamic_sections. */
@ -4721,7 +4704,7 @@ alias_readonly_dynrelocs (struct elf_link_hash_entry *h)
struct ppc_elf_link_hash_entry *eh = ppc_elf_hash_entry (h);
do
{
if (readonly_dynrelocs (&eh->elf))
if (_bfd_elf_readonly_dynrelocs (&eh->elf))
return TRUE;
eh = ppc_elf_hash_entry (eh->elf.u.alias);
} while (eh != NULL && &eh->elf != h);
@ -4826,7 +4809,7 @@ ppc_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
&& !UNDEFWEAK_NO_DYNAMIC_RELOC (info, h)))
&& !htab->is_vxworks
&& !ppc_elf_hash_entry (h)->has_sda_refs
&& !readonly_dynrelocs (h))
&& !_bfd_elf_readonly_dynrelocs (h))
{
h->pointer_equality_needed = 0;
/* If we haven't seen a branch reloc and the symbol
@ -5451,7 +5434,7 @@ maybe_set_textrel (struct elf_link_hash_entry *h, void *info_p)
if (h->root.type == bfd_link_hash_indirect)
return TRUE;
sec = readonly_dynrelocs (h);
sec = _bfd_elf_readonly_dynrelocs (h);
if (sec != NULL)
{
struct bfd_link_info *info = (struct bfd_link_info *) info_p;

View File

@ -1417,23 +1417,6 @@ elf_s390_adjust_gotplt (struct elf_s390_link_hash_entry *h)
h->gotplt_refcount = -1;
}
/* Find dynamic relocs for H that apply to read-only sections. */
static asection *
readonly_dynrelocs (struct elf_link_hash_entry *h)
{
struct elf_dyn_relocs *p;
for (p = h->dyn_relocs; p != NULL; p = p->next)
{
asection *s = p->sec->output_section;
if (s != NULL && (s->flags & SEC_READONLY) != 0)
return p->sec;
}
return NULL;
}
/* Adjust a symbol defined by a dynamic object and referenced by a
regular object. The current definition is in some section of the
dynamic object, but we're not including those sections. We have to
@ -1558,7 +1541,7 @@ elf_s390_adjust_dynamic_symbol (struct bfd_link_info *info,
/* If we don't find any dynamic relocs in read-only sections, then
we'll be keeping the dynamic relocs and avoiding the copy reloc. */
if (ELIMINATE_COPY_RELOCS && !readonly_dynrelocs (h))
if (ELIMINATE_COPY_RELOCS && !_bfd_elf_readonly_dynrelocs (h))
{
h->non_got_ref = 0;
return TRUE;
@ -1836,7 +1819,7 @@ maybe_set_textrel (struct elf_link_hash_entry *h, void *info_p)
if (h->root.type == bfd_link_hash_indirect)
return TRUE;
sec = readonly_dynrelocs (h);
sec = _bfd_elf_readonly_dynrelocs (h);
if (sec != NULL)
{
struct bfd_link_info *info = (struct bfd_link_info *) info_p;

View File

@ -2476,23 +2476,6 @@ sh_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
return TRUE;
}
/* Find dynamic relocs for H that apply to read-only sections. */
static asection *
readonly_dynrelocs (struct elf_link_hash_entry *h)
{
struct elf_dyn_relocs *p;
for (p = h->dyn_relocs; p != NULL; p = p->next)
{
asection *s = p->sec->output_section;
if (s != NULL && (s->flags & SEC_READONLY) != 0)
return p->sec;
}
return NULL;
}
/* Adjust a symbol defined by a dynamic object and referenced by a
regular object. The current definition is in some section of the
dynamic object, but we're not including those sections. We have to
@ -2581,7 +2564,7 @@ sh_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
/* If we don't find any dynamic relocs in read-only sections, then
we'll be keeping the dynamic relocs and avoiding the copy reloc. */
if (0 && !readonly_dynrelocs (h))
if (0 && !_bfd_elf_readonly_dynrelocs (h))
{
h->non_got_ref = 0;
return TRUE;
@ -2954,7 +2937,7 @@ maybe_set_textrel (struct elf_link_hash_entry *h, void *info_p)
if (h->root.type == bfd_link_hash_indirect)
return TRUE;
sec = readonly_dynrelocs (h);
sec = _bfd_elf_readonly_dynrelocs (h);
if (sec != NULL)
{
struct bfd_link_info *info = (struct bfd_link_info *) info_p;

View File

@ -1963,23 +1963,6 @@ elf32_tic6x_fake_sections (bfd *abfd ATTRIBUTE_UNUSED,
return TRUE;
}
/* Find dynamic relocs for H that apply to read-only sections. */
static asection *
readonly_dynrelocs (struct elf_link_hash_entry *h)
{
struct elf_dyn_relocs *p;
for (p = h->dyn_relocs; p != NULL; p = p->next)
{
asection *s = p->sec->output_section;
if (s != NULL && (s->flags & SEC_READONLY) != 0)
return p->sec;
}
return NULL;
}
/* Adjust a symbol defined by a dynamic object and referenced by a
regular object. The current definition is in some section of the
dynamic object, but we're not including those sections. We have to
@ -3198,7 +3181,7 @@ maybe_set_textrel (struct elf_link_hash_entry *h, void *info_p)
if (h->root.type == bfd_link_hash_indirect)
return TRUE;
sec = readonly_dynrelocs (h);
sec = _bfd_elf_readonly_dynrelocs (h);
if (sec != NULL)
{
struct bfd_link_info *info = (struct bfd_link_info *) info_p;

View File

@ -1871,23 +1871,6 @@ tilepro_elf_gc_mark_hook (asection *sec,
return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
}
/* Find dynamic relocs for H that apply to read-only sections. */
static asection *
readonly_dynrelocs (struct elf_link_hash_entry *h)
{
struct elf_dyn_relocs *p;
for (p = h->dyn_relocs; p != NULL; p = p->next)
{
asection *s = p->sec->output_section;
if (s != NULL && (s->flags & SEC_READONLY) != 0)
return p->sec;
}
return NULL;
}
/* Adjust a symbol defined by a dynamic object and referenced by a
regular object. The current definition is in some section of the
dynamic object, but we're not including those sections. We have to
@ -1973,7 +1956,7 @@ tilepro_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
/* If we don't find any dynamic relocs in read-only sections, then
we'll be keeping the dynamic relocs and avoiding the copy reloc. */
if (!readonly_dynrelocs (h))
if (!_bfd_elf_readonly_dynrelocs (h))
{
h->non_got_ref = 0;
return TRUE;
@ -2227,7 +2210,7 @@ maybe_set_textrel (struct elf_link_hash_entry *h, void *info_p)
if (h->root.type == bfd_link_hash_indirect)
return TRUE;
sec = readonly_dynrelocs (h);
sec = _bfd_elf_readonly_dynrelocs (h);
if (sec != NULL)
{
struct bfd_link_info *info = (struct bfd_link_info *) info_p;

View File

@ -6356,23 +6356,6 @@ ppc64_elf_func_desc_adjust (bfd *obfd ATTRIBUTE_UNUSED,
return TRUE;
}
/* Find dynamic relocs for H that apply to read-only sections. */
static asection *
readonly_dynrelocs (struct elf_link_hash_entry *h)
{
struct elf_dyn_relocs *p;
for (p = h->dyn_relocs; p != NULL; p = p->next)
{
asection *s = p->sec->output_section;
if (s != NULL && (s->flags & SEC_READONLY) != 0)
return p->sec;
}
return NULL;
}
/* Return true if we have dynamic relocs against H or any of its weak
aliases, that apply to read-only sections. Cannot be used after
size_dynamic_sections. */
@ -6383,7 +6366,7 @@ alias_readonly_dynrelocs (struct elf_link_hash_entry *h)
struct ppc_link_hash_entry *eh = ppc_elf_hash_entry (h);
do
{
if (readonly_dynrelocs (&eh->elf))
if (_bfd_elf_readonly_dynrelocs (&eh->elf))
return TRUE;
eh = ppc_elf_hash_entry (eh->elf.u.alias);
}
@ -6492,7 +6475,7 @@ ppc64_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
extra work in ld.so when resolving these symbols. */
if (global_entry_stub (h))
{
if (!readonly_dynrelocs (h))
if (!_bfd_elf_readonly_dynrelocs (h))
{
h->pointer_equality_needed = 0;
/* If we haven't seen a branch reloc and the symbol
@ -6510,7 +6493,7 @@ ppc64_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
return TRUE;
}
else if (!h->needs_plt
&& !readonly_dynrelocs (h))
&& !_bfd_elf_readonly_dynrelocs (h))
{
/* If we haven't seen a branch reloc and the symbol isn't an
ifunc then we don't need a plt entry. */
@ -9890,7 +9873,7 @@ maybe_set_textrel (struct elf_link_hash_entry *h, void *inf)
if (h->root.type == bfd_link_hash_indirect)
return TRUE;
sec = readonly_dynrelocs (h);
sec = _bfd_elf_readonly_dynrelocs (h);
if (sec != NULL)
{
struct bfd_link_info *info = (struct bfd_link_info *) inf;

View File

@ -1352,23 +1352,6 @@ elf_s390_adjust_gotplt (struct elf_s390_link_hash_entry *h)
h->gotplt_refcount = -1;
}
/* Find dynamic relocs for H that apply to read-only sections. */
static asection *
readonly_dynrelocs (struct elf_link_hash_entry *h)
{
struct elf_dyn_relocs *p;
for (p = h->dyn_relocs; p != NULL; p = p->next)
{
asection *s = p->sec->output_section;
if (s != NULL && (s->flags & SEC_READONLY) != 0)
return p->sec;
}
return NULL;
}
/* Adjust a symbol defined by a dynamic object and referenced by a
regular object. The current definition is in some section of the
dynamic object, but we're not including those sections. We have to
@ -1492,7 +1475,7 @@ elf_s390_adjust_dynamic_symbol (struct bfd_link_info *info,
/* If we don't find any dynamic relocs in read-only sections, then
we'll be keeping the dynamic relocs and avoiding the copy reloc. */
if (ELIMINATE_COPY_RELOCS && !readonly_dynrelocs (h))
if (ELIMINATE_COPY_RELOCS && !_bfd_elf_readonly_dynrelocs (h))
{
h->non_got_ref = 0;
return TRUE;
@ -1772,7 +1755,7 @@ maybe_set_textrel (struct elf_link_hash_entry *h, void *info_p)
if (h->root.type == bfd_link_hash_indirect)
return TRUE;
sec = readonly_dynrelocs (h);
sec = _bfd_elf_readonly_dynrelocs (h);
if (sec != NULL)
{
struct bfd_link_info *info = (struct bfd_link_info *) info_p;

View File

@ -14793,3 +14793,20 @@ bfd_elf_define_start_stop (struct bfd_link_info *info,
}
return NULL;
}
/* Find dynamic relocs for H that apply to read-only sections. */
asection *
_bfd_elf_readonly_dynrelocs (struct elf_link_hash_entry *h)
{
struct elf_dyn_relocs *p;
for (p = h->dyn_relocs; p != NULL; p = p->next)
{
asection *s = p->sec->output_section;
if (s != NULL && (s->flags & SEC_READONLY) != 0)
return p->sec;
}
return NULL;
}

View File

@ -7381,23 +7381,6 @@ elfNN_aarch64_print_private_bfd_data (bfd *abfd, void *ptr)
return TRUE;
}
/* Find dynamic relocs for H that apply to read-only sections. */
static asection *
readonly_dynrelocs (struct elf_link_hash_entry *h)
{
struct elf_dyn_relocs *p;
for (p = h->dyn_relocs; p != NULL; p = p->next)
{
asection *s = p->sec->output_section;
if (s != NULL && (s->flags & SEC_READONLY) != 0)
return p->sec;
}
return NULL;
}
/* Return true if we need copy relocation against EH. */
static bfd_boolean
@ -8915,7 +8898,7 @@ maybe_set_textrel (struct elf_link_hash_entry *h, void *info_p)
if (h->root.type == bfd_link_hash_indirect)
return TRUE;
sec = readonly_dynrelocs (h);
sec = _bfd_elf_readonly_dynrelocs (h);
if (sec != NULL)
{
struct bfd_link_info *info = (struct bfd_link_info *) info_p;

View File

@ -782,23 +782,6 @@ riscv_elf_gc_mark_hook (asection *sec,
return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
}
/* Find dynamic relocs for H that apply to read-only sections. */
static asection *
readonly_dynrelocs (struct elf_link_hash_entry *h)
{
struct elf_dyn_relocs *p;
for (p = h->dyn_relocs; p != NULL; p = p->next)
{
asection *s = p->sec->output_section;
if (s != NULL && (s->flags & SEC_READONLY) != 0)
return p->sec;
}
return NULL;
}
/* Adjust a symbol defined by a dynamic object and referenced by a
regular object. The current definition is in some section of the
dynamic object, but we're not including those sections. We have to
@ -887,7 +870,7 @@ riscv_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
/* If we don't find any dynamic relocs in read-only sections, then
we'll be keeping the dynamic relocs and avoiding the copy reloc. */
if (!readonly_dynrelocs (h))
if (!_bfd_elf_readonly_dynrelocs (h))
{
h->non_got_ref = 0;
return TRUE;
@ -1147,7 +1130,7 @@ maybe_set_textrel (struct elf_link_hash_entry *h, void *info_p)
if (h->root.type == bfd_link_hash_indirect)
return TRUE;
sec = readonly_dynrelocs (h);
sec = _bfd_elf_readonly_dynrelocs (h);
if (sec != NULL)
{
struct bfd_link_info *info = (struct bfd_link_info *) info_p;

View File

@ -1919,23 +1919,6 @@ _bfd_sparc_elf_fixup_symbol (struct bfd_link_info *info,
return TRUE;
}
/* Find dynamic relocs for H that apply to read-only sections. */
static asection *
readonly_dynrelocs (struct elf_link_hash_entry *h)
{
struct elf_dyn_relocs *p;
for (p = h->dyn_relocs; p != NULL; p = p->next)
{
asection *s = p->sec->output_section;
if (s != NULL && (s->flags & SEC_READONLY) != 0)
return p->sec;
}
return NULL;
}
/* Adjust a symbol defined by a dynamic object and referenced by a
regular object. The current definition is in some section of the
dynamic object, but we're not including those sections. We have to
@ -2032,7 +2015,7 @@ _bfd_sparc_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
/* If we don't find any dynamic relocs in read-only sections, then
we'll be keeping the dynamic relocs and avoiding the copy reloc. */
if (!readonly_dynrelocs (h))
if (!_bfd_elf_readonly_dynrelocs (h))
{
h->non_got_ref = 0;
return TRUE;
@ -2418,7 +2401,7 @@ maybe_set_textrel (struct elf_link_hash_entry *h, void *info_p)
if (h->root.type == bfd_link_hash_indirect)
return TRUE;
sec = readonly_dynrelocs (h);
sec = _bfd_elf_readonly_dynrelocs (h);
if (sec != NULL)
{
struct bfd_link_info *info = (struct bfd_link_info *) info_p;

View File

@ -2114,23 +2114,6 @@ tilegx_elf_gc_mark_hook (asection *sec,
return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
}
/* Find dynamic relocs for H that apply to read-only sections. */
static asection *
readonly_dynrelocs (struct elf_link_hash_entry *h)
{
struct elf_dyn_relocs *p;
for (p = h->dyn_relocs; p != NULL; p = p->next)
{
asection *s = p->sec->output_section;
if (s != NULL && (s->flags & SEC_READONLY) != 0)
return p->sec;
}
return NULL;
}
/* Adjust a symbol defined by a dynamic object and referenced by a
regular object. The current definition is in some section of the
dynamic object, but we're not including those sections. We have to
@ -2219,7 +2202,7 @@ tilegx_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
/* If we don't find any dynamic relocs in read-only sections, then
we'll be keeping the dynamic relocs and avoiding the copy reloc. */
if (!readonly_dynrelocs (h))
if (!_bfd_elf_readonly_dynrelocs (h))
{
h->non_got_ref = 0;
return TRUE;
@ -2473,7 +2456,7 @@ maybe_set_textrel (struct elf_link_hash_entry *h, void *info_p)
if (h->root.type == bfd_link_hash_indirect)
return TRUE;
sec = readonly_dynrelocs (h);
sec = _bfd_elf_readonly_dynrelocs (h);
if (sec != NULL)
{
struct bfd_link_info *info = (struct bfd_link_info *) info_p;

View File

@ -532,23 +532,6 @@ elf_x86_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
return TRUE;
}
/* Find dynamic relocs for H that apply to read-only sections. */
static asection *
readonly_dynrelocs (struct elf_link_hash_entry *h)
{
struct elf_dyn_relocs *p;
for (p = h->dyn_relocs; p != NULL; p = p->next)
{
asection *s = p->sec->output_section;
if (s != NULL && (s->flags & SEC_READONLY) != 0)
return p->sec;
}
return NULL;
}
/* Set DF_TEXTREL if we find any dynamic relocs that apply to
read-only sections. */
@ -564,7 +547,7 @@ maybe_set_textrel (struct elf_link_hash_entry *h, void *inf)
if (h->forced_local && h->type == STT_GNU_IFUNC)
return TRUE;
sec = readonly_dynrelocs (h);
sec = _bfd_elf_readonly_dynrelocs (h);
if (sec != NULL)
{
struct bfd_link_info *info = (struct bfd_link_info *) inf;
@ -2078,7 +2061,7 @@ _bfd_x86_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
/* If we don't find any dynamic relocs in read-only sections,
then we'll be keeping the dynamic relocs and avoiding the copy
reloc. */
if (!readonly_dynrelocs (h))
if (!_bfd_elf_readonly_dynrelocs (h))
{
h->non_got_ref = 0;
return TRUE;