@@ -31,8 +31,28 @@ static int parse_dump(const struct option *opt, const char *str, int unset)
3131 return -1 ;
3232}
3333
34+ static int parse_hacks (const struct option * opt , const char * str , int unset )
35+ {
36+ bool found = false;
37+
38+ /*
39+ * Use strstr() as a lazy method of checking for comma-separated
40+ * options.
41+ *
42+ * No string provided == enable all options.
43+ */
44+
45+ if (!str || strstr (str , "jump_label" )) {
46+ opts .hack_jump_label = true;
47+ found = true;
48+ }
49+
50+ return found ? 0 : -1 ;
51+ }
52+
3453const struct option check_options [] = {
3554 OPT_GROUP ("Actions:" ),
55+ OPT_CALLBACK_OPTARG ('h' , "hacks" , NULL , NULL , "jump_label" , "patch toolchain bugs/limitations" , parse_hacks ),
3656 OPT_BOOLEAN ('i' , "ibt" , & opts .ibt , "validate and annotate IBT" ),
3757 OPT_BOOLEAN ('m' , "mcount" , & opts .mcount , "annotate mcount/fentry calls for ftrace" ),
3858 OPT_BOOLEAN ('n' , "noinstr" , & opts .noinstr , "validate noinstr rules" ),
@@ -87,14 +107,15 @@ int cmd_parse_options(int argc, const char **argv, const char * const usage[])
87107
88108static bool opts_valid (void )
89109{
90- if (opts .ibt ||
91- opts .mcount ||
92- opts .noinstr ||
93- opts .orc ||
94- opts .retpoline ||
95- opts .sls ||
96- opts .stackval ||
97- opts .static_call ||
110+ if (opts .hack_jump_label ||
111+ opts .ibt ||
112+ opts .mcount ||
113+ opts .noinstr ||
114+ opts .orc ||
115+ opts .retpoline ||
116+ opts .sls ||
117+ opts .stackval ||
118+ opts .static_call ||
98119 opts .uaccess ) {
99120 if (opts .dump_orc ) {
100121 fprintf (stderr , "--dump can't be combined with other options\n" );
0 commit comments