From 9c1d7a087682074d585253ad38719ec2363eb2b7 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Tue, 8 Mar 2016 20:41:41 -0800 Subject: 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. --- bfd/elflink.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'bfd/elflink.c') 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) -- cgit v1.1