https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123957
--- Comment #3 from Michael Ewart <mike at sillyhouse dot net> --- Thank you for pointing me toward bug 117133. Yes, the underlying cause is identical in that the inline assembler block I *actually* use is for the purpose of using an `incbin` directive. However, in that instance the related software was revised to specifically *not* use anonymous namespaces. I do find it counterintuitive that an anonymous namespace behaves differently to a named one, and also that the `extern "C"` appears to be silently ignored, but I do accept that the situation is ambiguous. In my particular use case the inline assembler block is emitted by a utility macro within a framework which is widely used in application code. That would make it a breaking change which I would rather avoid. I did identify a workable solution to this asm labels https://gcc.gnu.org/onlinedocs/gcc/Asm-Labels.html. extern "C" const unsigned testval asm("testval"); Hopefully that is a lot less ambiguous and for now GCC 15 seems to be happy with it!
