@@ -2497,8 +2497,6 @@ extern long _bfd_elf_get_reloc_upper_bound
(bfd *, sec_ptr) ATTRIBUTE_HIDDEN;
extern long _bfd_elf_canonicalize_reloc
(bfd *, sec_ptr, arelent **, asymbol **) ATTRIBUTE_HIDDEN;
-extern asection * _bfd_elf_get_dynamic_reloc_section
- (bfd *, asection *, bool) ATTRIBUTE_HIDDEN;
extern asection * _bfd_elf_make_dynamic_reloc_section
(asection *, bfd *, unsigned int, bfd *, bool) ATTRIBUTE_HIDDEN;
extern long _bfd_elf_get_dynamic_reloc_upper_bound
@@ -1431,7 +1431,6 @@ mn10300_elf_final_link_relocate (reloc_howto_type *howto,
dynobj = elf_hash_table (info)->dynobj;
sgot = NULL;
splt = NULL;
- sreloc = NULL;
switch (r_type)
{
@@ -1531,13 +1530,9 @@ mn10300_elf_final_link_relocate (reloc_howto_type *howto,
/* When generating a shared object, these relocations are
copied into the output file to be resolved at run
time. */
+ sreloc = elf_section_data (input_section)->sreloc;
if (sreloc == NULL)
- {
- sreloc = _bfd_elf_get_dynamic_reloc_section
- (input_bfd, input_section, /*rela?*/ true);
- if (sreloc == NULL)
- return false;
- }
+ return false;
skip = false;
@@ -1812,9 +1812,7 @@ elf_arc_relocate_section (bfd * output_bfd,
bfd_byte *loc;
bool skip = false;
bool relocate = false;
- asection *sreloc = _bfd_elf_get_dynamic_reloc_section
- (input_bfd, input_section,
- /*RELA*/ true);
+ asection *sreloc = elf_section_data (input_section)->sreloc;
BFD_ASSERT (sreloc != NULL);
@@ -10211,7 +10211,7 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto,
bfd_vma * local_tlsdesc_gotents;
asection * sgot;
asection * splt;
- asection * sreloc = NULL;
+ asection * sreloc;
asection * srelgot;
bfd_vma addend;
bfd_signed_vma signed_addend;
@@ -10502,16 +10502,6 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto,
}
*unresolved_reloc_p = false;
-
- if (sreloc == NULL && globals->root.dynamic_sections_created)
- {
- sreloc = _bfd_elf_get_dynamic_reloc_section (input_bfd, input_section,
- ! globals->use_rel);
-
- if (sreloc == NULL)
- return bfd_reloc_notsupported;
- }
-
skip = false;
relocate = false;
@@ -10565,7 +10555,12 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto,
if (isrofixup)
arm_elf_add_rofixup (output_bfd, globals->srofixup, outrel.r_offset);
else
- elf32_arm_add_dynreloc (output_bfd, info, sreloc, &outrel);
+ {
+ sreloc = elf_section_data (input_section)->sreloc;
+ if (sreloc == NULL)
+ return bfd_reloc_notsupported;
+ elf32_arm_add_dynreloc (output_bfd, info, sreloc, &outrel);
+ }
/* If this reloc is against an external symbol, we do not want to
fiddle with the addend. Otherwise, we need to include the symbol
@@ -1457,18 +1457,14 @@ cris_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
are copied into the output file to be resolved at run
time. */
+ sreloc = elf_section_data (input_section)->sreloc;
+ /* The section should have been created in cris_elf_check_relocs,
+ but that function will not be called for objects which fail in
+ cris_elf_merge_private_bfd_data. */
if (sreloc == NULL)
{
- sreloc = _bfd_elf_get_dynamic_reloc_section
- (dynobj, input_section, /*rela?*/ true);
- /* The section should have been created in cris_elf_check_relocs,
- but that function will not be called for objects which fail in
- cris_elf_merge_private_bfd_data. */
- if (sreloc == NULL)
- {
- bfd_set_error (bfd_error_bad_value);
- return false;
- }
+ bfd_set_error (bfd_error_bad_value);
+ return false;
}
skip = false;
@@ -3678,11 +3674,7 @@ elf_cris_discard_excess_dso_dynamics (struct elf_cris_link_hash_entry *h,
{
for (s = h->pcrel_relocs_copied; s != NULL; s = s->next)
{
- asection *sreloc
- = _bfd_elf_get_dynamic_reloc_section (elf_hash_table (info)
- ->dynobj,
- s->section,
- /*rela?*/ true);
+ asection *sreloc = elf_section_data (s->section)->sreloc;
sreloc->size -= s->count * sizeof (Elf32_External_Rela);
}
return true;
@@ -2237,7 +2237,6 @@ m32r_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
sgot = htab->sgot;
splt = htab->splt;
- sreloc = NULL;
rel = relocs;
relend = relocs + input_section->reloc_count;
@@ -2694,13 +2693,9 @@ m32r_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
/* When generating a shared object, these relocations
are copied into the output file to be resolved at run
time. */
+ sreloc = elf_section_data (input_section)->sreloc;
if (sreloc == NULL)
- {
- sreloc = _bfd_elf_get_dynamic_reloc_section
- (input_bfd, input_section, /*rela?*/ true);
- if (sreloc == NULL)
- return false;
- }
+ return false;
skip = false;
relocate = false;
@@ -3394,7 +3394,7 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
asection *sgot = NULL;
asection *sgotplt = NULL;
asection *splt = NULL;
- asection *sreloc = NULL;
+ asection *sreloc;
asection *srelgot = NULL;
bool is_vxworks_tls;
unsigned isec_segment, got_segment, plt_segment, check_segment[2];
@@ -3864,13 +3864,9 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
are copied into the output file to be resolved at run
time. */
+ sreloc = elf_section_data (input_section)->sreloc;
if (sreloc == NULL)
- {
- sreloc = _bfd_elf_get_dynamic_reloc_section
- (input_bfd, input_section, /*rela?*/ true);
- if (sreloc == NULL)
- return false;
- }
+ return false;
skip = false;
relocate = false;
@@ -4974,13 +4970,9 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
goto final_link_relocate;
}
+ sreloc = elf_section_data (input_section)->sreloc;
if (sreloc == NULL)
- {
- sreloc = _bfd_elf_get_dynamic_reloc_section
- (input_bfd, input_section, /*rela?*/ true);
- if (sreloc == NULL)
- return false;
- }
+ return false;
if (h == NULL || h->dynindx == -1)
indx = 0;
@@ -1226,7 +1226,6 @@ elf_vax_relocate_section (bfd *output_bfd,
sgot = NULL;
splt = NULL;
sgotplt = NULL;
- sreloc = NULL;
rel = relocs;
relend = relocs + input_section->reloc_count;
@@ -1423,13 +1422,9 @@ elf_vax_relocate_section (bfd *output_bfd,
/* When generating a shared object, these relocations
are copied into the output file to be resolved at run
time. */
+ sreloc = elf_section_data (input_section)->sreloc;
if (sreloc == NULL)
- {
- sreloc = _bfd_elf_get_dynamic_reloc_section
- (input_bfd, input_section, /*rela?*/ true);
- if (sreloc == NULL)
- return false;
- }
+ return false;
skip = false;
relocate = false;
@@ -15584,34 +15584,6 @@ get_dynamic_reloc_section_name (bfd * abfd,
return name;
}
-/* Returns the dynamic reloc section associated with SEC.
- If necessary compute the name of the dynamic reloc section based
- on SEC's name (looked up in ABFD's string table) and the setting
- of IS_RELA. */
-
-asection *
-_bfd_elf_get_dynamic_reloc_section (bfd *abfd,
- asection *sec,
- bool is_rela)
-{
- asection *reloc_sec = elf_section_data (sec)->sreloc;
-
- if (reloc_sec == NULL)
- {
- const char *name = get_dynamic_reloc_section_name (abfd, sec, is_rela);
-
- if (name != NULL)
- {
- reloc_sec = bfd_get_linker_section (abfd, name);
-
- if (reloc_sec != NULL)
- elf_section_data (sec)->sreloc = reloc_sec;
- }
- }
-
- return reloc_sec;
-}
-
/* Returns the dynamic reloc section associated with SEC. If the
section does not exist it is created and attached to the DYNOBJ
bfd and stored in the SRELOC field of SEC's elf_section_data