[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
Tue Nov 24 14:28:20 PST 2020

burnus added a comment.

In D92052#2414665 <https://reviews.llvm.org/D92052#2414665>, @MaskRay wrote:

> 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?

It looks as if one way to get it is requires the `-ffunction-sections` flag, example: https://godbolt.org/z/Yfveoh which creates:

- `.section        .text.ULtod,"ax", at progbits`
- `.section        .text.ULtod`

`-ffunction-sections`/`-fdata-sections` is described as: //Place each function or data item into its own section in the output file if the target supports arbitrary sections. ... Only use these options when there are significant benefits from doing so.  When you specify these options, the assembler and linker create larger object and executable files and are also slower.//

As there is already a huge growth, avoiding the repetition of the flags/entsize helps a bit. Thus, the GCC and GNU assembler short variant makes kind of sense.

> 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?

No strong opinion, but I don't see how why one would write such code in real-world code; and if there is no good reason for valid code, giving an error should not harm, should it?

  rG LLVM Github Monorepo



More information about the llvm-commits mailing list