------- Comment #16 from steven at gcc dot gnu dot org 2008-12-28 13:23 ------- In fact, Mark's suggestion wouldn't actually work in all cases. With -ffunction-sections, your function definition may end up in a section that will be eliminated by the linker. And if the preceding section was a non-.text section, so there is no guarantee that your asm ends up in an executable section.
The real bug here, IMHO, is that it works at all for -g1 and -g2. The compiler should probably warn about top-level asm blocks without explicit section switches. But that's probably hard to implement (involves scanning the asm text for section switches), so, again, I doubt anyone would want to implement this. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33932