| 1 |
/* { dg-do "compile" { target *-*-linux* } } */ |
| 2 |
/* { dg-options "-O1 -fcf-protection -mmanual-endbr" } */ |
| 3 |
/* { dg-final { check-function-bodies "**" "" } } */ |
| 4 |
|
| 5 |
/* Note: this test only checks the instructions in the function bodies, |
| 6 |
not the placement of the patch label or nops before the function. */ |
| 7 |
|
| 8 |
/* |
| 9 |
**f10_none: |
| 10 |
** nop |
| 11 |
** ret |
| 12 |
*/ |
| 13 |
void |
| 14 |
__attribute__ ((nocf_check,patchable_function_entry (1, 0))) |
| 15 |
f10_none (void) |
| 16 |
{ |
| 17 |
} |
| 18 |
|
| 19 |
/* |
| 20 |
**f10_endbr: |
| 21 |
** endbr(32|64) |
| 22 |
** nop |
| 23 |
** ret |
| 24 |
*/ |
| 25 |
void |
| 26 |
__attribute__ ((cf_check,patchable_function_entry (1, 0))) |
| 27 |
f10_endbr (void) |
| 28 |
{ |
| 29 |
} |
| 30 |
|
| 31 |
/* |
| 32 |
**f11_none: |
| 33 |
** ret |
| 34 |
*/ |
| 35 |
void |
| 36 |
__attribute__ ((nocf_check,patchable_function_entry (1, 1))) |
| 37 |
f11_none (void) |
| 38 |
{ |
| 39 |
} |
| 40 |
|
| 41 |
/* |
| 42 |
**f11_endbr: |
| 43 |
** endbr(32|64) |
| 44 |
** ret |
| 45 |
*/ |
| 46 |
void |
| 47 |
__attribute__ ((cf_check,patchable_function_entry (1, 1))) |
| 48 |
f11_endbr (void) |
| 49 |
{ |
| 50 |
} |
| 51 |
|
| 52 |
/* |
| 53 |
**f21_none: |
| 54 |
** nop |
| 55 |
** ret |
| 56 |
*/ |
| 57 |
void |
| 58 |
__attribute__ ((nocf_check,patchable_function_entry (2, 1))) |
| 59 |
f21_none (void) |
| 60 |
{ |
| 61 |
} |
| 62 |
|
| 63 |
/* |
| 64 |
**f21_endbr: |
| 65 |
** endbr(32|64) |
| 66 |
** nop |
| 67 |
** ret |
| 68 |
*/ |
| 69 |
void |
| 70 |
__attribute__ ((cf_check,patchable_function_entry (2, 1))) |
| 71 |
f21_endbr (void) |
| 72 |
{ |
| 73 |
} |