* Fix Common symbol override test fails
@ 2017-12-06 7:27 Alan Modra
0 siblings, 0 replies; only message in thread
From: Alan Modra @ 2017-12-06 7:27 UTC (permalink / raw)
To: binutils
Fixes fails on SH and NDS32 introduced by dyn_reloc tidy. See the
comment for why check_relocs should generally ignore non-ALLOC
sections.
* 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.
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index c588280..91027d2 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,13 @@
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
struct elf_dyn_relocs throughout file instead.
(elf32_hppa_adjust_dynamic_symbol): Comment tidy.
diff --git a/bfd/elf32-lm32.c b/bfd/elf32-lm32.c
index 3867542..17b188b 100644
--- a/bfd/elf32-lm32.c
+++ b/bfd/elf32-lm32.c
@@ -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);
diff --git a/bfd/elf32-m32r.c b/bfd/elf32-m32r.c
index 39c7f75..cd9f9d2 100644
--- a/bfd/elf32-m32r.c
+++ b/bfd/elf32-m32r.c
@@ -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);
diff --git a/bfd/elf32-nds32.c b/bfd/elf32-nds32.c
index bfd21ae..80765c7 100644
--- a/bfd/elf32-nds32.c
+++ b/bfd/elf32-nds32.c
@@ -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 =
diff --git a/bfd/elf32-or1k.c b/bfd/elf32-or1k.c
index d1d27f1..424a2d3 100644
--- a/bfd/elf32-or1k.c
+++ b/bfd/elf32-or1k.c
@@ -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);
diff --git a/bfd/elf32-sh.c b/bfd/elf32-sh.c
index 420931b..0ed0deb 100644
--- a/bfd/elf32-sh.c
+++ b/bfd/elf32-sh.c
@@ -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);
--
Alan Modra
Australia Development Lab, IBM
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2017-12-06 7:27 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-06 7:27 Fix Common symbol override test fails Alan Modra
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).