https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97827
Tobias Burnus <burnus at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ams at gcc dot gnu.org,
| |burnus at gcc dot gnu.org
--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> ---
Changed in LLVM in https://reviews.llvm.org/D73999
cf. https://lists.llvm.org/pipermail/llvm-dev/2020-February/139390.html
and related Binutils discussion:
https://sourceware.org/legacy-ml/binutils/2020-02/msg00093.html
LLVM commit 75af9da755721123e62b45cd0bc0c5e688a9722a:
" GNU as started to emit warnings for changed sh_type or sh_flags in 2000.
GNU as>=2.35 will emit errors for most sh_type/sh_flags change, and error
for entsize change."
Cf. also http://web.mit.edu/rhel-doc/3/rhel-as-en-3/section.html
A grep shows:
.section .rodata.cst8
.section .rodata.cst8
.section .rodata.cst8,"aM",@progbits,8
Codewise, we have:
mergeable_constant_section (mode=E_DFmode, align=64, flags=0)
which calls:
884 flags |= (align / 8) | SECTION_MERGE;
885 return get_section (name, flags, NULL);
with flags == 32776.
In the latter:
flags |= SECTION_NAMED;
→ 2129928
and as "slot = section_htab->find_slot_with_hash" → *slot == NULL:
sect = ggc_alloc<section> ();
sect->named.common.flags = flags;
sect->named.name = ggc_strdup (name);
sect->named.decl = decl;
However, once the same function is called, we have:
sect->common.flags == 3178504
while still/again:
flags == 2129928
Next comes the call to:
switch_to_section
which ends with
new_section->common.flags |= SECTION_DECLARED;
which is
3178504
If we look at default_elf_asm_named_section, we find:
/* 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;
}