Status of Intel JCC Mitigations and Next Steps

We definitely should not have any undocumented or unpredictable behavior in the assembler. The actual instruction bytes matter. That said, I’m not sure there’s a strong line between “automagic” and “explicit”, as long as the rules are documented.


If one is writing assembly at all there’s a fair chance the exact bytes matter. I’ve previously tried to persuade professional assembly programmers that an optimizing assembler is a good thing and been soundly rejected.

I was however able to sell a directive based approach, where the default in assembly source was still to emit exactly what the asm asked for. Compiler generated assembly inserted the directive at the top unless told not to, as a rough heuristic that compiler generated code is usually fair game for such modifications. Some file scope inline asm still picked up an extra line to turn the optimiser back off.

I would suggest doing likewise. File scope directives are fine, as long as they’re off by default. Otherwise we’ll break existing code and annoy future developers, probably in a fashion which makes for difficult debugging.