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

Tobias Burnus via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 7 02:06:59 PST 2020


burnus added inline comments.


================
Comment at: llvm/test/MC/ELF/section-omitted-attributes.s:3
+
+# CHECK: .section        .foo,"aM", at progbits,1
+
----------------
jhenderson wrote:
> Is it worth adding something like this after this line:
> 
> ```
> CHECK-NOT: .section
> CHECK-NOT: .pushsection
> ```
> ? I don't know if it's actually what happens, but it wouldn't make sense to repeat the section directives if they aren't needed.
> Is it worth adding something like this after this line:
> 
> ```
> CHECK-NOT: .section
> CHECK-NOT: .pushsection
> ```
> ? I don't know if it's actually what happens, but it wouldn't make sense to repeat the section directives if they aren't needed.

What happens with `llvm-mc -triple=x86_64 -o -` is (full output without empty lines):
```
        .text
        .section        .foo,"aM", at progbits,1
```
Thus, all .foo sections are merged and the originally specified flag/entsize is used.

We could add the `CHECK-NOT` but my feeling is that it is needed.

In the real-world code, the '.section' are repeated (with GCC) with `-ffunction-section` as the example https://godbolt.org/ shows – as described above in my previous comment ( https://reviews.llvm.org/D92052#2414890 ).

To quote @MaskRay: "a jump table causes the second .section .text.foobar directive without attributes. This makes sense."


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