------- Comment #6 from mmitchel at gcc dot gnu dot org  2008-01-11 21:23 
-------
I do think this is a bug.  It's certainly not going to meet user expectations. 

I think this is another case of a GCC extension that could have been
better-designed.  If we were starting from scratch, I think saying that an asm
defaults to the text section, unless it has an explicit section attribute,
would be a good thing.  But, I don't think we can change this now; there is
definitely code out there that depends on switching sections and then emitting
an asm.

But, we could make sure that we always pop back from the debug section to
whatever the preceding section was after emitting debug information.  That
seems reasonable to me, as I don't think people are trying to implicitly put
stuff into the debug section.  (If they want to do that, they explicitly use a
".section" directive.)  That would fix this case and probably avoid the problem
in general.

We could also add the ability to use __attribute__((section)) with an asm, like
so:

  __attribute__((section (".text"))) asm ("...");

with the semantics that we would enter that section, emit the asm, and then pop
back to whatever section we had before.  That would give users a natural way to
specify what section an asm goes into, without having to put ".section"
directives in the asm itself.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33932

Reply via email to