[PATCH] D92052: [MC][ELF] Accept abbreviated form with sh_flags and sh_entsize

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 24 12:14:33 PST 2020


MaskRay added a comment.

This is known. I'd like it to be an error but it is unfortunate that GCC uses it this way. Can you share a code snippet which can trigger the relevant GCC logic?

  /* If we have already declared this section, we can use an
     abbreviated form to switch back to it -- unless this section is
     part of a COMDAT groups, in which case GAS requires the full
     declaration every time.  */
  if (!(HAVE_COMDAT_GROUP && (flags & SECTION_LINKONCE))
      && (flags & SECTION_DECLARED))
    { 
      fprintf (asm_out_file, "\t.section\t%s\n", name);
      return;
    }

There is a variant where an empty string literal is used (https://sourceware.org/pipermail/binutils/2020-March/110441.html): I haven't receive a reply yet.
Shall we continue erroring for that?



================
Comment at: llvm/test/MC/ELF/section-entsize-not-repeated.s:1
+# RUN: llvm-mc -triple=x86_64 %s -o - | FileCheck %s
+
----------------
I'd rename it to `section-omitted-attributes.s` 


================
Comment at: llvm/test/MC/ELF/section-flags-changed-2.s:4
+foo:
+.section .foo,"ax", at progbits
+
----------------
Can you merge these tests into section-entsize-changed.s?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D92052/new/

https://reviews.llvm.org/D92052



More information about the llvm-commits mailing list