public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] nios2: Don't check relocations in non-loaded, non-alloced sections
@ 2020-05-31 12:23 H.J. Lu
  2020-06-03 15:50 ` Nick Clifton
  0 siblings, 1 reply; 2+ messages in thread
From: H.J. Lu @ 2020-05-31 12:23 UTC (permalink / raw)
  To: binutils; +Cc: Sandra Loosemore, Andrew Jenner

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.

This fixed:

FAIL: Common symbol override test

OK for master?

H.J.
---
	PR ld/26066
	* elf32-nios2.c (nios2_elf32_check_relocs): Skip non-loaded,
	non-alloced sections.
---
 bfd/elf32-nios2.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/bfd/elf32-nios2.c b/bfd/elf32-nios2.c
index 0b2e68ebd6..f0cdd5203a 100644
--- a/bfd/elf32-nios2.c
+++ b/bfd/elf32-nios2.c
@@ -4724,6 +4724,15 @@ nios2_elf32_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 = (sym_hashes
-- 
2.26.2


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] nios2: Don't check relocations in non-loaded, non-alloced sections
  2020-05-31 12:23 [PATCH] nios2: Don't check relocations in non-loaded, non-alloced sections H.J. Lu
@ 2020-06-03 15:50 ` Nick Clifton
  0 siblings, 0 replies; 2+ messages in thread
From: Nick Clifton @ 2020-06-03 15:50 UTC (permalink / raw)
  To: H.J. Lu, binutils; +Cc: Sandra Loosemore

Hi H.J.

> 	PR ld/26066
> 	* elf32-nios2.c (nios2_elf32_check_relocs): Skip non-loaded,
> 	non-alloced sections.
 
Approved - please apply.

Cheers
  Nick


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-06-03 15:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-31 12:23 [PATCH] nios2: Don't check relocations in non-loaded, non-alloced sections H.J. Lu
2020-06-03 15:50 ` Nick Clifton

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).