aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf32-cr16.c
diff options
context:
space:
mode:
Diffstat (limited to 'bfd/elf32-cr16.c')
-rw-r--r--bfd/elf32-cr16.c66
1 files changed, 3 insertions, 63 deletions
diff --git a/bfd/elf32-cr16.c b/bfd/elf32-cr16.c
index 62906c8..8a3775e 100644
--- a/bfd/elf32-cr16.c
+++ b/bfd/elf32-cr16.c
@@ -2407,9 +2407,7 @@ _bfd_cr16_elf_size_dynamic_sections (bfd * output_bfd,
{
bfd * dynobj;
asection * s;
- bfd_boolean plt;
bfd_boolean relocs;
- bfd_boolean reltext;
dynobj = elf_hash_table (info)->dynobj;
BFD_ASSERT (dynobj != NULL);
@@ -2442,9 +2440,7 @@ _bfd_cr16_elf_size_dynamic_sections (bfd * output_bfd,
/* The check_relocs and adjust_dynamic_symbol entry points have
determined the sizes of the various dynamic sections. Allocate
memory for them. */
- plt = FALSE;
relocs = FALSE;
- reltext = FALSE;
for (s = dynobj->sections; s != NULL; s = s->next)
{
const char * name;
@@ -2459,34 +2455,16 @@ _bfd_cr16_elf_size_dynamic_sections (bfd * output_bfd,
if (strcmp (name, ".plt") == 0)
{
/* Remember whether there is a PLT. */
- plt = s->size != 0;
+ ;
}
else if (CONST_STRNEQ (name, ".rela"))
{
if (s->size != 0)
{
- asection * target;
-
/* Remember whether there are any reloc sections other
than .rela.plt. */
if (strcmp (name, ".rela.plt") != 0)
- {
- const char * outname;
-
- relocs = TRUE;
-
- /* If this relocation section applies to a read only
- section, then we probably need a DT_TEXTREL
- entry. The entries in the .rela.plt section
- really apply to the .got section, which we
- created ourselves and so know is not readonly. */
- outname = bfd_section_name (s->output_section);
- target = bfd_get_section_by_name (output_bfd, outname + 5);
- if (target != NULL
- && (target->flags & SEC_READONLY) != 0
- && (target->flags & SEC_ALLOC) != 0)
- reltext = TRUE;
- }
+ relocs = TRUE;
/* We use the reloc_count field as a counter if we need
to copy relocs into the output file. */
@@ -2526,45 +2504,7 @@ _bfd_cr16_elf_size_dynamic_sections (bfd * output_bfd,
return FALSE;
}
- if (elf_hash_table (info)->dynamic_sections_created)
- {
- /* Add some entries to the .dynamic section. We fill in the
- values later, in _bfd_cr16_elf_finish_dynamic_sections,
- but we must add the entries now so that we get the correct
- size for the .dynamic section. The DT_DEBUG entry is filled
- in by the dynamic linker and used by the debugger. */
- if (! bfd_link_executable (info))
- {
- if (!_bfd_elf_add_dynamic_entry (info, DT_DEBUG, 0))
- return FALSE;
- }
-
- if (plt)
- {
- if (!_bfd_elf_add_dynamic_entry (info, DT_PLTGOT, 0)
- || !_bfd_elf_add_dynamic_entry (info, DT_PLTRELSZ, 0)
- || !_bfd_elf_add_dynamic_entry (info, DT_PLTREL, DT_RELA)
- || !_bfd_elf_add_dynamic_entry (info, DT_JMPREL, 0))
- return FALSE;
- }
-
- if (relocs)
- {
- if (!_bfd_elf_add_dynamic_entry (info, DT_RELA, 0)
- || !_bfd_elf_add_dynamic_entry (info, DT_RELASZ, 0)
- || !_bfd_elf_add_dynamic_entry (info, DT_RELAENT,
- sizeof (Elf32_External_Rela)))
- return FALSE;
- }
-
- if (reltext)
- {
- if (!_bfd_elf_add_dynamic_entry (info, DT_TEXTREL, 0))
- return FALSE;
- }
- }
-
- return TRUE;
+ return _bfd_elf_add_dynamic_tags (output_bfd, info, relocs);
}
/* Finish up dynamic symbol handling. We set the contents of various