]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
FIXME for merging of e_flags and .gnu.attributes
authorAlan Modra <amodra@gmail.com>
Fri, 1 May 2020 05:50:14 +0000 (15:20 +0930)
committerAlan Modra <amodra@gmail.com>
Fri, 1 May 2020 06:02:36 +0000 (15:32 +0930)
Code in the linker, present before the addition of .gnu.attributes
support, results in shared libraries not being considered by BFD when
merging e_flags and .gnu.attributes from input files to the output.
That doesn't seem correct to me, but I don't know enough about all the
various ABIs to change the behaviour with any confidence.  So this
patch merely punts on dynamic objects in merge_private_bfd_data target
functions, with a FIXME for maintainer attention.

I haven't excluded shared libraries from being considered where the
target merge_private_bfd_data (a) already has code dealing with shared
libraries, or (b) where that function just sets the output to the most
constraining arch/mach combination and other fairly trivial merges, or
(c) when the target has no shared library linker support.

In (a) are: arc, arm, aarch64, riscv, sparc.
In (b) are: bpf, cris, csky, m32r, m68k, mn10300, nios2, tilegx,
    tilepro, vax, visium, xtensa.
In (c) are: bpf, cr16, h8300, iq2000, m32c, m68hc11, m68hc12, mcore,
    mep, msp430, mt, rl78, rx, v850.

PR 25882
* elf32-bfin.c (elf32_bfin_merge_private_bfd_data): Add FIXME.
* elf32-frv.c (frv_elf_merge_private_bfd_data): Likewise.
* elfxx-mips.c (_bfd_mips_elf_merge_private_bfd_data): Likewise.
* elf32-nds32.c (nds32_elf_merge_private_bfd_data): Likewise.
* elf32-score.c (s3_elf32_score_merge_private_bfd_data): Likewise.
* elf32-score7.c (s7_elf32_score_merge_private_bfd_data): Likewise.
* elf32-sh.c (sh_elf_merge_private_data): Likewise.
* elf32-tic6x.c (elf32_tic6x_merge_attributes): Likewise.
* elf64-ia64-vms.c (elf64_ia64_merge_private_bfd_data): Likewise.
* elfnn-ia64.c (elfNN_ia64_merge_private_bfd_data): Likewise.

bfd/ChangeLog
bfd/elf32-bfin.c
bfd/elf32-frv.c
bfd/elf32-nds32.c
bfd/elf32-score.c
bfd/elf32-score7.c
bfd/elf32-sh.c
bfd/elf32-tic6x.c
bfd/elf64-ia64-vms.c
bfd/elfnn-ia64.c
bfd/elfxx-mips.c

index 1413be60adc79f9c384d1d4a5ca2a2eaec969ee5..fc1aca2a3913d27c20f1727998d29fb95a4a0896 100644 (file)
@@ -1,3 +1,17 @@
+2020-05-01  Alan Modra  <amodra@gmail.com>
+
+       PR 25882
+       * elf32-bfin.c (elf32_bfin_merge_private_bfd_data): Add FIXME.
+       * elf32-frv.c (frv_elf_merge_private_bfd_data): Likewise.
+       * elfxx-mips.c (_bfd_mips_elf_merge_private_bfd_data): Likewise.
+       * elf32-nds32.c (nds32_elf_merge_private_bfd_data): Likewise.
+       * elf32-score.c (s3_elf32_score_merge_private_bfd_data): Likewise.
+       * elf32-score7.c (s7_elf32_score_merge_private_bfd_data): Likewise.
+       * elf32-sh.c (sh_elf_merge_private_data): Likewise.
+       * elf32-tic6x.c (elf32_tic6x_merge_attributes): Likewise.
+       * elf64-ia64-vms.c (elf64_ia64_merge_private_bfd_data): Likewise.
+       * elfnn-ia64.c (elfNN_ia64_merge_private_bfd_data): Likewise.
+
 2020-05-01  Alan Modra  <amodra@gmail.com>
 
        PR 25882
index e5a83ba49a13ff8eacd49671cd868ff85b62c96c..e6383a782ff6c7a0c5bb525a9b0c119e5fbc4682 100644 (file)
@@ -4755,6 +4755,10 @@ elf32_bfin_merge_private_bfd_data (bfd *ibfd, struct bfd_link_info *info)
   flagword old_flags, new_flags;
   bfd_boolean error = FALSE;
 
+  /* FIXME: What should be checked when linking shared libraries?  */
+  if ((ibfd->flags & DYNAMIC) != 0)
+    return TRUE;
+
   new_flags = elf_elfheader (ibfd)->e_flags;
   old_flags = elf_elfheader (obfd)->e_flags;
 
index 056cc93055dac3d86a693b487b3d72b2bc9d4a6e..d2a18fd564a92766e8179c8bdc5467a47d3264a3 100644 (file)
@@ -6344,6 +6344,10 @@ frv_elf_merge_private_bfd_data (bfd *ibfd, struct bfd_link_info *info)
   char new_opt[80];
   char old_opt[80];
 
+  /* FIXME: What should be checked when linking shared libraries?  */
+  if ((ibfd->flags & DYNAMIC) != 0)
+    return TRUE;
+
   new_opt[0] = old_opt[0] = '\0';
   new_flags = elf_elfheader (ibfd)->e_flags;
   old_flags = elf_elfheader (obfd)->e_flags;
index fc4d002f0d9386ddc0a35b6ff31817d3099fefef..6b0b813af0bf3521e1c6bfdba61e4af7dc3c630a 100644 (file)
@@ -6817,6 +6817,10 @@ nds32_elf_merge_private_bfd_data (bfd *ibfd, struct bfd_link_info *info)
   flagword out_fpu_config;
   flagword in_fpu_config;
 
+  /* FIXME: What should be checked when linking shared libraries?  */
+  if ((ibfd->flags & DYNAMIC) != 0)
+    return TRUE;
+
   /* TODO: Revise to use object-attributes instead.  */
   if (!nds32_check_vec_size (ibfd))
     return FALSE;
index c5e6346e93ffd23e3f6c768586b44009b962be78..d1a910f2795e9701fd96b291183bf9411164948f 100644 (file)
@@ -4021,6 +4021,10 @@ s3_elf32_score_merge_private_bfd_data (bfd *ibfd, struct bfd_link_info *info)
   if (!_bfd_generic_verify_endian_match (ibfd, info))
     return FALSE;
 
+  /* FIXME: What should be checked when linking shared libraries?  */
+  if ((ibfd->flags & DYNAMIC) != 0)
+    return TRUE;
+
   in_flags  = elf_elfheader (ibfd)->e_flags;
   out_flags = elf_elfheader (obfd)->e_flags;
 
index 0f647feaeb8f0c8ca60da534ad71cc9ae16fe001..ab5e32a29a4cc2d923ce13bbee5c4e95770796cc 100644 (file)
@@ -3826,6 +3826,10 @@ s7_elf32_score_merge_private_bfd_data (bfd *ibfd, struct bfd_link_info *info)
   if (!_bfd_generic_verify_endian_match (ibfd, info))
     return FALSE;
 
+  /* FIXME: What should be checked when linking shared libraries?  */
+  if ((ibfd->flags & DYNAMIC) != 0)
+    return TRUE;
+
   in_flags  = elf_elfheader (ibfd)->e_flags;
   out_flags = elf_elfheader (obfd)->e_flags;
 
index 24e879e4f41c6e2b2776e8474aaee560b2161df5..24203e0d5553b56efc0f380d2c4c58517c15082f 100644 (file)
@@ -6028,6 +6028,10 @@ sh_elf_merge_private_data (bfd *ibfd, struct bfd_link_info *info)
 {
   bfd *obfd = info->output_bfd;
 
+  /* FIXME: What should be checked when linking shared libraries?  */
+  if ((ibfd->flags & DYNAMIC) != 0)
+    return TRUE;
+
   if (! is_sh_elf (ibfd) || ! is_sh_elf (obfd))
     return TRUE;
 
index 95814d3abf1d40f57c5ad18f3193ed77615c7772..d07902fe8a76e9e6c800fc7c372efa77961d1ba9 100644 (file)
@@ -3724,6 +3724,10 @@ elf32_tic6x_merge_attributes (bfd *ibfd, struct bfd_link_info *info)
   int i;
   int array_align_in, array_align_out, array_expect_in, array_expect_out;
 
+  /* FIXME: What should be checked when linking shared libraries?  */
+  if ((ibfd->flags & DYNAMIC) != 0)
+    return TRUE;
+
   if (!elf_known_obj_attributes_proc (obfd)[0].i)
     {
       /* This is the first object.  Copy the attributes.  */
index d40fa4277a24dc85e34f368e58ef7e72f33d6a46..159698fa07fe3e46ccb693bdfa48afa63d250a26 100644 (file)
@@ -4233,6 +4233,10 @@ elf64_ia64_merge_private_bfd_data (bfd *ibfd, struct bfd_link_info *info)
   flagword in_flags;
   bfd_boolean ok = TRUE;
 
+  /* FIXME: What should be checked when linking shared libraries?  */
+  if ((ibfd->flags & DYNAMIC) != 0)
+    return TRUE;
+
   /* Don't even pretend to support mixed-format linking.  */
   if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour
       || bfd_get_flavour (obfd) != bfd_target_elf_flavour)
index cd94158aba186f87687038027213b3b8d5db8c1c..0cdd6b58c9dc4e7141ceaa6c1da929c766e61f76 100644 (file)
@@ -4744,6 +4744,10 @@ elfNN_ia64_merge_private_bfd_data (bfd *ibfd, struct bfd_link_info *info)
   flagword in_flags;
   bfd_boolean ok = TRUE;
 
+  /* FIXME: What should be checked when linking shared libraries?  */
+  if ((ibfd->flags & DYNAMIC) != 0)
+    return TRUE;
+
   if (!is_ia64_elf (ibfd) || !is_ia64_elf (obfd))
     return TRUE;
 
index 2f26d7ae832a5d1f05f69af35dd1142cbe3ebf49..9ce205e9cf66c2f81f9601479c29f33f8b441857 100644 (file)
@@ -15767,6 +15767,7 @@ _bfd_mips_elf_merge_private_bfd_data (bfd *ibfd, struct bfd_link_info *info)
   /* Check to see if the input BFD actually contains any sections.  If not,
      then it has no attributes, and its flags may not have been initialized
      either, but it cannot actually cause any incompatibility.  */
+  /* FIXME: This excludes any input shared library from consideration.  */
   for (sec = ibfd->sections; sec != NULL; sec = sec->next)
     {
       /* Ignore synthetic sections and empty .text, .data and .bss sections