aganea wrote: Since the [MSVC flag](https://learn.microsoft.com/en-us/cpp/build/reference/hotpatch-create-hotpatchable-image?view=msvc-170) `/HOTPATCH` has been supported in LLVM and clang-cl for quite a while now (see [this](https://reviews.llvm.org/D116511), and #77245 and #87639) the description in this PR is quite confusing. Or maybe is it the Microsoft nomenclature for this user-facing feature which can be confused with what used to be called hotpatching before?
I'd like to understand the history here. It seems `/HOTPATCH` and `/FUNCTIONPADMIN` were initially added to MSVC for this exact purpose during the Windows NT era (probably around 2010?) but have never been used for this purpose. It looks like this new "hotpatching" described in the links is a revival of that idea? Can you provide a more technical insight about how is this gonna be used? What are the equivalent MSVC flags? Why is it that users (programmers) need to select specific functions to hotpatch? As a side-note, we (at Sony) have been using [Live++](https://liveplusplus.tech/) for this purpose for quite a while now on large game projects, sometimes going for a day long, on hundered of iterations, without stopping the game. This scenario (patching global variables) is already well supported by Live++ out of the box without the changes proposed in this PR. However I understand that Microsoft has a different tech that requires these changes. Also, this paragraph is a bit confusing: > Adds a MarkedForWindowsHotPatching LLVM function attribute. This attribute > indicates that a function should be hot-patched. This generates a new > CodeView symbol, S_HOTPATCHFUNC, which identifies any function **that has > been hot-patched**. This attribute also causes accesses to global variables > to be indirected through a _ref_* global variable. This allows hot-patched > functions to access the correct version of a global variable; the hot-patched > code needs to access the variable in the original image, not the patch image. "hot-patching/hot-patched" usually refers to a process that happens at runtime, not at compile time. Can you explain more in (technical) detail the whole pipeline for this new hotpatch feature? What does exactly the kernel/the system do after a new Windows update is downloaded? Does it iterate on the debug infos for each DLL in the update package, and if it finds `S_HOTPATCHFUNC` it would patch/replace the functions in memory with the new DLL? (DLL which I expect, is previously injected in the process). Why do we need to redirect the _ref_* global variables? Can't the kernel loader parse the DLL relocs and patch/redirect the injected DLL functions to the initial global state? + @MolecularMatters for visibility https://github.com/llvm/llvm-project/pull/138972 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits