diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2020-06-24 06:14:18 -0700 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2020-06-24 06:14:28 -0700 |
commit | 2c8e370829c7e4ed73d64a9d7be4991521620b3a (patch) | |
tree | 86627221051f1bdbc01a5fdb9350c4715a990b20 /bfd | |
parent | c679ec98a1296d8da3b5920a9058ba14b47ca3a4 (diff) | |
download | gdb-2c8e370829c7e4ed73d64a9d7be4991521620b3a.zip gdb-2c8e370829c7e4ed73d64a9d7be4991521620b3a.tar.gz gdb-2c8e370829c7e4ed73d64a9d7be4991521620b3a.tar.bz2 |
csky: Don't generate unnecessary dynamic tags
Dynamic tags, DT_JMPREL, PLTREL and PLTRELSZ, are needed only if there
are relocation entries for PLT. Don't generate them if there are no
relocation entries for PLT.
bfd/
PR ld/26083
* elf32-csky.c (csky_elf_size_dynamic_sections): Call
_bfd_elf_add_dynamic_tags.
ld/
PR ld/26083
* testsuite/ld-csky/tls-ie-v1.d: Updated.
* testsuite/ld-csky/tls-ie.d: Likewise.
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/ChangeLog | 6 | ||||
-rw-r--r-- | bfd/elf32-csky.c | 45 |
2 files changed, 8 insertions, 43 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index f0d7414..943139e 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,6 +1,12 @@ 2020-06-24 H.J. Lu <hongjiu.lu@intel.com> PR ld/26083 + * elf32-csky.c (csky_elf_size_dynamic_sections): Call + _bfd_elf_add_dynamic_tags. + +2020-06-24 H.J. Lu <hongjiu.lu@intel.com> + + PR ld/26083 * elf32-cris.c (elf_cris_size_dynamic_sections): Call _bfd_elf_add_dynamic_tags. diff --git a/bfd/elf32-csky.c b/bfd/elf32-csky.c index 43828be..ea58e14 100644 --- a/bfd/elf32-csky.c +++ b/bfd/elf32-csky.c @@ -2093,49 +2093,8 @@ csky_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, } if (htab->elf.dynamic_sections_created) - { - /* Add some entries to the .dynamic section. We fill in the - values later, in csky_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. */ -#define add_dynamic_entry(TAG, VAL) \ - _bfd_elf_add_dynamic_entry (info, TAG, VAL) - - if (bfd_link_executable (info) && !add_dynamic_entry (DT_DEBUG, 0)) - return FALSE; - - if (htab->elf.sgot->size != 0 || htab->elf.splt->size) - { - if (!add_dynamic_entry (DT_PLTGOT, 0) - || !add_dynamic_entry (DT_PLTRELSZ, 0) - || !add_dynamic_entry (DT_PLTREL, DT_RELA) - || !add_dynamic_entry (DT_JMPREL, 0)) - return FALSE; - } - - if (relocs) - { - if (!add_dynamic_entry (DT_RELA, 0) - || !add_dynamic_entry (DT_RELASZ, 0) - || !add_dynamic_entry (DT_RELAENT, - sizeof (Elf32_External_Rela))) - return FALSE; - - /* If any dynamic relocs apply to a read-only section, - then we need a DT_TEXTREL entry. */ - if ((info->flags & DF_TEXTREL) == 0) - elf_link_hash_traverse (&htab->elf, - _bfd_elf_maybe_set_textrel, info); - - if ((info->flags & DF_TEXTREL) != 0 - && !add_dynamic_entry (DT_TEXTREL, 0)) - return FALSE; - } - } -#undef add_dynamic_entry - - return TRUE; + htab->elf.dt_pltgot_required = htab->elf.sgot->size != 0; + return _bfd_elf_add_dynamic_tags (output_bfd, info, relocs); } /* Finish up dynamic symbol handling. We set the contents of various |