https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118889
--- Comment #4 from Georg-Johann Lay <gjl at gcc dot gnu.org> --- (In reply to rguent...@suse.de from comment #3) > On Mon, 17 Feb 2025, gjl at gcc dot gnu.org wrote: > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118889 > > --- Comment #2 from Georg-Johann Lay <gjl at gcc dot gnu.org> --- > > (In reply to Richard Biener from comment #1) > > > I think variables with 'static' linkage cannot be 'common'? > > > > Shouldn't they go into .lcomm, i.e. lcomm_section? > > Never heard of that ;) In my understanding 'common' and 'local' > exclude themselves, locals should go to .bss (possibly .lcomm is > a thing on targets w/o .bss?). It's hard to find specification of that stuff. I just worked backwards from varasm.cc trying to make the said variable attribute work. And one part could be throwing a "common" attribute at VAR_DECLs in the local case. > > What I am trying to achieve is to implement a variable attribute, and to get > > some noswitch section attached to a VAR_DECL in static storage. > > > > Since common static variables are not in lcomm_section, the attribute fails > > for > > local variables. > > > > FYI, regarding the variable attribute, what also doesn't work is to return a > > custom noswitch section in TARGET_ASM_SELECT_SECTION since that hook is not > > called for all static storage VAR_DECLs. More on the background can be > > found > > at https://gcc.gnu.org/pipermail/gcc-help/2025-February/143983.html > > I suppose trying to fix either is sound. There is nothing to "fix". NOT calling TARGET_ASM_SELECT_SECTION in some situations like when bss_initializer_p(decl) is a FEATURE implanted by varasm.cc, not a bug.