]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
elflint: Allow SHF_EXCLUDE as generic section flag when --gnu is given.
authorMark Wielaard <mark@klomp.org>
Thu, 16 Apr 2020 16:48:58 +0000 (18:48 +0200)
committerMark Wielaard <mark@klomp.org>
Tue, 21 Apr 2020 20:58:06 +0000 (22:58 +0200)
Strictly speaking SHF_EXCLUDE is a processor specific section flag,
but it is used generically in the GNU toolchain. For example when
adding .gnu.lto_ sections.

Signed-off-by: Mark Wielaard <mark@klomp.org>
src/ChangeLog
src/elflint.c

index e11fe79a53d8c0e5708eb6a2059502cb10910a1f..dc345a04fc668a435b64ade9446d071a16a5a591 100644 (file)
@@ -1,3 +1,8 @@
+2020-04-16  Mark Wielaard  <mark@klomp.org>
+
+       * elflint.c (check_sections): Mask out SHF_EXCLUDE from processor
+       specific section flags when --gnu is given.
+
 2020-02-08  Mark Wielaard  <mark@klomp.org>
 
        * elflint.c (check_program_header): Handle PT_GNU_PROPERTY.
index 480d84ba9dc4e099241730cf5145fd616e1e7113..0ef43236605d8261bb7412f631d5409130dec2d1 100644 (file)
@@ -3921,6 +3921,11 @@ section [%2zu] '%s': size not multiple of entry size\n"),
          GElf_Xword sh_flags = shdr->sh_flags & ~(GElf_Xword) ALL_SH_FLAGS;
          if (sh_flags & SHF_MASKPROC)
            {
+             /* Strictly speaking SHF_EXCLUDE is a processor specific
+                section flag, but it is used generically in the GNU
+                toolchain.  */
+             if (gnuld)
+               sh_flags &= ~(GElf_Xword) SHF_EXCLUDE;
              if (!ebl_machine_section_flag_check (ebl,
                                                   sh_flags & SHF_MASKPROC))
                ERROR (gettext ("section [%2zu] '%s'"