Skip to content

Commit 5c3fd16

Browse files
committed
Explain entry/prefix values may be restricted
Some existing codegens (notably ELFv2+GCC+PPC) can only do some values of `prefix`/`entry`. Call out that it is possible for some values to cause errors, even if the target/backend combination supports patchability.
1 parent 6d1b0a2 commit 5c3fd16

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

text/3543-patchable-function-entry.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,15 +79,15 @@ This flag sets the default nop padding for all functions in the crate. In most c
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

82-
Specifying the compiler flag for a backend or architecture which does not support this feature will result in an error.
82+
Specifying the compiler flag for a backend or architecture which does not support this feature will result in an error. Some backend / architecture combinations may only support some values of `entry` and `prefix`, in which case an error will also be generated for invalid values.
8383

8484
## Attributes `#[patchable]` and `#[unpatchable]`.
8585

8686
This attribute allows specification of either the `prefix` or `entry` values or both, using the format `#[patchable(prefix = m, entry = n)]`. If either is left unspecified, it overrides them to a default value of 0. Specifying neither prefix nor entry is an error, but explicitly setting them both to 0 is allowed.
8787

8888
As this is specified via an attribute, it will persist across crate boundaries unlike the compiler flag.
8989

90-
Specifying any amount of padding other than 0 in an attribute will result in an error on backends or architectures which do not support this feature.
90+
Specifying any amount of padding other than 0 in an attribute will result in an error on backends or architectures which do not support this feature. Some architecture/backend combinations may only support a subset of prefix and entry nop counts, and may generate errors when other counts are requested.
9191

9292
`#[unpatchable]` is a built-in alias for `#[patchable(prefix = 0, entry = 0)]`.
9393

0 commit comments

Comments
 (0)