int foo __attribute__((__section__("\".foo\""))); In Clang produces: .section "\".foo\"","aw",@progbits In GCC: .section ".foo","aw" This is leading to a bug in Clang built Linux kernels for distros that use BPF (not eBPF) during boot, causing them to fail to boot. https://github.com/ClangBuiltLinux/linux/issues/619
We can work around this for now; the escaping is coming from use of the C preprocessor: #define __section(S) __attribute__((__section__(#S))) int foo __section(".foo") can instead be: int foo __section(.foo) but this is still a bug (or at least a dependency from gcc/binutils).
Coincidentally, I mentioned this exact GCC misfeature to Bob yesterday. This has come up in the past, and our stance then was that this was always an escaping bug that GCC should fix. Previously people used to use this in creative ways to change the protections of the section, but I don't think it is possible anymore, at least not without using the comment character.
(In reply to Reid Kleckner from comment #2) > Coincidentally, I mentioned this exact GCC misfeature to Bob yesterday. This > has come up in the past, and our stance then was that this was always an > escaping bug that GCC should fix. Previously people used to use this in > creative ways to change the protections of the section, but I don't think it > is possible anymore, at least not without using the comment character. As a person that has tried to use that hack, it is highly unstable and not cross-architecture portable, and should not be used. :P
Marking WONTFIX based on Reid's comment.