Don't merge sections with differing MASKPROC or MASKOS flags
authorAlan Modra <amodra@gmail.com>
Tue, 10 Mar 2020 23:34:53 +0000 (10:04 +1030)
committerAlan Modra <amodra@gmail.com>
Wed, 11 Mar 2020 04:30:44 +0000 (15:00 +1030)
Not just SHF_EXCLUDE but any of these flags ought to prevent merging
of sections for ld -r.

* ldelf.c (elf_orphan_compatible): Return false when two sections
have differing SHF_MASKPROC or SHF_MASKOS flags.

ld/ChangeLog
ld/ldelf.c

index 666ce5cb7dec230dfe203f568fe620db74e79f7b..5b8db22775dedf42b7351c1eea198d6255963d03 100644 (file)
@@ -1,3 +1,8 @@
+2020-03-11  Alan Modra  <amodra@gmail.com>
+
+       * ldelf.c (elf_orphan_compatible): Return false when two sections
+       have differing SHF_MASKPROC or SHF_MASKOS flags.
+
 2020-03-05  Alan Modra  <amodra@gmail.com>
 
        PR 25570
index b055929d02aa60ccdf704b74fab215fff1e929e9..fa4bf9f7278393a6a30a8e2e17b6ae7fdb606755 100644 (file)
@@ -1865,13 +1865,13 @@ elf_orphan_compatible (asection *in, asection *out)
   if (elf_section_data (out)->this_hdr.sh_info
       != elf_section_data (in)->this_hdr.sh_info)
     return FALSE;
-  /* We can't merge with member of output section group nor merge two
-     sections with differing SHF_EXCLUDE when doing a relocatable link.
-   */
+  /* We can't merge with a member of an output section group or merge
+     two sections with differing SHF_EXCLUDE or other processor and OS
+     specific flags when doing a relocatable link.  */
   if (bfd_link_relocatable (&link_info)
       && (elf_next_in_group (out) != NULL
          || ((elf_section_flags (out) ^ elf_section_flags (in))
-             & SHF_EXCLUDE) != 0))
+             & (SHF_MASKPROC | SHF_MASKOS)) != 0))
     return FALSE;
   return _bfd_elf_match_sections_by_type (link_info.output_bfd, out,
                                          in->owner, in);
This page took 0.027024 seconds and 4 git commands to generate.