Commit 0355716
authored
[BOLT] Gadget scanner: streamline issue reporting (llvm#131896)
In preparation for adding more gadget kinds to detect, streamline
issue reporting.
Rename classes representing issue reports. In particular, rename
`Annotation` base class to `Report`, as it has nothing to do with
"annotations" in `MCPlus` terms anymore. Remove references to "return
instructions" from variable names and report messages, use generic
terms instead. Rename NonPacProtectedRetAnalysis to PAuthGadgetScanner.
Remove `GeneralDiagnostic` as a separate class, make `GenericReport`
(former `GenDiag`) store `std::string Text` directly. Remove unused
`operator=` and `operator==` methods, as `Report`s are created on the
heap and referenced via `shared_ptr`s.
Introduce `GadgetKind` class - currently, it only wraps a `const char *`
description to display to the user. This description is intended to be
a per-gadget-kind constant (or a few hard-coded constants), so no need
to store it to `std::string` field in each report instance. To handle
both free-form `GenericReport`s and statically-allocated messages
without unnecessary overhead, move printing of the report header to the
base class (and take the message argument as a `StringRef`).1 parent 29e1a76 commit 0355716
File tree
7 files changed
+165
-163
lines changed- bolt
- include/bolt/Passes
- lib
- Passes
- Rewrite
- test/binary-analysis/AArch64
7 files changed
+165
-163
lines changedLines changed: 43 additions & 47 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
10 | | - | |
| 9 | + | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
173 | 173 | | |
174 | 174 | | |
175 | 175 | | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | | - | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
182 | 190 | | |
183 | 191 | | |
184 | | - | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
185 | 198 | | |
186 | | - | |
187 | | - | |
188 | | - | |
189 | | - | |
190 | | - | |
191 | | - | |
192 | | - | |
193 | | - | |
194 | | - | |
195 | | - | |
196 | | - | |
197 | | - | |
198 | | - | |
199 | | - | |
200 | 199 | | |
201 | 200 | | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
202 | 204 | | |
203 | 205 | | |
204 | | - | |
205 | | - | |
206 | | - | |
207 | | - | |
208 | | - | |
209 | | - | |
210 | | - | |
211 | | - | |
212 | | - | |
213 | | - | |
214 | | - | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
215 | 215 | | |
216 | 216 | | |
217 | | - | |
218 | | - | |
219 | | - | |
220 | | - | |
221 | | - | |
222 | | - | |
223 | | - | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
224 | 222 | | |
225 | 223 | | |
226 | 224 | | |
227 | 225 | | |
228 | | - | |
229 | | - | |
230 | 226 | | |
231 | 227 | | |
232 | | - | |
| 228 | + | |
233 | 229 | | |
234 | 230 | | |
235 | 231 | | |
| |||
245 | 241 | | |
246 | 242 | | |
247 | 243 | | |
248 | | - | |
| 244 | + | |
249 | 245 | | |
250 | 246 | | |
251 | 247 | | |
252 | 248 | | |
253 | 249 | | |
254 | | - | |
| 250 | + | |
255 | 251 | | |
256 | 252 | | |
257 | 253 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
27 | 26 | | |
| 27 | + | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| |||
bolt/lib/Passes/NonPacProtectedRetAnalysis.cpp renamed to bolt/lib/Passes/PAuthGadgetScanner.cpp
Lines changed: 46 additions & 39 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
60 | | - | |
| 60 | + | |
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
| |||
395 | 395 | | |
396 | 396 | | |
397 | 397 | | |
398 | | - | |
| 398 | + | |
399 | 399 | | |
400 | 400 | | |
401 | 401 | | |
| |||
416 | 416 | | |
417 | 417 | | |
418 | 418 | | |
| 419 | + | |
419 | 420 | | |
420 | | - | |
421 | | - | |
| 421 | + | |
| 422 | + | |
422 | 423 | | |
423 | 424 | | |
424 | 425 | | |
| |||
480 | 481 | | |
481 | 482 | | |
482 | 483 | | |
483 | | - | |
484 | | - | |
| 484 | + | |
| 485 | + | |
485 | 486 | | |
486 | | - | |
| 487 | + | |
487 | 488 | | |
488 | 489 | | |
489 | 490 | | |
490 | | - | |
| 491 | + | |
491 | 492 | | |
492 | 493 | | |
493 | 494 | | |
494 | 495 | | |
495 | 496 | | |
496 | | - | |
497 | | - | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
498 | 510 | | |
499 | | - | |
500 | | - | |
501 | | - | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
502 | 518 | | |
503 | 519 | | |
504 | | - | |
505 | | - | |
| 520 | + | |
| 521 | + | |
506 | 522 | | |
507 | 523 | | |
508 | | - | |
509 | | - | |
| 524 | + | |
| 525 | + | |
510 | 526 | | |
511 | 527 | | |
512 | 528 | | |
513 | | - | |
514 | | - | |
| 529 | + | |
| 530 | + | |
515 | 531 | | |
516 | | - | |
| 532 | + | |
517 | 533 | | |
518 | 534 | | |
519 | 535 | | |
520 | | - | |
521 | | - | |
522 | | - | |
523 | | - | |
524 | | - | |
525 | | - | |
526 | | - | |
527 | | - | |
528 | | - | |
529 | | - | |
530 | | - | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
531 | 539 | | |
532 | 540 | | |
533 | 541 | | |
| |||
542 | 550 | | |
543 | 551 | | |
544 | 552 | | |
545 | | - | |
| 553 | + | |
546 | 554 | | |
547 | 555 | | |
548 | 556 | | |
549 | | - | |
550 | | - | |
551 | | - | |
| 557 | + | |
| 558 | + | |
552 | 559 | | |
553 | 560 | | |
554 | 561 | | |
555 | 562 | | |
556 | | - | |
| 563 | + | |
557 | 564 | | |
558 | 565 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| |||
3544 | 3544 | | |
3545 | 3545 | | |
3546 | 3546 | | |
3547 | | - | |
3548 | | - | |
| 3547 | + | |
3549 | 3548 | | |
3550 | 3549 | | |
3551 | 3550 | | |
| |||
0 commit comments