You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: text/3543-patchable-function-entry.md
+9-9Lines changed: 9 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -117,15 +117,15 @@ This design has two drawbacks:
117
117
118
118
The primary advantage of this design is that it is purely a compiler feature, with no change to the language.
119
119
120
-
## Compiler flag and no-padding attribute
120
+
###Compiler flag and no-padding attribute
121
121
In this design, we add the compiler flag and an attribute that zeroes out padding for a function. This covers all the use cases I see in the Linux kernel today, so the only real downside is missing the opportunity to match `gcc` and `clang`'s capabilities with only a small bit more code.
122
122
123
123
Some other project might use explicit padding configuration per-function, but a quick search across github only finds the `patchable_function_entry` attribute set to `(0, 0)` other than in compiler tests.
124
124
125
-
## Everything (proposed design)
125
+
###Everything (proposed design)
126
126
The only real downside I see here is the complexity of adding one more thing to the language.
127
127
128
-
# Argument style
128
+
##Argument style
129
129
130
130
There are two basic ways being used today to specify this nop padding:
131
131
@@ -136,21 +136,21 @@ The primary advantage of the first format is that it is used in `gcc` and `clang
136
136
137
137
The advantage of the second style is that `prefix` and `entry` don't have validity constraints (`nop_count` must be greater than `offset`) and it's more obvious what the user is asking for.
138
138
139
-
## Copy `gcc`/`clang` everywhere
139
+
###Copy `gcc`/`clang` everywhere
140
140
141
141
This approach has the advantage of matching all existing docs and programmers coming over not being confused.
142
142
143
-
## Use LLVM-style everywhere
143
+
###Use LLVM-style everywhere
144
144
145
145
This format doesn't require validation and is likely easier to understand for users not already exposed to this concept.
146
146
147
-
## Use `gcc`/`clang` for flags, LLVM-style for arguments (proposed)
147
+
###Use `gcc`/`clang` for flags, LLVM-style for arguments (proposed)
148
148
149
149
Build systems tend to interact with our flag interface, and they already have `nop_count,offset` format flags constructed for their C compilers, so this is likely the easiest way for them to interface.
150
150
151
151
Users are unlikely to be directly copying code with a manual attribute, and usually are just going to be disabling padding per a github search for the attribute. Setting padding to `(0, 0)` is compatible across both styles, and setting `prefix` and `entry` manually is likely to be more understandable for a new user.
152
152
153
-
## Use `gcc`/`clang` for flags, Support both styles for arguments
153
+
###Use `gcc`/`clang` for flags, Support both styles for arguments
154
154
155
155
Our attribute system is more powerful than `clang` and `gcc`, so we have the option to support:
156
156
@@ -161,7 +161,7 @@ Our attribute system is more powerful than `clang` and `gcc`, so we have the opt
161
161
162
162
as modifiers to the attribute. We could make `prefix`/`entry` vs `nop_count`/`offset` an exclusive choice, and support both. This would provide the advantage of allowing users copying from or familiar with the other specification system to continue using it. The disadvantages would be more complex attribute parsing and potential confusion for people reading code.
163
163
164
-
## Support both styles for flags and arguments
164
+
###Support both styles for flags and arguments
165
165
166
166
In addition to supporting `nop_count`/`offset` for attributes, we could support this on the command line as well. This would have two forms:
167
167
@@ -172,7 +172,7 @@ This would have the benefit of making it more clear what's being specified and a
172
172
173
173
The primary disadvantage of this is having many ways to say the same thing.
174
174
175
-
## Use LLVM-style for flags, `gcc`/`clang` for arguments
175
+
###Use LLVM-style for flags, `gcc`/`clang` for arguments
0 commit comments