Skip to content

Commit 1d18bc2

Browse files
committed
PR feedback
1 parent 44ec3fb commit 1d18bc2

File tree

1 file changed

+19
-20
lines changed

1 file changed

+19
-20
lines changed

llvm/lib/CodeGen/WindowsSecureHotPatching.cpp

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -17,25 +17,23 @@
1717
// hot-patch generation tools, and the Windows kernel. This file implements that
1818
// part of the workflow needed in compilers / code generators.
1919
//
20-
// SHP is not intended for productivity scenarios, such as Edit-and-Continue or
20+
// SHP is not intended for productivity scenarios such as Edit-and-Continue or
2121
// interactive development. SHP is intended to minimize downtime during
2222
// installation of Windows OS patches.
2323
//
2424
// In order to work with SHP, LLVM must do all of the following:
2525
//
2626
// * On some architectures (X86, AMD64), the function prolog must begin with
27-
// hot-patchable
28-
// instructions. This is handled by the MSVC `/hotpatch` option and the
29-
// equivalent `-fms-hotpatch` function. This is necessary because we generally
30-
// cannot anticipate which functions will need to be patched in the future.
31-
// This option ensures that a function can be hot-patched in the future, but
32-
// does not actually generate any hot-patch for it.
27+
// hot-patchable instructions. This is handled by the MSVC `/hotpatch` option
28+
// and the equivalent `-fms-hotpatch` function. This is necessary because we
29+
// generally cannot anticipate which functions will need to be patched in the
30+
// future. This option ensures that a function can be hot-patched in the
31+
// future, but does not actually generate any hot-patch for it.
3332
//
3433
// * For a selected set of functions that are being hot-patched (which are
35-
// identified using
36-
// command-line options), LLVM must generate the `S_HOTPATCHFUNC` CodeView
37-
// record (symbol). This record indicates that a function was compiled with
38-
// hot-patching enabled.
34+
// identified using command-line options), LLVM must generate the
35+
// `S_HOTPATCHFUNC` CodeView record (symbol). This record indicates that a
36+
// function was compiled with hot-patching enabled.
3937
//
4038
// This implementation uses the `MarkedForWindowsHotPatching` attribute to
4139
// annotate those functions that were marked for hot-patching by command-line
@@ -44,11 +42,10 @@
4442
// set by passing LLVM arguments.
4543
//
4644
// * For those functions that are hot-patched, LLVM must rewrite references to
47-
// global variables
48-
// so that they are indirected through a `__ref_*` pointer variable. For each
49-
// global variable, that is accessed by a hot-patched function, e.g. `FOO`, a
50-
// `__ref_FOO` global pointer variable is created and all references to the
51-
// original `FOO` are rewritten as dereferences of the
45+
// global variables so that they are indirected through a `__ref_*` pointer
46+
// variable. For each global variable, that is accessed by a hot-patched
47+
// function, e.g. `FOO`, a `__ref_FOO` global pointer variable is created and
48+
// all references to the original `FOO` are rewritten as dereferences of the
5249
// `__ref_FOO` pointer.
5350
//
5451
// Some globals do not need `__ref_*` indirection. The pointer indirection
@@ -58,11 +55,13 @@
5855
// References
5956
//
6057
// * "Hotpatching on Windows":
61-
// https://techcommunity.microsoft.com/blog/windowsosplatform/hotpatching-on-windows/2959541
58+
// https://techcommunity.microsoft.com/blog/windowsosplatform/hotpatching-on-windows/2959541
59+
//
6260
// * "Hotpatch for Windows client now available":
63-
// https://techcommunity.microsoft.com/blog/windows-itpro-blog/hotpatch-for-windows-client-now-available/4399808
61+
// https://techcommunity.microsoft.com/blog/windows-itpro-blog/hotpatch-for-windows-client-now-available/4399808
62+
//
6463
// * "Get hotpatching for Windows Server":
65-
// https://www.microsoft.com/en-us/windows-server/blog/2025/04/24/tired-of-all-the-restarts-get-hotpatching-for-windows-server/?msockid=19a6f8f09bd160ac0b18ed449afc614b
64+
// https://www.microsoft.com/en-us/windows-server/blog/2025/04/24/tired-of-all-the-restarts-get-hotpatching-for-windows-server/
6665
//
6766
//===----------------------------------------------------------------------===//
6867

@@ -83,7 +82,7 @@
8382

8483
using namespace llvm;
8584

86-
#define DEBUG_TYPE "windows-hot-patch"
85+
#define DEBUG_TYPE "windows-secure-hot-patch"
8786

8887
// A file containing list of mangled function names to mark for hot patching.
8988
static cl::opt<std::string> LLVMMSSecureHotPatchFunctionsFile(

0 commit comments

Comments
 (0)