aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2016-03-08 20:41:41 -0800
committerH.J. Lu <hjl.tools@gmail.com>2016-03-08 20:45:52 -0800
commit9c1d7a087682074d585253ad38719ec2363eb2b7 (patch)
tree782d27928686e190c232f3fe9457a5e30d574c80 /bfd
parent7ff6eb49a2b79a2ad95c814ad990316545bf3692 (diff)
downloadfsf-binutils-gdb-9c1d7a087682074d585253ad38719ec2363eb2b7.zip
fsf-binutils-gdb-9c1d7a087682074d585253ad38719ec2363eb2b7.tar.gz
fsf-binutils-gdb-9c1d7a087682074d585253ad38719ec2363eb2b7.tar.bz2
Don't create dynamic sections when relocatable
Since dynamic sections aren't applicable to relocatable file, don't create dynamic sections for -E/--dynamic-list when relocatable. bfd/ PR ld/19789 * elflink.c (elf_link_add_object_symbols): Create dynamic sections for -E/--dynamic-list only when not relocatable. ld/ PR ld/19789 * testsuite/ld-elf/pr19789.d: New file. * testsuite/ld-elf/pr19789.s: Likewise.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog6
-rw-r--r--bfd/elflink.c4
2 files changed, 8 insertions, 2 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index e2193a5..fe08c02 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,11 @@
2016-03-08 H.J. Lu <hongjiu.lu@intel.com>
+ PR ld/19789
+ * elflink.c (elf_link_add_object_symbols): Create dynamic sections
+ for -E/--dynamic-list only when not relocatable.
+
+2016-03-08 H.J. Lu <hongjiu.lu@intel.com>
+
PR ld/19784
* elf32-i386.c (elf_i386_check_relocs): Increment PLT reference
count for locally defined local IFUNC symbols in shared object.
diff --git a/bfd/elflink.c b/bfd/elflink.c
index ccff780..991efac 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -3621,8 +3621,8 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
make a shared library. */
if (!just_syms
&& (bfd_link_pic (info)
- || info->export_dynamic
- || info->dynamic)
+ || (!bfd_link_relocatable (info)
+ && (info->export_dynamic || info->dynamic)))
&& is_elf_hash_table (htab)
&& info->output_bfd->xvec == abfd->xvec
&& !htab->dynamic_sections_created)