From b1faf99f3e546df2cd302bb1ad36a2078224fe8b Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@dereferenced.org>
Date: Fri, 30 Oct 2020 16:59:48 -0600
Subject: [PATCH] Revert "PR25882, .gnu.attributes are not checked for shared
 libraries"

This reverts commit a8acd6eeb6dc2cc5460ece90f90ebe36b56b20ba.
---
 bfd/ChangeLog     | 6 ------
 bfd/elf32-tic6x.c | 3 ---
 ld/ChangeLog      | 6 ------
 ld/ldlang.c       | 9 ++++-----
 4 files changed, 4 insertions(+), 20 deletions(-)

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 9fac12538a..b5461494e8 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1422,12 +1422,6 @@
 	accessing root.u.def of symbols.  Also check root.u.def.section
 	is non-NULL.  Reverse tests so as to make the logic positive.
 
-2020-05-01  Alan Modra  <amodra@gmail.com>
-
-	PR 25882
-	* elf32-tic6x.c (elf32_tic6x_merge_attributes): Don't transfer
-	Tag_ABI_PIC or Tag_ABI_PID from dynamic objects to the output.
-
 2020-05-01  Alan Modra  <amodra@gmail.com>
 
 	PR 25882
diff --git a/bfd/elf32-tic6x.c b/bfd/elf32-tic6x.c
index b8b916bfd3..91bb6a10b1 100644
--- a/bfd/elf32-tic6x.c
+++ b/bfd/elf32-tic6x.c
@@ -3748,9 +3748,6 @@ 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/ChangeLog b/ld/ChangeLog
index 4eec7d2977..b93452f70c 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1319,12 +1319,6 @@
 	* testsuite/ld-aarch64/farcall-group.d: New test driver.
 	* testsuite/ld-aarch64/aarch64-elf.exp: Run the new test.
 
-2020-05-01  Alan Modra  <amodra@gmail.com>
-
-	PR 25882
-	* ldlang.c (lang_check): Call bfd_merge_private_bfd_data for
-	shared libraries.
-
 2020-05-01  Alan Modra  <amodra@gmail.com>
 
 	* po/BLD-POTFILES.in: Regenerate.
diff --git a/ld/ldlang.c b/ld/ldlang.c
index 9977195074..173d8ec349 100644
--- a/ld/ldlang.c
+++ b/ld/ldlang.c
@@ -6972,12 +6972,11 @@ lang_check (void)
 		   bfd_printable_name (input_bfd), input_bfd,
 		   bfd_printable_name (link_info.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)
+      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.  */
+
 	  bfd_error_handler_type pfn = NULL;
 
 	  /* If we aren't supposed to warn about mismatched input
-- 
2.29.2

