Zack Weinberg wrote:
> Back in 2000 I wrote a really simple patch that caused gcc to treat an
> ASM_OPERANDS that clobbered "pc" as a control flow barrier, exactly
> for this problem.
> 
> http://gcc.gnu.org/ml/gcc-patches/2000-01/msg00190.html
> 
> I still think it was a good idea, but at the time it was received
> unenthusiastically.  I especially think "just use __builtin_trap()"
> misses the mark - at least some variants of the Linux kernel's BUG()
> macro, for instance, want to stick annotations in the assembly stream,
> which you cannot do with __builtin_trap...

I agree.  Adding options to make __builtin_trap do different things
(like generate an abort signal in user applications and something else
in kernel mode) is pretty nasty.  Linux is a favorite GNU kernel, but
there are lots of other kernels out there, and this could get comlicated
in a hurry.

I think clobbering the PC is a reasonably good way to represent a
control-flow barrier at user level.

-- 
Mark Mitchell
CodeSourcery
[EMAIL PROTECTED]
(650) 331-3385 x713

Reply via email to