Implement -fpatchable-function-entry flag#23251
Conversation
|
Thanks for your pull request and interest in making D better, @xoxorwr! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please see CONTRIBUTING.md for more information. If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment. Bugzilla referencesYour PR doesn't reference any Bugzilla issue. If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog. Testing this PR locallyIf you don't have a local development environment setup, you can use Digger to test this PR: dub run digger -- build "master + dmd#23251" |
|
cc @rikkimax |
|
I am aware that Microsoft uses this technique quite heavily in their products, including Windows. I am also very hesitant to call this a good direction for D. There are some very difficult problems to solve in your -watch proposal, and I'd like to see how that proceeds before suggesting that this is a good feature for this purpose. |
|
Separate from the compiler daemon idea, this is a generally useful feature that could benefit a variety of tools. In situations where you'd normally fall back to C (or even Rust), D becomes a viable option again. |
| uint patchableFunctionEntryTotal = 0; /// Number of NOPs to pad function entries with | ||
| uint patchableFunctionEntryPrefix = 0; /// Number of NOPs before function entry label |
There was a problem hiding this comment.
Put this in dmdparams as it's not used by the front-end.
Context: https://forum.dlang.org/post/110h05u$2tc6$1@digitalmars.com
This PR implements the
-fpatchable-function-entry=total_nops[,prefix_nops]compiler flag to enable NOP padding for function entries.It provides the same effect as the GCC/Clang/Rust
-fpatchable-function-entryflag.It facilitates atomic hotpatching and hot reloading scenarios.
https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-fpatchable-function-entry
https://gcc.gnu.org/onlinedocs/gcc/Instrumentation-Options.html#index-fpatchable-function-entry