Re: [PATCH] pop previous section in alternative.c
From: Linus Torvalds
Date: Thu Apr 10 2008 - 13:38:46 EST
On Thu, 10 Apr 2008, H. Peter Anvin wrote:
> Steven Rostedt wrote:
> >
> > Looking at the output below, shows that testing .sections in between
> > #APP and #NO_APP would in fact catch this bug.
> >
>
> Of course, The Right Thing[TM] would be for gcc to emit .pushsection ...
> .popsection around #APP ... #NO_APP.
No, that would not help anything. It would still be open to bugs in the
asm, ie if there was a unpaired "pushsection" there, making gcc emit the
section directives around it would just cause a _different_ bug.
So I don't think gcc does the wrong thing per se. It was clearly a bug in
our inline asm, and the blame is solidly on us.
Obviously, it would have been really nice if something like the assembler
had caught it with some simple sanity-test (ie I think the .size thing
would be a good sanity check _regardless_), so in that sense it's our bug
that might have been avoided with soem sanity testing, but on the other
hand, I can well understand that gas didn't do it - since it would matter
only for totally buggy code that was never emitted by the compiler.
Gas historically used to not do any sanity-checking what-so-ever, and was
very much meant to be just for compiler output (which is why #APP exists
in the first place - to mark places that aren't pure compiler input). It's
actually improved immensely in that area and now is useful as a
traditional human-usable assembler with lots of support like macros etc.
Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/