-
Notifications
You must be signed in to change notification settings - Fork 16.5k
Description
| Bugzilla Link | 48201 |
| Resolution | FIXED |
| Resolved on | Dec 14, 2020 14:36 |
| Version | 11.0 |
| OS | Linux |
| Blocks | #47144 |
| CC | @sylvestre,@tstellar |
| Fixed by commit(s) | 1deff40 700baa0 |
Extended Description
LLVM's linker added a reasonable check in https://reviews.llvm.org/D73999
Such as (from the testsuite):
.section .foo,"aM",@progbits,1
.section .foo,"aM",@progbits,4
error: changed section entsize for .foo, expected: 1
However, it also now causes an error for:
.section .rodata.cst8,"aM",@progbits,8
.section .rodata.cst8
The problem is that GCC generates this by default (gcc/varasm.c):
/* 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;
}
LLVM and GNU as ("gas") tried to align, cf. discussion
https://sourceware.org/legacy-ml/binutils/2020-02/msg00091.html
and the GAS patch to turn a warning to an error:
https://sourceware.org/legacy-ml/binutils/2020-02/msg00129.html
However, while llvm/lib/MC/MCParser/ELFAsmParser.cpp always issues an error:
- if (Section->getType() != Type)
- Error(loc, "changed section type for " + SectionName + ", expected: 0x" +
-
utohexstr(Section->getType()));
etc.
The GNU assembler only does so if flags have been specified,
gas/config/obj-elf.c:
if (attr != 0)
{
/* If section attributes are specified the second time we see a
particular section, then check that they are the same as we
saw the first time. */
if (((old_sec->flags ^ flags)
...