[PATCH] D81301: [X86] Emit two-byte NOP when possible

Charles Davis via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 5 20:04:21 PDT 2020


cdavis5x added a comment.

> Whenever using the "patchable-function" attribute, a PATCHABLE_OP now lowers to a xchg ax, ax, like MSVC does.

Is this true? Last I checked--and admittedly, this was a long time ago--MSVC emitted `mov edi, edi`--more specifically, opcode bytes `8b ff`. GCC also emits those same bytes.

There's also a compatibility angle here. The reason this was added to GCC in the first place, and the reason I wrote the original change, is that Wine needed this to make certain Windows programs run correctly. I think they specifically check for that `8b ff` signature before installing their hotpatches--which I admit they really shouldn't be doing, and may be a factor in why MS started using `xchg ax, ax` (`66 90`), but they do it, and we need specifically that sequence to make them work correctly.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D81301/new/

https://reviews.llvm.org/D81301





More information about the llvm-commits mailing list