This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: alignment
- To: Tim Prince <tprince at computer dot org>
- Subject: Re: alignment
- From: Linus Torvalds <torvalds at transmeta dot com>
- Date: Sat, 15 Jul 2000 21:40:56 -0700 (PDT)
- cc: gcc at gcc dot gnu dot org
On Sat, 15 Jul 2000, Tim Prince wrote:
>
> If the kernel code has been checked thoroughly to
> see that __volatile__ is required everywhere it is used, then my comment
> is superfluous for that application.
I don't know that we have checked that there are no superfluous
"volatiles". For all I know there might certainly be volatiles that could
be dropped from the kernel.
I do find it strange that gcc would emit a .align directing before a
volatile asm, and I assume that is because there is some "virtual
branch-target" there to ensure volatility or similar. I don't see the
reported behaviour on the gcc version I'm using (2.91.66), so this
behaviour is new (or maybe it's more subtle than "before every volatile",
or maybe I mis-understood the report).
[ Side comment: most of the asm's inside the kernel tend to be volatile
for one reason or another: they tend to be synchronization points.
Things like spinlocks, "disable interrupts" etc. I don't think the
kernel is really all that consistent about "volatile": a number of them
use memory clobbers instead of "volatile" to avoid getting moved
around too much. ]
Linus