On Wed, Nov 18, 2020 at 1:04 PM Jakub Jelinek via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
> On Wed, Nov 18, 2020 at 12:51:02PM +0100, Tobias Burnus wrote:
> > As noted by Matthias when bootstrapping with AMD GCN support [PR97827]:
> > Assembler source code generated by GCC might no longer assembly with
> > LLVM's 'mc' since LLVM 11.
> >
> > The reason is that GCC generates on purpose first the section with
> > the flags, e.g. (via mergeable_constant_section)
> >    .section        .rodata.cst8,"aM",@progbits,8
> > and then for subsequent uses, it does not repeat the flags:
> >    .section        .rodata.cst8
> >
> > GNU assembler warns (and with as >=2.35 gives an error) if the flags
> > do not match, but not if the attributes/flags are left in the other
> > same-named sections (as above) – just if they are specified and different.
> >
> > LLVM since February (in git) and released with LLVM 11 (12 Oct 2020)
> > does a similar check – but without the no-error-if-no-flag exception:
> >   strtod.s:4472:2: error: changed section flags for .rodata.cst8, expected: 
> > 0x12
> >   strtod.s:4472:2: error: changed section entsize for .rodata.cst8, 
> > expected: 8
> >
> >
> > The solution done by the attached patch is to emit the full flags also
> > for SECTION_MERGE.
> >
> > Side note: For AMD GCN, we rely on LLVM as "GNU as" does not handle
> > this target, yet; still, also in general, it makes sense to be
> > compatible with llvm-mc.
> >
> > OK?
>
> I think we shouldn't do this except when targetting the (buggy) llvm
> assembler.
> Specifying section flags just on first .section directive and not others
> is correct, there is no point repeating that and GNU as (but I think many
> other assemblers) has been supporting it that way forever.
> The only time one needs to specify the section flags again is for comdat
> sections because then the section name is not unique, one needs section name
> and comdat pair...

The branch might need similar updates.

Richard.

>
>         Jakub
>

Reply via email to