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

Charles Davis via llvm-commits llvm-commits at lists.llvm.org
Mon May 16 13:14:34 PDT 2016


cdavis5x marked an inline comment as done.

================
Comment at: lib/Target/X86/X86AsmPrinter.cpp:76
@@ -75,1 +75,3 @@
 
+void X86AsmPrinter::EmitFunctionEntryLabel() {
+  // If a hotpatch function, we need to ensure 64 (32-bit) or 128 (64-bit)
----------------
rnk wrote:
> You should consider overriding EmitConstantPool instead, so the fill directive comes before the alignment directive:
>   .text
>   .fill 5, 1, 0xcc
>   .align 2
>   .global foo
>   foo:
>     movl %edi, %edi
>     retq
> 
> Are the hotpatching tools that we care about checking for 0xcc bytes, or will they overwrite alignment nops?
> Are the hotpatching tools that we care about checking for 0xcc bytes, or will they overwrite alignment nops?
It's not necessarily that tools care, it's that I think I'd prefer loudly crashing to getting stuck in an infinite loop if the patch forgets to jump back into the function. (I've added a comment clarifying this.)


http://reviews.llvm.org/D19908





More information about the llvm-commits mailing list