diff --git a/gcc/flags.h b/gcc/flags.h index a9381cf93f2..212e357a0fd 100644 --- a/gcc/flags.h +++ b/gcc/flags.h @@ -40,6 +40,7 @@ unsigned int debug_set_count (uint32_t w_symbols); const char * debug_set_names (uint32_t w_symbols); +#ifndef GENERATOR_FILE /* Return true iff BTF debug info is enabled. */ extern bool btf_debuginfo_p (); @@ -54,12 +55,13 @@ extern bool ctf_debuginfo_p (); /* Return true iff DWARF2 debug info is enabled. */ -extern bool dwarf_debuginfo_p (); +extern bool dwarf_debuginfo_p (struct gcc_options *opts = &global_options); /* Return true iff the debug info format is to be generated based on DWARF DIEs (like CTF and BTF debug info formats). */ extern bool dwarf_based_debuginfo_p (); +#endif extern void strip_off_ending (char *, int); extern int base_of_path (const char *path, const char **base_out); diff --git a/gcc/opts.cc b/gcc/opts.cc index 2ffbf429b7b..a0baec98092 100644 --- a/gcc/opts.cc +++ b/gcc/opts.cc @@ -157,9 +157,9 @@ ctf_debuginfo_p () /* Return TRUE iff dwarf2 debug info is enabled. */ bool -dwarf_debuginfo_p () +dwarf_debuginfo_p (struct gcc_options *opts) { - return (write_symbols & DWARF2_DEBUG); + return (opts->x_write_symbols & DWARF2_DEBUG); } /* Return true iff the debug info format is to be generated based on DWARF @@ -171,6 +171,11 @@ bool dwarf_based_debuginfo_p () || (write_symbols & BTF_DEBUG)); } +/* All flag uses below need to explicitely reference the option sets + to operate on. */ +#define global_options DO_NOT_USE +#define global_options_set DO_NOT_USE + /* Parse the -femit-struct-debug-detailed option value and set the flag variables. */ @@ -1305,57 +1310,61 @@ finish_options (struct gcc_options *opts, struct gcc_options *opts_set, SET_OPTION_IF_UNSET (opts, opts_set, flag_vect_cost_model, VECT_COST_MODEL_CHEAP); - if (flag_gtoggle) + if (opts->x_flag_gtoggle) { /* Make sure to process -gtoggle only once. */ - flag_gtoggle = false; - if (debug_info_level == DINFO_LEVEL_NONE) + opts->x_flag_gtoggle = false; + if (opts->x_debug_info_level == DINFO_LEVEL_NONE) { - debug_info_level = DINFO_LEVEL_NORMAL; + opts->x_debug_info_level = DINFO_LEVEL_NORMAL; - if (write_symbols == NO_DEBUG) - write_symbols = PREFERRED_DEBUGGING_TYPE; + if (opts->x_write_symbols == NO_DEBUG) + opts->x_write_symbols = PREFERRED_DEBUGGING_TYPE; } else - debug_info_level = DINFO_LEVEL_NONE; + opts->x_debug_info_level = DINFO_LEVEL_NONE; } if (!opts_set->x_debug_nonbind_markers_p) - debug_nonbind_markers_p - = (optimize - && debug_info_level >= DINFO_LEVEL_NORMAL - && dwarf_debuginfo_p () - && !(flag_selective_scheduling || flag_selective_scheduling2)); + opts->x_debug_nonbind_markers_p + = (opts->x_optimize + && opts->x_debug_info_level >= DINFO_LEVEL_NORMAL + && dwarf_debuginfo_p (opts) + && !(opts->x_flag_selective_scheduling + || opts->x_flag_selective_scheduling2)); /* Note -fvar-tracking is enabled automatically with OPT_LEVELS_1_PLUS and so we need to drop it if we are called from optimize attribute. */ - if (debug_info_level < DINFO_LEVEL_NORMAL) - flag_var_tracking = false; + if (opts->x_debug_info_level < DINFO_LEVEL_NORMAL) + opts->x_flag_var_tracking = false; /* One could use EnabledBy, but it would lead to a circular dependency. */ if (!opts_set->x_flag_var_tracking_uninit) - flag_var_tracking_uninit = flag_var_tracking; + opts->x_flag_var_tracking_uninit = opts->x_flag_var_tracking; if (!opts_set->x_flag_var_tracking_assignments) - flag_var_tracking_assignments - = (flag_var_tracking - && !(flag_selective_scheduling || flag_selective_scheduling2)); + opts->x_flag_var_tracking_assignments + = (opts->x_flag_var_tracking + && !(opts->x_flag_selective_scheduling + || opts->x_flag_selective_scheduling2)); - if (flag_var_tracking_assignments_toggle) - flag_var_tracking_assignments = !flag_var_tracking_assignments; + if (opts->x_flag_var_tracking_assignments_toggle) + opts->x_flag_var_tracking_assignments + = !opts->x_flag_var_tracking_assignments; - if (flag_var_tracking_assignments && !flag_var_tracking) - flag_var_tracking = flag_var_tracking_assignments = -1; + if (opts->x_flag_var_tracking_assignments && !opts->x_flag_var_tracking) + opts->x_flag_var_tracking = opts->x_flag_var_tracking_assignments = -1; - if (flag_var_tracking_assignments - && (flag_selective_scheduling || flag_selective_scheduling2)) + if (opts->x_flag_var_tracking_assignments + && (opts->x_flag_selective_scheduling + || opts->x_flag_selective_scheduling2)) warning_at (loc, 0, "var-tracking-assignments changes selective scheduling"); - if (flag_syntax_only) + if (opts->x_flag_syntax_only) { - write_symbols = NO_DEBUG; - profile_flag = 0; + opts->x_write_symbols = NO_DEBUG; + opts->x_profile_flag = 0; }