[PATCH] D19908: [X86] Support the "ms-hotpatch" attribute.

Charles Davis via llvm-commits llvm-commits at lists.llvm.org
Thu May 19 13:24:18 PDT 2016


cdavis5x marked 4 inline comments as done.

================
Comment at: docs/LangRef.rst:1435
@@ +1434,3 @@
+       hotpatchable function.  Additionally, patch space will be provided
+       prior to the function's entry point of an architecturally specific
+       size.  On 32-bit x86, the patch space is 64 bytes long; on x86-64, it
----------------
sanjoy wrote:
> So on x86-64, the 2 byte instruction can be anything?  May be helpful to be explicit about that.
Theoretically, but GCC seems to emit a `lea (%rsp), %rsp` on x86-64 (which is 8 bytes long). I don't know if we need to do this.

@rnk: What does MSVC do in that situation?

================
Comment at: lib/Target/X86/X86ISelLowering.cpp:2504-2507
@@ -2505,1 +2503,6 @@
+       Subtarget.isTargetCygMing() &&
+       Fn->getName() == "main") ||
+      (Fn->hasFnAttribute("patchable-function") &&
+       Fn->getFnAttribute("patchable-function").getValueAsString() ==
+           "ms-hotpatch"))
     FuncInfo->setForceFramePointer(true);
----------------
rnk wrote:
> Why do we need this change? The patchable nop comes before the prologue. Surely this isn't use for some kind of on-stack-replacement.
GCC seems to emit a standard `push %ebp; mov %esp, %ebp` prologue along with the patchable no-op. It doesn't do this for 64-bit.


http://reviews.llvm.org/D19908





More information about the llvm-commits mailing list