On Tue, 8 Oct 2024 at 11:11, Jakub Jelinek <ja...@redhat.com> wrote: > > On Tue, Oct 08, 2024 at 10:57:06AM +0100, Jonathan Wakely wrote: > > Whoops, yes of course. Raising the topic of __cxa_guard_acquire was my > > fault, and doesn't apply here, sorry. > > > > But we still want to get rid of the STB_GNU_UNIQUE binding for the > > static variables, don't we? > > I think it is the other way around. At least when I try: > static inline volatile int *foo (void) { static volatile int v = -1; return > &v; } > inline volatile int z = -1; > volatile int *p = foo (); > > z is STB_GNU_UNIQUE, _ZZL3foovE1v is not. Whether that is a bug or not, I > don't know...
But that's because foo() is declared static, which we can't do because of C++ modules. That was the original problem Nathaniel was fixing. If you remove the 'static' from foo() then both z and _ZZ3foovE1v use @gnu_unique_object