Skip to content

Commit f0d3599

Browse files
committed
Describe the flag as though it were stable
1 parent 83aa13b commit f0d3599

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

text/3543-patchable-function-entry.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ nop
3030
// Code goes here
3131
```
3232

33-
To set this for all functions in a crate, use `-Z patchable-function-entry=nop_count,offset` where `nop_count = prefix + entry`, and `offset = prefix`. Usually, you'll want to copy this value from a corresponding `-fpatchable-function-entry=` being passed to the C compiler in your project.
33+
To set this for all functions in a crate, use `-C patchable-function-entry=nop_count,offset` where `nop_count = prefix + entry`, and `offset = prefix`. Usually, you'll want to copy this value from a corresponding `-fpatchable-function-entry=` being passed to the C compiler in your project.
3434

3535
To set this for a specific function, use `#[patchable_function_entry(prefix(m), entry(n))]` to pad with m nops before the symbol and n after the symbol, but before the prelude. This will override the flag value.
3636

@@ -64,18 +64,18 @@ Nop padding may not be supported on all architectures. As of the time of writing
6464
`f_pad` addresses for every padded symbol are aggregated in the `__patchable_function_entries` section of the resulting object.
6565
This is not a real symbol, just a collected location.
6666

67-
## Compiler flag `-Z patchable-function-entry`
67+
## Compiler flag `-C patchable-function-entry`
6868

6969
This flag comes in two forms:
7070

71-
- `-Z patchable-function-entry=nop_count,offset`
72-
- `-Z patchable-function-entry=nop_count`
71+
- `-C patchable-function-entry=nop_count,offset`
72+
- `-C patchable-function-entry=nop_count`
7373

7474
In the latter, offset is assumed to be zero. `nop_count` must be greater than or equal to `offset`, or it will be rejected.
7575

7676
If unspecified, the current behavior is maintained, which is equivalent to `=0` here.
7777

78-
This flag sets the default nop padding for all functions in the crate. Notably, this default *only applies to codegenned functions*. If a function is monomorphized during the compilation of another crate or any similar scenario, it will use the default from that crate's compilation. In most cases, all crates in a compilation should use the same value of `-Z patchable-function-entry` to reduce confusion.
78+
This flag sets the default nop padding for all functions in the crate. Notably, this default *only applies to codegenned functions*. If a function is monomorphized during the compilation of another crate or any similar scenario, it will use the default from that crate's compilation. In most cases, all crates in a compilation should use the same value of `-C patchable-function-entry` to reduce confusion.
7979

8080
`prefix` is calculated as `offset`. `entry` is calculated as `nop_count - offset`. This unusual mode of specification is intended to mimic the compiler flags of `clang` and `gcc` for ease of build system integration.
8181

@@ -102,7 +102,7 @@ This alternative runs the risk of the Rust-for-Linux experiment not leaving expe
102102
The primary advantage of this design is that it does not require us to do anything.
103103

104104
### Only compiler flag
105-
In this design, we only add the `-Z patchable-function-entry` flag and not the attribute. This is enough for today - it would allow Rust to participate in these schemes, and in the event that a user *deeply* needed an uninstrumented function, they could build it as a separate crate.
105+
In this design, we only add the `-C patchable-function-entry` flag and not the attribute. This is enough for today - it would allow Rust to participate in these schemes, and in the event that a user *deeply* needed an uninstrumented function, they could build it as a separate crate.
106106

107107
This design has two drawbacks:
108108

@@ -159,10 +159,10 @@ as modifiers to the attribute. We could make `prefix`/`entry` vs `nop_count`/`of
159159

160160
In addition to supporting `nop_count`/`offset` for attributes, we could support this on the command line as well. This would have three forms:
161161

162-
- `-Z patchable-function-entry=m` (`nop_count=m`, `offset=0`, compat format)
163-
- `-Z patchable-function-entry=m,n` (`nop_count=m`, `offset=n`, compat format)
164-
- `-Z patchable-function-entry=nop_count=m,offset=n` (`nop_count=m`, `offset=n`, modern format, offset optional)
165-
- `-Z patchable-function-entry=prefix=m,entry=n` (`prefix=m`, `entry=n`, modern format, either optional)
162+
- `-C patchable-function-entry=m` (`nop_count=m`, `offset=0`, compat format)
163+
- `-C patchable-function-entry=m,n` (`nop_count=m`, `offset=n`, compat format)
164+
- `-C patchable-function-entry=nop_count=m,offset=n` (`nop_count=m`, `offset=n`, modern format, offset optional)
165+
- `-C patchable-function-entry=prefix=m,entry=n` (`prefix=m`, `entry=n`, modern format, either optional)
166166

167167
This would have the benefit of making it more clear what's being specified and allowing users to employ the simpler format on the command line if not integrating with an existing build.
168168

0 commit comments

Comments
 (0)