public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* PR25882, .gnu.attributes are not checked for shared libraries
@ 2020-05-01  5:54 Alan Modra
  2020-05-01 22:23 ` Joseph Myers
  0 siblings, 1 reply; 6+ messages in thread
From: Alan Modra @ 2020-05-01  5:54 UTC (permalink / raw)
  To: binutils

This allows backend merge_private_bfd_data to examine shared library
e_flags and/or .gnu.attributes.  ARM and PowerPC have done so when
using ld.gold for a long time.

(The tic6x change below is dead code due to the earlier FIXME,
but this is probably one of the changes needed there.)

	PR 25882
bfd/
	* elf32-tic6x.c (elf32_tic6x_merge_attributes): Don't transfer
	Tag_ABI_PIC or Tag_ABI_PID from dynamic objects to the output.
ld/
	* ldlang.c (lang_check): Call bfd_merge_private_bfd_data for
	shared libraries.

diff --git a/bfd/elf32-tic6x.c b/bfd/elf32-tic6x.c
index d07902fe8a..20e4324b09 100644
--- a/bfd/elf32-tic6x.c
+++ b/bfd/elf32-tic6x.c
@@ -3866,6 +3866,9 @@ elf32_tic6x_merge_attributes (bfd *ibfd, struct bfd_link_info *info)
 
 	case Tag_ABI_PIC:
 	case Tag_ABI_PID:
+	  /* Don't transfer these tags from dynamic objects.  */
+	  if ((ibfd->flags & DYNAMIC) != 0)
+	    continue;
 	  if (out_attr[i].i > in_attr[i].i)
 	    out_attr[i].i = in_attr[i].i;
 	  break;
diff --git a/ld/ldlang.c b/ld/ldlang.c
index 2ef234f90b..b2cdb3603a 100644
--- a/ld/ldlang.c
+++ b/ld/ldlang.c
@@ -6938,11 +6938,12 @@ lang_check (void)
 		   bfd_printable_name (input_bfd), input_bfd,
 		   bfd_printable_name (link_info.output_bfd));
 	}
-      else if (bfd_count_sections (input_bfd))
-	{
-	  /* If the input bfd has no contents, it shouldn't set the
-	     private data of the output bfd.  */
 
+      /* If the input bfd has no contents, it shouldn't set the
+	 private data of the output bfd.  */
+      else if ((input_bfd->flags & DYNAMIC) != 0
+	       || bfd_count_sections (input_bfd) != 0)
+	{
 	  bfd_error_handler_type pfn = NULL;
 
 	  /* If we aren't supposed to warn about mismatched input

-- 
Alan Modra
Australia Development Lab, IBM

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

end of thread, other threads:[~2020-05-22  4:06 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-01  5:54 PR25882, .gnu.attributes are not checked for shared libraries Alan Modra
2020-05-01 22:23 ` Joseph Myers
2020-05-01 23:48   ` H.J. Lu
2020-05-02  3:28     ` Alan Modra
2020-05-02  4:24       ` H.J. Lu
2020-05-22  4:06       ` 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).