diff options
| author | Matthew Maurer <matthew.r.maurer@gmail.com> | 2023-12-12 13:32:43 -0800 |
|---|---|---|
| committer | Florian Schmiderer <florian.schmiderer@posteo.net> | 2024-06-25 18:21:42 +0200 |
| commit | ac7595fdb1ee2aafecdd99cd8a3e56192639ada6 (patch) | |
| tree | 4be37518dc4e5f5366b2920c90573749a75d3b0e /src/doc | |
| parent | d929a42a664c026167800801b26d734db925314f (diff) | |
| download | rust-ac7595fdb1ee2aafecdd99cd8a3e56192639ada6.tar.gz rust-ac7595fdb1ee2aafecdd99cd8a3e56192639ada6.zip | |
Support for -Z patchable-function-entry
`-Z patchable-function-entry` works like `-fpatchable-function-entry` on clang/gcc. The arguments are total nop count and function offset. See MCP rust-lang/compiler-team#704
Diffstat (limited to 'src/doc')
| -rw-r--r-- | src/doc/unstable-book/src/compiler-flags/patchable-function-entry.md | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/doc/unstable-book/src/compiler-flags/patchable-function-entry.md b/src/doc/unstable-book/src/compiler-flags/patchable-function-entry.md new file mode 100644 index 00000000000..a701b9e3771 --- /dev/null +++ b/src/doc/unstable-book/src/compiler-flags/patchable-function-entry.md @@ -0,0 +1,24 @@ +# `patchable-function-entry` + +-------------------- + +The `-Z patchable-function-entry=M,N` or `-Z patchable-function-entry=M` +compiler flag enables nop padding of function entries with M nops, with +an offset for the entry of the function at N nops. In the second form, +N defaults to 0. + +As an illustrative example, `-Z patchable-function-entry=3,2` would produce: + +``` +nop +nop +function_label: +nop +//Actual function code begins here +``` + +This flag is used for hotpatching, especially in the Linux kernel. The flag +arguments are modeled after hte `-fpatchable-function-entry` flag as defined +for both [Clang](https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-fpatchable-function-entry) +and [gcc](https://gcc.gnu.org/onlinedocs/gcc/Instrumentation-Options.html#index-fpatchable-function-entry) +and is intended to provide the same effect. |
