aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog9
-rw-r--r--bfd/elf-bfd.h3
-rw-r--r--bfd/elflink.c6
-rw-r--r--bfd/elfxx-mips.c1
4 files changed, 18 insertions, 1 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index d9465d5..2aa411d 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,14 @@
2018-06-14 Alan Modra <amodra@gmail.com>
+ * elf-bfd.h (struct elf_link_hash_table): Add "dynamic_relocs".
+ * elflink.c (_bfd_elf_init_2_index_sections): Comment fix.
+ (_bfd_elf_add_dynamic_entry): Set "dynamic_relocs".
+ (_bfd_elf_link_renumber_dynsyms): Exclude all section symbols when
+ "dynamic_relocs" is not set.
+ * elfxx-mips.c (count_section_dynsyms): Likewise.
+
+2018-06-14 Alan Modra <amodra@gmail.com>
+
PR 23282
* bfdio.c (bfd_seek): Optimize away seeks to current position.
diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h
index 032e11f..788fdf8 100644
--- a/bfd/elf-bfd.h
+++ b/bfd/elf-bfd.h
@@ -543,6 +543,9 @@ struct elf_link_hash_table
when linking against or generating a shared object. */
bfd_boolean dynamic_sections_created;
+ /* Whether dynamic relocations are present. */
+ bfd_boolean dynamic_relocs;
+
/* True if this target has relocatable executables, so needs dynamic
section symbols. */
bfd_boolean is_relocatable_executable;
diff --git a/bfd/elflink.c b/bfd/elflink.c
index 9dfd3e9..36e0c37 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -953,6 +953,7 @@ _bfd_elf_link_renumber_dynsyms (bfd *output_bfd,
for (p = output_bfd->sections; p ; p = p->next)
if ((p->flags & SEC_EXCLUDE) == 0
&& (p->flags & SEC_ALLOC) != 0
+ && elf_hash_table (info)->dynamic_relocs
&& !(*bed->elf_backend_omit_section_dynsym) (output_bfd, info, p))
{
++dynsymcount;
@@ -3456,6 +3457,9 @@ _bfd_elf_add_dynamic_entry (struct bfd_link_info *info,
if (! is_elf_hash_table (hash_table))
return FALSE;
+ if (tag == DT_RELA || tag == DT_REL)
+ hash_table->dynamic_relocs = TRUE;
+
bed = get_elf_backend_data (hash_table->dynobj);
s = bfd_get_linker_section (hash_table->dynobj, ".dynamic");
BFD_ASSERT (s != NULL);
@@ -7015,7 +7019,7 @@ _bfd_elf_init_2_index_sections (bfd *output_bfd, struct bfd_link_info *info)
asection *s;
/* Data first, since setting text_index_section changes
- _bfd_elf_link_omit_section_dynsym. */
+ _bfd_elf_omit_section_dynsym_default. */
for (s = output_bfd->sections; s != NULL; s = s->next)
if (((s->flags & (SEC_EXCLUDE | SEC_ALLOC | SEC_READONLY)) == SEC_ALLOC)
&& !_bfd_elf_omit_section_dynsym_default (output_bfd, info, s))
diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c
index 205faa6..6e2f6fe 100644
--- a/bfd/elfxx-mips.c
+++ b/bfd/elfxx-mips.c
@@ -3813,6 +3813,7 @@ count_section_dynsyms (bfd *output_bfd, struct bfd_link_info *info)
for (p = output_bfd->sections; p ; p = p->next)
if ((p->flags & SEC_EXCLUDE) == 0
&& (p->flags & SEC_ALLOC) != 0
+ && elf_hash_table (info)->dynamic_relocs
&& !(*bed->elf_backend_omit_section_dynsym) (output_bfd, info, p))
++count;
}