[PATCH] D137642: [X86][CodeGen] Fix crash in hotpatch

Sylvain Audi via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 21 11:43:48 PST 2022


saudi updated this revision to Diff 476960.
saudi added a comment.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Added support for empty MBB: ensures 2-byte nop is inserted, to make the function patchable.
This should also support the requirement for the functions not to jump to the first instruction.

The 2-byte nop instruction insertion is done by creating a `PATCHABLE_OP` instance with a PATCHABLE_OP opcode as wrapped instruction.

Also, I removed the support for 16 bit, which would assert when trying to emit nops (happens with the new test cases)
It could be handled instead if necessary; I removed it because I didn't think hotpatching would be ever used on such a platform.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137642

Files:
  clang/lib/CodeGen/CodeGenFunction.cpp
  llvm/include/llvm/Support/TargetOpcodes.def
  llvm/lib/CodeGen/PatchableFunction.cpp
  llvm/lib/Target/X86/X86MCInstLower.cpp
  llvm/test/CodeGen/X86/patchable-prologue-debuginfo.ll
  llvm/test/CodeGen/X86/patchable-prologue.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D137642.476960.patch
Type: text/x-patch
Size: 11269 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20221121/cdf2ab31/attachment.bin>


More information about the cfe-commits mailing list