public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] ld: Don't check EI_OSABI value for input SHF_GNU_RETAIN section
@ 2021-02-27  6:29 Fangrui Song
  2021-03-01 12:35 ` Alan Modra
  0 siblings, 1 reply; 2+ messages in thread
From: Fangrui Song @ 2021-02-27  6:29 UTC (permalink / raw)
  To: binutils, Jozef Lawrynowicz, Nick Clifton; +Cc: Fangrui Song

This is consistent with how ld handles STT_GNU_IFUNC/STB_GNU_UNIQUE and allows
other OSABI to adopt SHF_GNU_RETAIN.

	PR 27282
	* elflink.c (bfd_elf_gc_sections): Delete EI_OSABI check.
---
 bfd/elflink.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/bfd/elflink.c b/bfd/elflink.c
index 7b74f2653c2..150feb9c93f 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -14078,8 +14078,7 @@ bfd_elf_gc_sections (bfd *abfd, struct bfd_link_info *info)
 		|| (elf_section_data (o)->this_hdr.sh_type == SHT_NOTE
 		    && elf_next_in_group (o) == NULL
 		    && elf_linked_to_section (o) == NULL)
-		|| ((elf_tdata (sub)->has_gnu_osabi & elf_gnu_osabi_retain)
-		    && (elf_section_flags (o) & SHF_GNU_RETAIN))))
+		|| (elf_section_flags (o) & SHF_GNU_RETAIN)))
 	  {
 	    if (!_bfd_elf_gc_mark (info, o, gc_mark_hook))
 	      return FALSE;
-- 
2.30.1.766.gb4fecdf3b7-goog


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

* Re: [PATCH] ld: Don't check EI_OSABI value for input SHF_GNU_RETAIN section
  2021-02-27  6:29 [PATCH] ld: Don't check EI_OSABI value for input SHF_GNU_RETAIN section Fangrui Song
@ 2021-03-01 12:35 ` Alan Modra
  0 siblings, 0 replies; 2+ messages in thread
From: Alan Modra @ 2021-03-01 12:35 UTC (permalink / raw)
  To: Fangrui Song; +Cc: binutils, Jozef Lawrynowicz, Nick Clifton

On Fri, Feb 26, 2021 at 10:29:05PM -0800, Fangrui Song via Binutils wrote:
> This is consistent with how ld handles STT_GNU_IFUNC/STB_GNU_UNIQUE and allows
> other OSABI to adopt SHF_GNU_RETAIN.

I think this is going in the wrong direction.  STT_GNU_IFUNC and
STB_GNU_UNIQUE, which are both in the OS specific range, shouldn't
really be recognized without first checking OSABI.  Let's not make
that worse by allowing SHF_GNU_RETAIN too.

-- 
Alan Modra
Australia Development Lab, IBM

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

end of thread, other threads:[~2021-03-01 12:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-27  6:29 [PATCH] ld: Don't check EI_OSABI value for input SHF_GNU_RETAIN section Fangrui Song
2021-03-01 12:35 ` 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).