]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Fix Common symbol override test fails
authorAlan Modra <amodra@gmail.com>
Wed, 6 Dec 2017 07:01:15 +0000 (17:31 +1030)
committerAlan Modra <amodra@gmail.com>
Wed, 6 Dec 2017 07:21:14 +0000 (17:51 +1030)
Fixes fails on SH and NDS32 introduced by dyn_reloc tidy.

* elf32-lm32.c (lm32_elf_check_relocs): Skip non-ALLOC sections.
* elf32-m32r.c (m32r_elf_check_relocs): Likewise.
* elf32-nds32.c (nds32_elf_check_relocs): Likewise.
* elf32-or1k.c (or1k_elf_check_relocs): Likewise.
* elf32-sh.c (sh_elf_check_relocs): Likewise.

bfd/ChangeLog
bfd/elf32-lm32.c
bfd/elf32-m32r.c
bfd/elf32-nds32.c
bfd/elf32-or1k.c
bfd/elf32-sh.c

index c5882809b505f97018f0171eed01b546aa2eb146..91027d29423b9f220ebbac7f25597e54a9ba6ef1 100644 (file)
@@ -1,3 +1,11 @@
+2017-12-06  Alan Modra  <amodra@gmail.com>
+
+       * elf32-lm32.c (lm32_elf_check_relocs): Skip non-ALLOC sections.
+       * elf32-m32r.c (m32r_elf_check_relocs): Likewise.
+       * elf32-nds32.c (nds32_elf_check_relocs): Likewise.
+       * elf32-or1k.c (or1k_elf_check_relocs): Likewise.
+       * elf32-sh.c (sh_elf_check_relocs): Likewise.
+
 2017-12-06  Alan Modra  <amodra@gmail.com>
 
        * elf32-hppa.c (struct elf32_hppa_dyn_reloc_entry): Delete.  Use
index 386754241d20cd76a54fcece3b8ba135d8b7cd61..17b188be8a9c30da3f9269a9ec295fe246bf1d8f 100644 (file)
@@ -1165,6 +1165,15 @@ lm32_elf_check_relocs (bfd *abfd,
   if (bfd_link_relocatable (info))
     return TRUE;
 
+  /* Don't do anything special with non-loaded, non-alloced sections.
+     In particular, any relocs in such sections should not affect GOT
+     and PLT reference counting (ie. we don't allow them to create GOT
+     or PLT entries), there's no possibility or desire to optimize TLS
+     relocs, and there's not much point in propagating relocs to shared
+     libs that the dynamic linker won't relocate.  */
+  if ((sec->flags & SEC_ALLOC) == 0)
+    return TRUE;
+
   symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
   sym_hashes = elf_sym_hashes (abfd);
   sym_hashes_end = sym_hashes + symtab_hdr->sh_size/sizeof (Elf32_External_Sym);
index 39c7f75689e09b435299e33ec1cb89f46d1fa788..cd9f9d263475cee6b46e994def39da6560ab4007 100644 (file)
@@ -3547,6 +3547,15 @@ m32r_elf_check_relocs (bfd *abfd,
   if (bfd_link_relocatable (info))
     return TRUE;
 
+  /* Don't do anything special with non-loaded, non-alloced sections.
+     In particular, any relocs in such sections should not affect GOT
+     and PLT reference counting (ie. we don't allow them to create GOT
+     or PLT entries), there's no possibility or desire to optimize TLS
+     relocs, and there's not much point in propagating relocs to shared
+     libs that the dynamic linker won't relocate.  */
+  if ((sec->flags & SEC_ALLOC) == 0)
+    return TRUE;
+
   sreloc = NULL;
   symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
   sym_hashes = elf_sym_hashes (abfd);
index bfd21aecbe61300ce9f823b320fe204832d06367..80765c7465062dfba8cbd7b0f3ba8940870cc302 100644 (file)
@@ -6100,6 +6100,15 @@ nds32_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
   if (bfd_link_relocatable (info))
     return TRUE;
 
+  /* Don't do anything special with non-loaded, non-alloced sections.
+     In particular, any relocs in such sections should not affect GOT
+     and PLT reference counting (ie. we don't allow them to create GOT
+     or PLT entries), there's no possibility or desire to optimize TLS
+     relocs, and there's not much point in propagating relocs to shared
+     libs that the dynamic linker won't relocate.  */
+  if ((sec->flags & SEC_ALLOC) == 0)
+    return TRUE;
+
   symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
   sym_hashes = elf_sym_hashes (abfd);
   sym_hashes_end =
index d1d27f1ed3e02321be1b28afdf32582cbaa23a82..424a2d31d36c636143e1d65e4a5089ca264a92c4 100644 (file)
@@ -1301,6 +1301,15 @@ or1k_elf_check_relocs (bfd *abfd,
   if (bfd_link_relocatable (info))
     return TRUE;
 
+  /* Don't do anything special with non-loaded, non-alloced sections.
+     In particular, any relocs in such sections should not affect GOT
+     and PLT reference counting (ie. we don't allow them to create GOT
+     or PLT entries), there's no possibility or desire to optimize TLS
+     relocs, and there's not much point in propagating relocs to shared
+     libs that the dynamic linker won't relocate.  */
+  if ((sec->flags & SEC_ALLOC) == 0)
+    return TRUE;
+
   symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
   sym_hashes = elf_sym_hashes (abfd);
 
index 420931bfc31c1027c8ede654e26794240cd0748d..0ed0debdf44d00bb4f50a5220a48aa4f3f95187f 100644 (file)
@@ -5782,6 +5782,15 @@ sh_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec,
   if (bfd_link_relocatable (info))
     return TRUE;
 
+  /* Don't do anything special with non-loaded, non-alloced sections.
+     In particular, any relocs in such sections should not affect GOT
+     and PLT reference counting (ie. we don't allow them to create GOT
+     or PLT entries), there's no possibility or desire to optimize TLS
+     relocs, and there's not much point in propagating relocs to shared
+     libs that the dynamic linker won't relocate.  */
+  if ((sec->flags & SEC_ALLOC) == 0)
+    return TRUE;
+
   BFD_ASSERT (is_sh_elf (abfd));
 
   symtab_hdr = &elf_symtab_hdr (abfd);