This email is a heads-up that I intend to teach the integrated assembler
(in MC) to emit an error when section type/flags/entsize is changed.
This is currently silently ignored and can hide bugs.
⚙ D73999 [MC][ELF] Error for sh_type, sh_flags or sh_entsize change should only affect assembly files.
.section .foo,"a",@progbits # error: changed section flags for .foo, expected: 0x6
(A future improvement is to issue symbolic output: "ax")
.section .bar,"aw",@nobits # error: changed section type for .bar, expected: 0x1
GNU as has had such warnings since 2000. After discussing with them recently, Alan Modra made a change upgrading most
warnings to an error (Alan Modra - gas: error for section type, attr, or entsize change).
GNU as<=2.34 # Warning: ignoring changed section attributes for .foo
GNU as>2.34 # Error: ignoring changed section attributes for .foo
Some cases remain warnings for legacy reasons:
a.s:1: Warning: ignoring incorrect section type for .init_array
a.s:1: Warning: setting incorrect section attributes for .init_array
# Some obscure sh_flags changes (OS/Processor specific flags) also remain warnings.
⚙ D73999 [MC][ELF] Error for sh_type, sh_flags or sh_entsize change will simply treat all cases as errors,
which means the assembly type error can break the build (errors suppress
output). Code (not written carefully) never tested with GNU as may have problems, but I
hope they are very rare. If the error indeed causes trouble, we can
consider downgrade the sh_type error to a warning.