]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
PR25882, .gnu.attributes are not checked for shared libraries
authorAlan Modra <amodra@gmail.com>
Fri, 1 May 2020 05:53:17 +0000 (15:23 +0930)
committerAlan Modra <amodra@gmail.com>
Fri, 1 May 2020 06:02:36 +0000 (15:32 +0930)
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.

bfd/ChangeLog
bfd/elf32-tic6x.c
ld/ChangeLog
ld/ldlang.c

index fc1aca2a3913d27c20f1727998d29fb95a4a0896..15c77bece90f61ae9aaea64d536738733b3167e5 100644 (file)
@@ -1,3 +1,9 @@
+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
index d07902fe8a76e9e6c800fc7c372efa77961d1ba9..20e4324b0961d35f837e0d68e281039554e1a250 100644 (file)
@@ -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;
index d185af4b926c287f45faff09d5db03ee8e2c218c..323a956c65a157eeaf294bd8e5dcadb41d6f865f 100644 (file)
@@ -1,3 +1,9 @@
+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.
index 2ef234f90b2324acb176b24878528beeeaa63a52..b2cdb3603aa13d443c2e4a56f84c37d6d696d4e1 100644 (file)
@@ -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