|
17 | 17 | // hot-patch generation tools, and the Windows kernel. This file implements that
|
18 | 18 | // part of the workflow needed in compilers / code generators.
|
19 | 19 | //
|
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 |
21 | 21 | // interactive development. SHP is intended to minimize downtime during
|
22 | 22 | // installation of Windows OS patches.
|
23 | 23 | //
|
24 | 24 | // In order to work with SHP, LLVM must do all of the following:
|
25 | 25 | //
|
26 | 26 | // * 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. |
33 | 32 | //
|
34 | 33 | // * 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. |
39 | 37 | //
|
40 | 38 | // This implementation uses the `MarkedForWindowsHotPatching` attribute to
|
41 | 39 | // annotate those functions that were marked for hot-patching by command-line
|
|
44 | 42 | // set by passing LLVM arguments.
|
45 | 43 | //
|
46 | 44 | // * 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 |
52 | 49 | // `__ref_FOO` pointer.
|
53 | 50 | //
|
54 | 51 | // Some globals do not need `__ref_*` indirection. The pointer indirection
|
|
58 | 55 | // References
|
59 | 56 | //
|
60 | 57 | // * "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 | +// |
62 | 60 | // * "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 | +// |
64 | 63 | // * "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/ |
66 | 65 | //
|
67 | 66 | //===----------------------------------------------------------------------===//
|
68 | 67 |
|
|
83 | 82 |
|
84 | 83 | using namespace llvm;
|
85 | 84 |
|
86 |
| -#define DEBUG_TYPE "windows-hot-patch" |
| 85 | +#define DEBUG_TYPE "windows-secure-hot-patch" |
87 | 86 |
|
88 | 87 | // A file containing list of mangled function names to mark for hot patching.
|
89 | 88 | static cl::opt<std::string> LLVMMSSecureHotPatchFunctionsFile(
|
|
0 commit comments