1*38fd1498Szrj /* Command line option handling. Code involving global state that
2*38fd1498Szrj should not be shared with the driver.
3*38fd1498Szrj Copyright (C) 2002-2018 Free Software Foundation, Inc.
4*38fd1498Szrj
5*38fd1498Szrj This file is part of GCC.
6*38fd1498Szrj
7*38fd1498Szrj GCC is free software; you can redistribute it and/or modify it under
8*38fd1498Szrj the terms of the GNU General Public License as published by the Free
9*38fd1498Szrj Software Foundation; either version 3, or (at your option) any later
10*38fd1498Szrj version.
11*38fd1498Szrj
12*38fd1498Szrj GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13*38fd1498Szrj WARRANTY; without even the implied warranty of MERCHANTABILITY or
14*38fd1498Szrj FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15*38fd1498Szrj for more details.
16*38fd1498Szrj
17*38fd1498Szrj You should have received a copy of the GNU General Public License
18*38fd1498Szrj along with GCC; see the file COPYING3. If not see
19*38fd1498Szrj <http://www.gnu.org/licenses/>. */
20*38fd1498Szrj
21*38fd1498Szrj #include "config.h"
22*38fd1498Szrj #include "system.h"
23*38fd1498Szrj #include "coretypes.h"
24*38fd1498Szrj #include "backend.h"
25*38fd1498Szrj #include "rtl.h"
26*38fd1498Szrj #include "tree.h"
27*38fd1498Szrj #include "tree-pass.h"
28*38fd1498Szrj #include "diagnostic.h"
29*38fd1498Szrj #include "opts.h"
30*38fd1498Szrj #include "flags.h"
31*38fd1498Szrj #include "langhooks.h"
32*38fd1498Szrj #include "dbgcnt.h"
33*38fd1498Szrj #include "debug.h"
34*38fd1498Szrj #include "output.h"
35*38fd1498Szrj #include "plugin.h"
36*38fd1498Szrj #include "toplev.h"
37*38fd1498Szrj #include "context.h"
38*38fd1498Szrj #include "stringpool.h"
39*38fd1498Szrj #include "attribs.h"
40*38fd1498Szrj #include "asan.h"
41*38fd1498Szrj #include "file-prefix-map.h" /* add_*_prefix_map() */
42*38fd1498Szrj
43*38fd1498Szrj typedef const char *const_char_p; /* For DEF_VEC_P. */
44*38fd1498Szrj
45*38fd1498Szrj static vec<const_char_p> ignored_options;
46*38fd1498Szrj
47*38fd1498Szrj /* Input file names. */
48*38fd1498Szrj const char **in_fnames;
49*38fd1498Szrj unsigned num_in_fnames;
50*38fd1498Szrj
51*38fd1498Szrj /* Return a malloced slash-separated list of languages in MASK. */
52*38fd1498Szrj
53*38fd1498Szrj char *
write_langs(unsigned int mask)54*38fd1498Szrj write_langs (unsigned int mask)
55*38fd1498Szrj {
56*38fd1498Szrj unsigned int n = 0, len = 0;
57*38fd1498Szrj const char *lang_name;
58*38fd1498Szrj char *result;
59*38fd1498Szrj
60*38fd1498Szrj for (n = 0; (lang_name = lang_names[n]) != 0; n++)
61*38fd1498Szrj if (mask & (1U << n))
62*38fd1498Szrj len += strlen (lang_name) + 1;
63*38fd1498Szrj
64*38fd1498Szrj result = XNEWVEC (char, len);
65*38fd1498Szrj len = 0;
66*38fd1498Szrj for (n = 0; (lang_name = lang_names[n]) != 0; n++)
67*38fd1498Szrj if (mask & (1U << n))
68*38fd1498Szrj {
69*38fd1498Szrj if (len)
70*38fd1498Szrj result[len++] = '/';
71*38fd1498Szrj strcpy (result + len, lang_name);
72*38fd1498Szrj len += strlen (lang_name);
73*38fd1498Szrj }
74*38fd1498Szrj
75*38fd1498Szrj result[len] = 0;
76*38fd1498Szrj
77*38fd1498Szrj return result;
78*38fd1498Szrj }
79*38fd1498Szrj
80*38fd1498Szrj /* Complain that switch DECODED does not apply to this front end (mask
81*38fd1498Szrj LANG_MASK). */
82*38fd1498Szrj
83*38fd1498Szrj static void
complain_wrong_lang(const struct cl_decoded_option * decoded,unsigned int lang_mask)84*38fd1498Szrj complain_wrong_lang (const struct cl_decoded_option *decoded,
85*38fd1498Szrj unsigned int lang_mask)
86*38fd1498Szrj {
87*38fd1498Szrj const struct cl_option *option = &cl_options[decoded->opt_index];
88*38fd1498Szrj const char *text = decoded->orig_option_with_args_text;
89*38fd1498Szrj char *ok_langs = NULL, *bad_lang = NULL;
90*38fd1498Szrj unsigned int opt_flags = option->flags;
91*38fd1498Szrj
92*38fd1498Szrj if (!lang_hooks.complain_wrong_lang_p (option))
93*38fd1498Szrj return;
94*38fd1498Szrj
95*38fd1498Szrj opt_flags &= ((1U << cl_lang_count) - 1) | CL_DRIVER;
96*38fd1498Szrj if (opt_flags != CL_DRIVER)
97*38fd1498Szrj ok_langs = write_langs (opt_flags);
98*38fd1498Szrj if (lang_mask != CL_DRIVER)
99*38fd1498Szrj bad_lang = write_langs (lang_mask);
100*38fd1498Szrj
101*38fd1498Szrj if (opt_flags == CL_DRIVER)
102*38fd1498Szrj error ("command line option %qs is valid for the driver but not for %s",
103*38fd1498Szrj text, bad_lang);
104*38fd1498Szrj else if (lang_mask == CL_DRIVER)
105*38fd1498Szrj gcc_unreachable ();
106*38fd1498Szrj else
107*38fd1498Szrj /* Eventually this should become a hard error IMO. */
108*38fd1498Szrj warning (0, "command line option %qs is valid for %s but not for %s",
109*38fd1498Szrj text, ok_langs, bad_lang);
110*38fd1498Szrj
111*38fd1498Szrj free (ok_langs);
112*38fd1498Szrj free (bad_lang);
113*38fd1498Szrj }
114*38fd1498Szrj
115*38fd1498Szrj /* Buffer the unknown option described by the string OPT. Currently,
116*38fd1498Szrj we only complain about unknown -Wno-* options if they may have
117*38fd1498Szrj prevented a diagnostic. Otherwise, we just ignore them. Note that
118*38fd1498Szrj if we do complain, it is only as a warning, not an error; passing
119*38fd1498Szrj the compiler an unrecognized -Wno-* option should never change
120*38fd1498Szrj whether the compilation succeeds or fails. */
121*38fd1498Szrj
122*38fd1498Szrj static void
postpone_unknown_option_warning(const char * opt)123*38fd1498Szrj postpone_unknown_option_warning (const char *opt)
124*38fd1498Szrj {
125*38fd1498Szrj ignored_options.safe_push (opt);
126*38fd1498Szrj }
127*38fd1498Szrj
128*38fd1498Szrj /* Produce a warning for each option previously buffered. */
129*38fd1498Szrj
130*38fd1498Szrj void
print_ignored_options(void)131*38fd1498Szrj print_ignored_options (void)
132*38fd1498Szrj {
133*38fd1498Szrj while (!ignored_options.is_empty ())
134*38fd1498Szrj {
135*38fd1498Szrj const char *opt;
136*38fd1498Szrj
137*38fd1498Szrj opt = ignored_options.pop ();
138*38fd1498Szrj warning_at (UNKNOWN_LOCATION, 0,
139*38fd1498Szrj "unrecognized command line option %qs", opt);
140*38fd1498Szrj }
141*38fd1498Szrj }
142*38fd1498Szrj
143*38fd1498Szrj /* Handle an unknown option DECODED, returning true if an error should
144*38fd1498Szrj be given. */
145*38fd1498Szrj
146*38fd1498Szrj static bool
unknown_option_callback(const struct cl_decoded_option * decoded)147*38fd1498Szrj unknown_option_callback (const struct cl_decoded_option *decoded)
148*38fd1498Szrj {
149*38fd1498Szrj const char *opt = decoded->arg;
150*38fd1498Szrj
151*38fd1498Szrj if (opt[1] == 'W' && opt[2] == 'n' && opt[3] == 'o' && opt[4] == '-'
152*38fd1498Szrj && !(decoded->errors & CL_ERR_NEGATIVE))
153*38fd1498Szrj {
154*38fd1498Szrj /* We don't generate warnings for unknown -Wno-* options unless
155*38fd1498Szrj we issue diagnostics. */
156*38fd1498Szrj postpone_unknown_option_warning (opt);
157*38fd1498Szrj return false;
158*38fd1498Szrj }
159*38fd1498Szrj else
160*38fd1498Szrj return true;
161*38fd1498Szrj }
162*38fd1498Szrj
163*38fd1498Szrj /* Handle a front-end option; arguments and return value as for
164*38fd1498Szrj handle_option. */
165*38fd1498Szrj
166*38fd1498Szrj static bool
lang_handle_option(struct gcc_options * opts,struct gcc_options * opts_set,const struct cl_decoded_option * decoded,unsigned int lang_mask ATTRIBUTE_UNUSED,int kind,location_t loc,const struct cl_option_handlers * handlers,diagnostic_context * dc,void (*)(void))167*38fd1498Szrj lang_handle_option (struct gcc_options *opts,
168*38fd1498Szrj struct gcc_options *opts_set,
169*38fd1498Szrj const struct cl_decoded_option *decoded,
170*38fd1498Szrj unsigned int lang_mask ATTRIBUTE_UNUSED, int kind,
171*38fd1498Szrj location_t loc,
172*38fd1498Szrj const struct cl_option_handlers *handlers,
173*38fd1498Szrj diagnostic_context *dc,
174*38fd1498Szrj void (*) (void))
175*38fd1498Szrj {
176*38fd1498Szrj gcc_assert (opts == &global_options);
177*38fd1498Szrj gcc_assert (opts_set == &global_options_set);
178*38fd1498Szrj gcc_assert (dc == global_dc);
179*38fd1498Szrj gcc_assert (decoded->canonical_option_num_elements <= 2);
180*38fd1498Szrj return lang_hooks.handle_option (decoded->opt_index, decoded->arg,
181*38fd1498Szrj decoded->value, kind, loc, handlers);
182*38fd1498Szrj }
183*38fd1498Szrj
184*38fd1498Szrj /* Handle FILENAME from the command line. */
185*38fd1498Szrj
186*38fd1498Szrj static void
add_input_filename(const char * filename)187*38fd1498Szrj add_input_filename (const char *filename)
188*38fd1498Szrj {
189*38fd1498Szrj num_in_fnames++;
190*38fd1498Szrj in_fnames = XRESIZEVEC (const char *, in_fnames, num_in_fnames);
191*38fd1498Szrj in_fnames[num_in_fnames - 1] = filename;
192*38fd1498Szrj }
193*38fd1498Szrj
194*38fd1498Szrj /* Handle the vector of command line options (located at LOC), storing
195*38fd1498Szrj the results of processing DECODED_OPTIONS and DECODED_OPTIONS_COUNT
196*38fd1498Szrj in OPTS and OPTS_SET and using DC for diagnostic state. LANG_MASK
197*38fd1498Szrj contains has a single bit set representing the current language.
198*38fd1498Szrj HANDLERS describes what functions to call for the options. */
199*38fd1498Szrj
200*38fd1498Szrj static void
read_cmdline_options(struct gcc_options * opts,struct gcc_options * opts_set,struct cl_decoded_option * decoded_options,unsigned int decoded_options_count,location_t loc,unsigned int lang_mask,const struct cl_option_handlers * handlers,diagnostic_context * dc)201*38fd1498Szrj read_cmdline_options (struct gcc_options *opts, struct gcc_options *opts_set,
202*38fd1498Szrj struct cl_decoded_option *decoded_options,
203*38fd1498Szrj unsigned int decoded_options_count,
204*38fd1498Szrj location_t loc,
205*38fd1498Szrj unsigned int lang_mask,
206*38fd1498Szrj const struct cl_option_handlers *handlers,
207*38fd1498Szrj diagnostic_context *dc)
208*38fd1498Szrj {
209*38fd1498Szrj unsigned int i;
210*38fd1498Szrj
211*38fd1498Szrj for (i = 1; i < decoded_options_count; i++)
212*38fd1498Szrj {
213*38fd1498Szrj if (decoded_options[i].opt_index == OPT_SPECIAL_input_file)
214*38fd1498Szrj {
215*38fd1498Szrj /* Input files should only ever appear on the main command
216*38fd1498Szrj line. */
217*38fd1498Szrj gcc_assert (opts == &global_options);
218*38fd1498Szrj gcc_assert (opts_set == &global_options_set);
219*38fd1498Szrj
220*38fd1498Szrj if (opts->x_main_input_filename == NULL)
221*38fd1498Szrj {
222*38fd1498Szrj opts->x_main_input_filename = decoded_options[i].arg;
223*38fd1498Szrj opts->x_main_input_baselength
224*38fd1498Szrj = base_of_path (opts->x_main_input_filename,
225*38fd1498Szrj &opts->x_main_input_basename);
226*38fd1498Szrj }
227*38fd1498Szrj add_input_filename (decoded_options[i].arg);
228*38fd1498Szrj continue;
229*38fd1498Szrj }
230*38fd1498Szrj
231*38fd1498Szrj read_cmdline_option (opts, opts_set,
232*38fd1498Szrj decoded_options + i, loc, lang_mask, handlers,
233*38fd1498Szrj dc);
234*38fd1498Szrj }
235*38fd1498Szrj }
236*38fd1498Szrj
237*38fd1498Szrj /* Language mask determined at initialization. */
238*38fd1498Szrj static unsigned int initial_lang_mask;
239*38fd1498Szrj
240*38fd1498Szrj /* Initialize global options-related settings at start-up. */
241*38fd1498Szrj
242*38fd1498Szrj void
init_options_once(void)243*38fd1498Szrj init_options_once (void)
244*38fd1498Szrj {
245*38fd1498Szrj /* Perform language-specific options initialization. */
246*38fd1498Szrj initial_lang_mask = lang_hooks.option_lang_mask ();
247*38fd1498Szrj
248*38fd1498Szrj lang_hooks.initialize_diagnostics (global_dc);
249*38fd1498Szrj /* ??? Ideally, we should do this earlier and the FEs will override
250*38fd1498Szrj it if desired (none do it so far). However, the way the FEs
251*38fd1498Szrj construct their pretty-printers means that all previous settings
252*38fd1498Szrj are overriden. */
253*38fd1498Szrj diagnostic_color_init (global_dc);
254*38fd1498Szrj }
255*38fd1498Szrj
256*38fd1498Szrj /* Decode command-line options to an array, like
257*38fd1498Szrj decode_cmdline_options_to_array and with the same arguments but
258*38fd1498Szrj using the default lang_mask. */
259*38fd1498Szrj
260*38fd1498Szrj void
decode_cmdline_options_to_array_default_mask(unsigned int argc,const char ** argv,struct cl_decoded_option ** decoded_options,unsigned int * decoded_options_count)261*38fd1498Szrj decode_cmdline_options_to_array_default_mask (unsigned int argc,
262*38fd1498Szrj const char **argv,
263*38fd1498Szrj struct cl_decoded_option **decoded_options,
264*38fd1498Szrj unsigned int *decoded_options_count)
265*38fd1498Szrj {
266*38fd1498Szrj decode_cmdline_options_to_array (argc, argv,
267*38fd1498Szrj initial_lang_mask | CL_COMMON | CL_TARGET,
268*38fd1498Szrj decoded_options, decoded_options_count);
269*38fd1498Szrj }
270*38fd1498Szrj
271*38fd1498Szrj /* Set *HANDLERS to the default set of option handlers for use in the
272*38fd1498Szrj compilers proper (not the driver). */
273*38fd1498Szrj void
set_default_handlers(struct cl_option_handlers * handlers,void (* target_option_override_hook)(void))274*38fd1498Szrj set_default_handlers (struct cl_option_handlers *handlers,
275*38fd1498Szrj void (*target_option_override_hook) (void))
276*38fd1498Szrj {
277*38fd1498Szrj handlers->unknown_option_callback = unknown_option_callback;
278*38fd1498Szrj handlers->wrong_lang_callback = complain_wrong_lang;
279*38fd1498Szrj handlers->target_option_override_hook = target_option_override_hook;
280*38fd1498Szrj handlers->num_handlers = 3;
281*38fd1498Szrj handlers->handlers[0].handler = lang_handle_option;
282*38fd1498Szrj handlers->handlers[0].mask = initial_lang_mask;
283*38fd1498Szrj handlers->handlers[1].handler = common_handle_option;
284*38fd1498Szrj handlers->handlers[1].mask = CL_COMMON;
285*38fd1498Szrj handlers->handlers[2].handler = target_handle_option;
286*38fd1498Szrj handlers->handlers[2].mask = CL_TARGET;
287*38fd1498Szrj }
288*38fd1498Szrj
289*38fd1498Szrj /* Parse command line options and set default flag values. Do minimal
290*38fd1498Szrj options processing. The decoded options are in *DECODED_OPTIONS
291*38fd1498Szrj and *DECODED_OPTIONS_COUNT; settings go in OPTS, OPTS_SET and DC;
292*38fd1498Szrj the options are located at LOC. */
293*38fd1498Szrj void
decode_options(struct gcc_options * opts,struct gcc_options * opts_set,struct cl_decoded_option * decoded_options,unsigned int decoded_options_count,location_t loc,diagnostic_context * dc,void (* target_option_override_hook)(void))294*38fd1498Szrj decode_options (struct gcc_options *opts, struct gcc_options *opts_set,
295*38fd1498Szrj struct cl_decoded_option *decoded_options,
296*38fd1498Szrj unsigned int decoded_options_count,
297*38fd1498Szrj location_t loc, diagnostic_context *dc,
298*38fd1498Szrj void (*target_option_override_hook) (void))
299*38fd1498Szrj {
300*38fd1498Szrj struct cl_option_handlers handlers;
301*38fd1498Szrj
302*38fd1498Szrj unsigned int lang_mask;
303*38fd1498Szrj
304*38fd1498Szrj lang_mask = initial_lang_mask;
305*38fd1498Szrj
306*38fd1498Szrj set_default_handlers (&handlers, target_option_override_hook);
307*38fd1498Szrj
308*38fd1498Szrj default_options_optimization (opts, opts_set,
309*38fd1498Szrj decoded_options, decoded_options_count,
310*38fd1498Szrj loc, lang_mask, &handlers, dc);
311*38fd1498Szrj
312*38fd1498Szrj read_cmdline_options (opts, opts_set,
313*38fd1498Szrj decoded_options, decoded_options_count,
314*38fd1498Szrj loc, lang_mask,
315*38fd1498Szrj &handlers, dc);
316*38fd1498Szrj
317*38fd1498Szrj finish_options (opts, opts_set, loc);
318*38fd1498Szrj }
319*38fd1498Szrj
320*38fd1498Szrj /* Hold command-line options associated with stack limitation. */
321*38fd1498Szrj const char *opt_fstack_limit_symbol_arg = NULL;
322*38fd1498Szrj int opt_fstack_limit_register_no = -1;
323*38fd1498Szrj
324*38fd1498Szrj /* Process common options that have been deferred until after the
325*38fd1498Szrj handlers have been called for all options. */
326*38fd1498Szrj
327*38fd1498Szrj void
handle_common_deferred_options(void)328*38fd1498Szrj handle_common_deferred_options (void)
329*38fd1498Szrj {
330*38fd1498Szrj unsigned int i;
331*38fd1498Szrj cl_deferred_option *opt;
332*38fd1498Szrj vec<cl_deferred_option> v;
333*38fd1498Szrj
334*38fd1498Szrj if (common_deferred_options)
335*38fd1498Szrj v = *((vec<cl_deferred_option> *) common_deferred_options);
336*38fd1498Szrj else
337*38fd1498Szrj v = vNULL;
338*38fd1498Szrj
339*38fd1498Szrj if (flag_dump_all_passed)
340*38fd1498Szrj enable_rtl_dump_file ();
341*38fd1498Szrj
342*38fd1498Szrj if (flag_opt_info)
343*38fd1498Szrj opt_info_switch_p (NULL);
344*38fd1498Szrj
345*38fd1498Szrj FOR_EACH_VEC_ELT (v, i, opt)
346*38fd1498Szrj {
347*38fd1498Szrj switch (opt->opt_index)
348*38fd1498Szrj {
349*38fd1498Szrj case OPT_fcall_used_:
350*38fd1498Szrj fix_register (opt->arg, 0, 1);
351*38fd1498Szrj break;
352*38fd1498Szrj
353*38fd1498Szrj case OPT_fcall_saved_:
354*38fd1498Szrj fix_register (opt->arg, 0, 0);
355*38fd1498Szrj break;
356*38fd1498Szrj
357*38fd1498Szrj case OPT_fdbg_cnt_:
358*38fd1498Szrj dbg_cnt_process_opt (opt->arg);
359*38fd1498Szrj break;
360*38fd1498Szrj
361*38fd1498Szrj case OPT_fdbg_cnt_list:
362*38fd1498Szrj dbg_cnt_list_all_counters ();
363*38fd1498Szrj break;
364*38fd1498Szrj
365*38fd1498Szrj case OPT_fdebug_prefix_map_:
366*38fd1498Szrj add_debug_prefix_map (opt->arg);
367*38fd1498Szrj break;
368*38fd1498Szrj
369*38fd1498Szrj case OPT_ffile_prefix_map_:
370*38fd1498Szrj add_file_prefix_map (opt->arg);
371*38fd1498Szrj break;
372*38fd1498Szrj
373*38fd1498Szrj case OPT_fdump_:
374*38fd1498Szrj if (!g->get_dumps ()->dump_switch_p (opt->arg))
375*38fd1498Szrj error ("unrecognized command line option %<-fdump-%s%>", opt->arg);
376*38fd1498Szrj break;
377*38fd1498Szrj
378*38fd1498Szrj case OPT_fopt_info_:
379*38fd1498Szrj if (!opt_info_switch_p (opt->arg))
380*38fd1498Szrj error ("unrecognized command line option %<-fopt-info-%s%>",
381*38fd1498Szrj opt->arg);
382*38fd1498Szrj break;
383*38fd1498Szrj
384*38fd1498Szrj case OPT_fenable_:
385*38fd1498Szrj case OPT_fdisable_:
386*38fd1498Szrj if (opt->opt_index == OPT_fenable_)
387*38fd1498Szrj enable_pass (opt->arg);
388*38fd1498Szrj else
389*38fd1498Szrj disable_pass (opt->arg);
390*38fd1498Szrj break;
391*38fd1498Szrj
392*38fd1498Szrj case OPT_ffixed_:
393*38fd1498Szrj /* Deferred. */
394*38fd1498Szrj fix_register (opt->arg, 1, 1);
395*38fd1498Szrj break;
396*38fd1498Szrj
397*38fd1498Szrj case OPT_fplugin_:
398*38fd1498Szrj #ifdef ENABLE_PLUGIN
399*38fd1498Szrj add_new_plugin (opt->arg);
400*38fd1498Szrj #else
401*38fd1498Szrj error ("plugin support is disabled; configure with --enable-plugin");
402*38fd1498Szrj #endif
403*38fd1498Szrj break;
404*38fd1498Szrj
405*38fd1498Szrj case OPT_fplugin_arg_:
406*38fd1498Szrj #ifdef ENABLE_PLUGIN
407*38fd1498Szrj parse_plugin_arg_opt (opt->arg);
408*38fd1498Szrj #else
409*38fd1498Szrj error ("plugin support is disabled; configure with --enable-plugin");
410*38fd1498Szrj #endif
411*38fd1498Szrj break;
412*38fd1498Szrj
413*38fd1498Szrj case OPT_frandom_seed:
414*38fd1498Szrj /* The real switch is -fno-random-seed. */
415*38fd1498Szrj if (!opt->value)
416*38fd1498Szrj set_random_seed (NULL);
417*38fd1498Szrj break;
418*38fd1498Szrj
419*38fd1498Szrj case OPT_frandom_seed_:
420*38fd1498Szrj set_random_seed (opt->arg);
421*38fd1498Szrj break;
422*38fd1498Szrj
423*38fd1498Szrj case OPT_fstack_limit:
424*38fd1498Szrj /* The real switch is -fno-stack-limit. */
425*38fd1498Szrj if (!opt->value)
426*38fd1498Szrj stack_limit_rtx = NULL_RTX;
427*38fd1498Szrj break;
428*38fd1498Szrj
429*38fd1498Szrj case OPT_fstack_limit_register_:
430*38fd1498Szrj {
431*38fd1498Szrj int reg = decode_reg_name (opt->arg);
432*38fd1498Szrj if (reg < 0)
433*38fd1498Szrj error ("unrecognized register name %qs", opt->arg);
434*38fd1498Szrj else
435*38fd1498Szrj {
436*38fd1498Szrj /* Deactivate previous OPT_fstack_limit_symbol_ options. */
437*38fd1498Szrj opt_fstack_limit_symbol_arg = NULL;
438*38fd1498Szrj opt_fstack_limit_register_no = reg;
439*38fd1498Szrj }
440*38fd1498Szrj }
441*38fd1498Szrj break;
442*38fd1498Szrj
443*38fd1498Szrj case OPT_fstack_limit_symbol_:
444*38fd1498Szrj /* Deactivate previous OPT_fstack_limit_register_ options. */
445*38fd1498Szrj opt_fstack_limit_register_no = -1;
446*38fd1498Szrj opt_fstack_limit_symbol_arg = opt->arg;
447*38fd1498Szrj break;
448*38fd1498Szrj
449*38fd1498Szrj case OPT_fasan_shadow_offset_:
450*38fd1498Szrj if (!(flag_sanitize & SANITIZE_KERNEL_ADDRESS))
451*38fd1498Szrj error ("-fasan-shadow-offset should only be used "
452*38fd1498Szrj "with -fsanitize=kernel-address");
453*38fd1498Szrj if (!set_asan_shadow_offset (opt->arg))
454*38fd1498Szrj error ("unrecognized shadow offset %qs", opt->arg);
455*38fd1498Szrj break;
456*38fd1498Szrj
457*38fd1498Szrj case OPT_fsanitize_sections_:
458*38fd1498Szrj set_sanitized_sections (opt->arg);
459*38fd1498Szrj break;
460*38fd1498Szrj
461*38fd1498Szrj default:
462*38fd1498Szrj gcc_unreachable ();
463*38fd1498Szrj }
464*38fd1498Szrj }
465*38fd1498Szrj }
466