GCC Middle and Back End API Reference
gcc.cc File Reference
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "multilib.h"
#include "tm.h"
#include "xregex.h"
#include "obstack.h"
#include "intl.h"
#include "prefix.h"
#include "opt-suggestions.h"
#include "gcc.h"
#include "diagnostic.h"
#include "flags.h"
#include "opts.h"
#include "filenames.h"
#include "spellcheck.h"
#include "opts-jobserver.h"
#include "common/common-target.h"
#include "gcc-urlifier.h"
#include "configargs.h"
#include "specs.h"
Include dependency graph for gcc.cc:

Data Structures

struct  env_manager
 
struct  env_manager::kv
 
struct  default_spec
 
struct  user_specs
 
struct  compiler
 
struct  prefix_list
 
struct  path_prefix
 
struct  spec_list
 
struct  temp_name
 
struct  temp_file
 
struct  add_to_obstack_info
 
struct  file_at_path_info
 
struct  infile
 
struct  spec_path_info
 
struct  mdswitchstr
 
struct  used_arg_t
 
struct  used_arg_t::mswitchstr
 

Macros

#define INCLUDE_STRING
 
#define MATH_LIBRARY   "m"
 
#define TARGET_EXECUTABLE_SUFFIX   ""
 
#define HOST_EXECUTABLE_SUFFIX   ""
 
#define TARGET_OBJECT_SUFFIX   ".o"
 
#define LIBRARY_PATH_ENV   "LIBRARY_PATH"
 
#define MIN_FATAL_STATUS   1
 
#define DEFAULT_TARGET_SYSTEM_ROOT   (0)
 
#define ASM_SPEC   ""
 
#define ASM_FINAL_SPEC    "%{gsplit-dwarf: \n\ objcopy --extract-dwo \ %{c:%{o*:%*}%{!o*:%w%b%O}}%{!c:%U%O} \ %b.dwo \n\ objcopy --strip-dwo \ %{c:%{o*:%*}%{!o*:%w%b%O}}%{!c:%U%O} \ }"
 
#define CPP_SPEC   ""
 
#define OS_CC1_SPEC   ""
 
#define CC1_SPEC   ""
 
#define CC1PLUS_SPEC   ""
 
#define LINK_SPEC   ""
 
#define LIB_SPEC   "%{!shared:%{g*:-lg} %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}}"
 
#define STACK_SPLIT_SPEC   " %{fsplit-stack: --wrap=pthread_create}"
 
#define STATIC_LIBASAN_LIBS    " %{static-libasan|static:%:include(libsanitizer.spec)%(link_libasan)}"
 
#define LIBASAN_SPEC   "-lasan" STATIC_LIBASAN_LIBS
 
#define LIBASAN_EARLY_SPEC   ""
 
#define STATIC_LIBHWASAN_LIBS    " %{static-libhwasan|static:%:include(libsanitizer.spec)%(link_libhwasan)}"
 
#define LIBHWASAN_SPEC   "-lhwasan" STATIC_LIBHWASAN_LIBS
 
#define LIBHWASAN_EARLY_SPEC   ""
 
#define STATIC_LIBTSAN_LIBS    " %{static-libtsan|static:%:include(libsanitizer.spec)%(link_libtsan)}"
 
#define LIBTSAN_SPEC   "-ltsan" STATIC_LIBTSAN_LIBS
 
#define LIBTSAN_EARLY_SPEC   ""
 
#define STATIC_LIBLSAN_LIBS    " %{static-liblsan|static:%:include(libsanitizer.spec)%(link_liblsan)}"
 
#define LIBLSAN_SPEC   "-llsan" STATIC_LIBLSAN_LIBS
 
#define LIBLSAN_EARLY_SPEC   ""
 
#define STATIC_LIBUBSAN_LIBS    " %{static-libubsan|static:%:include(libsanitizer.spec)%(link_libubsan)}"
 
#define LIBUBSAN_SPEC   "-lubsan" STATIC_LIBUBSAN_LIBS
 
#define LINK_COMPRESS_DEBUG_SPEC    " %{gz*:%e-gz is not supported in this configuration} "
 
#define LIBGCC_SPEC   "-lgcc"
 
#define STARTFILE_SPEC    "%{!shared:%{pg:gcrt0%O%s}%{!pg:%{p:mcrt0%O%s}%{!p:crt0%O%s}}}"
 
#define ENDFILE_SPEC   ""
 
#define LINKER_NAME   "collect2"
 
#define ASM_MAP   ""
 
#define ASM_COMPRESS_DEBUG_SPEC    " %{gz*:%e-gz is not supported in this configuration} "
 
#define ASM_DEBUG_DWARF_OPTION   "--gdwarf2"
 
#define ASM_DEBUG_SPEC   ""
 
#define ASM_DEBUG_OPTION_SPEC   ""
 
#define LINK_GCC_C_SEQUENCE_SPEC   "%G %{!nolibc:%L %G}"
 
#define LINK_SSP_SPEC
 
#define PIE_SPEC   "pie"
 
#define FPIE1_SPEC   "fpie"
 
#define NO_FPIE1_SPEC   FPIE1_SPEC ":;"
 
#define FPIE2_SPEC   "fPIE"
 
#define NO_FPIE2_SPEC   FPIE2_SPEC ":;"
 
#define FPIE_SPEC   FPIE1_SPEC "|" FPIE2_SPEC
 
#define NO_FPIE_SPEC   FPIE_SPEC ":;"
 
#define FPIC1_SPEC   "fpic"
 
#define NO_FPIC1_SPEC   FPIC1_SPEC ":;"
 
#define FPIC2_SPEC   "fPIC"
 
#define NO_FPIC2_SPEC   FPIC2_SPEC ":;"
 
#define FPIC_SPEC   FPIC1_SPEC "|" FPIC2_SPEC
 
#define NO_FPIC_SPEC   FPIC_SPEC ":;"
 
#define FPIE1_OR_FPIC1_SPEC   FPIE1_SPEC "|" FPIC1_SPEC
 
#define NO_FPIE1_AND_FPIC1_SPEC   FPIE1_OR_FPIC1_SPEC ":;"
 
#define FPIE2_OR_FPIC2_SPEC   FPIE2_SPEC "|" FPIC2_SPEC
 
#define NO_FPIE2_AND_FPIC2_SPEC   FPIE1_OR_FPIC2_SPEC ":;"
 
#define FPIE_OR_FPIC_SPEC   FPIE_SPEC "|" FPIC_SPEC
 
#define NO_FPIE_AND_FPIC_SPEC   FPIE_OR_FPIC_SPEC ":;"
 
#define LD_PIE_SPEC   ""
 
#define LINK_PIE_SPEC   "%{static|shared|r:;" PIE_SPEC ":" LD_PIE_SPEC "} "
 
#define LTO_PLUGIN_SPEC   ""
 
#define LINK_PLUGIN_SPEC   "%{fuse-linker-plugin:\ %e-fuse-linker-plugin is not supported in this configuration}"
 
#define SANITIZER_EARLY_SPEC   "\%{!nostdlib:%{!r:%{!nodefaultlibs:%{%:sanitize(address):" LIBASAN_EARLY_SPEC "} \ %{%:sanitize(hwaddress):" LIBHWASAN_EARLY_SPEC "} \ %{%:sanitize(thread):" LIBTSAN_EARLY_SPEC "} \ %{%:sanitize(leak):" LIBLSAN_EARLY_SPEC "}}}}"
 
#define SANITIZER_SPEC   "\%{!nostdlib:%{!r:%{!nodefaultlibs:%{%:sanitize(address):" LIBASAN_SPEC "\ %{static:%ecannot specify -static with -fsanitize=address}}\ %{%:sanitize(hwaddress):" LIBHWASAN_SPEC "\ %{static:%ecannot specify -static with -fsanitize=hwaddress}}\ %{%:sanitize(thread):" LIBTSAN_SPEC "\ %{static:%ecannot specify -static with -fsanitize=thread}}\ %{%:sanitize(undefined):" LIBUBSAN_SPEC "}\ %{%:sanitize(leak):" LIBLSAN_SPEC "}}}}"
 
#define POST_LINK_SPEC   ""
 
#define VTABLE_VERIFICATION_SPEC   "\%{fvtable-verify=none:} \%{fvtable-verify=std: \ %e-fvtable-verify=std is not supported in this configuration} \%{fvtable-verify=preinit: \ %e-fvtable-verify=preinit is not supported in this configuration}"
 
#define LINK_COMMAND_SPEC
 
#define LINK_LIBGCC_SPEC   "%D"
 
#define STARTFILE_PREFIX_SPEC   ""
 
#define SYSROOT_SPEC   "--sysroot=%R"
 
#define SYSROOT_SUFFIX_SPEC   ""
 
#define SYSROOT_HEADERS_SUFFIX_SPEC   ""
 
#define RUNPATH_OPTION   "-rpath"
 
#define DUMPS_OPTIONS(EXTS)    "%<dumpdir %<dumpbase %<dumpbase-ext %{d*} %:dumps(" EXTS ")"
 
#define MULTILIB_DEFAULTS   { "" }
 
#define DRIVER_SELF_SPECS   ""
 
#define GOMP_SELF_SPECS
 
#define GTM_SELF_SPECS   "%{fgnu-tm: -pthread}"
 
#define OPTION_DEFAULT_SPECS   { "", "" }
 
#define STANDARD_STARTFILE_PREFIX_1   "/lib/"
 
#define STANDARD_STARTFILE_PREFIX_2   "/usr/lib/"
 
#define MD_EXEC_PREFIX   ""
 
#define MD_STARTFILE_PREFIX   ""
 
#define MD_STARTFILE_PREFIX_1   ""
 
#define INIT_STATIC_SPEC(NAME, PTR)
 
#define DELETE_IF_ORDINARY(NAME, ST, VERBOSE_FLAG)
 
#define SKIP_WHITE()   do { while (*p == ' ' || *p == '\t') p++; } while (0)
 
#define RETRY_ICE_ATTEMPTS   3
 
#define SKIP_WHITE()   do { while (*p == ' ' || *p == '\t') p++; } while (0)
 

Typedefs

typedef char * char_p
 
typedef const char * const_char_p
 

Enumerations

enum  save_temps { SAVE_TEMPS_NONE , SAVE_TEMPS_CWD , SAVE_TEMPS_DUMP , SAVE_TEMPS_OBJ }
 
enum  path_prefix_priority { PREFIX_PRIORITY_B_OPT , PREFIX_PRIORITY_LAST }
 
enum  attempt_status { ATTEMPT_STATUS_FAIL_TO_RUN , ATTEMPT_STATUS_SUCCESS , ATTEMPT_STATUS_ICE }
 

Functions

static void init_spec (void)
 
static void store_arg (const char *, int, int)
 
static void insert_wrapper (const char *)
 
static char * load_specs (const char *)
 
static void read_specs (const char *, bool, bool)
 
static void set_spec (const char *, const char *, bool)
 
static struct compilerlookup_compiler (const char *, size_t, const char *)
 
static char * build_search_list (const struct path_prefix *, const char *, bool, bool)
 
static void xputenv (const char *)
 
static void putenv_from_prefixes (const struct path_prefix *, const char *, bool)
 
static int access_check (const char *, int)
 
static char * find_a_file (const struct path_prefix *, const char *, int, bool)
 
static char * find_a_program (const char *)
 
static void add_prefix (struct path_prefix *, const char *, const char *, int, int, int)
 
static void add_sysrooted_prefix (struct path_prefix *, const char *, const char *, int, int, int)
 
static char * skip_whitespace (char *)
 
static void delete_if_ordinary (const char *)
 
static void delete_temp_files (void)
 
static void delete_failure_queue (void)
 
static void clear_failure_queue (void)
 
static int check_live_switch (int, int)
 
static const char * handle_braces (const char *)
 
static bool input_suffix_matches (const char *, const char *)
 
static bool switch_matches (const char *, const char *, int)
 
static void mark_matching_switches (const char *, const char *, int)
 
static void process_marked_switches (void)
 
static const char * process_brace_body (const char *, const char *, const char *, int, int)
 
static const struct spec_functionlookup_spec_function (const char *)
 
static const char * eval_spec_function (const char *, const char *, const char *)
 
static const char * handle_spec_function (const char *, bool *, const char *)
 
static char * save_string (const char *, int)
 
static void set_collect_gcc_options (void)
 
static int do_spec_1 (const char *, int, const char *)
 
static int do_spec_2 (const char *, const char *)
 
static void do_option_spec (const char *, const char *)
 
static void do_self_spec (const char *)
 
static const char * find_file (const char *)
 
static int is_directory (const char *, bool)
 
static const char * validate_switches (const char *, bool, bool)
 
static void validate_all_switches (void)
 
static void validate_switches_from_spec (const char *, bool)
 
static void give_switch (int, int)
 
static int default_arg (const char *, int)
 
static void set_multilib_dir (void)
 
static void print_multilib_info (void)
 
static void display_help (void)
 
static void add_preprocessor_option (const char *, int)
 
static void add_assembler_option (const char *, int)
 
static void add_linker_option (const char *, int)
 
static void process_command (unsigned int, struct cl_decoded_option *)
 
static int execute (void)
 
static void alloc_args (void)
 
static void clear_args (void)
 
static void fatal_signal (int)
 
static void try_generate_repro (const char **argv)
 
static const char * getenv_spec_function (int, const char **)
 
static const char * if_exists_spec_function (int, const char **)
 
static const char * if_exists_else_spec_function (int, const char **)
 
static const char * if_exists_then_else_spec_function (int, const char **)
 
static const char * sanitize_spec_function (int, const char **)
 
static const char * replace_outfile_spec_function (int, const char **)
 
static const char * remove_outfile_spec_function (int, const char **)
 
static const char * version_compare_spec_function (int, const char **)
 
static const char * include_spec_function (int, const char **)
 
static const char * find_file_spec_function (int, const char **)
 
static const char * find_plugindir_spec_function (int, const char **)
 
static const char * print_asm_header_spec_function (int, const char **)
 
static const char * compare_debug_dump_opt_spec_function (int, const char **)
 
static const char * compare_debug_self_opt_spec_function (int, const char **)
 
static const char * pass_through_libs_spec_func (int, const char **)
 
static const char * dumps_spec_func (int, const char **)
 
static const char * greater_than_spec_func (int, const char **)
 
static const char * debug_level_greater_than_spec_func (int, const char **)
 
static const char * dwarf_version_greater_than_spec_func (int, const char **)
 
static const char * find_fortran_preinclude_file (int, const char **)
 
static const char * join_spec_func (int, const char **)
 
static char * convert_white_space (char *)
 
static char * quote_spec (char *)
 
static char * quote_spec_arg (char *)
 
static bool not_actual_file_p (const char *)
 
static void set_static_spec (const char **spec, const char *value, bool alloc_p)
 
static void set_static_spec_owned (const char **spec, const char *val)
 
static void set_static_spec_shared (const char **spec, const char *val)
 
static void open_at_file (void)
 
static char * make_at_file (void)
 
static void close_at_file (void)
 
void record_temp_file (const char *filename, int always_delete, int fail_delete)
 
static void * for_each_path (const struct path_prefix *paths, bool do_multi, size_t extra_space, void *(*callback)(char *, void *), void *callback_info)
 
static void * add_to_obstack (char *path, void *data)
 
static void * file_at_path (char *path, void *data)
 
static void add_sysrooted_hdrs_prefix (struct path_prefix *pprefix, const char *prefix, const char *component, int priority, int require_machine_suffix, int os_multilib)
 
static void alloc_infile (void)
 
static void add_infile (const char *name, const char *language)
 
static void alloc_switch (void)
 
static void save_switch (const char *opt, size_t n_args, const char *const *args, bool validated, bool known)
 
static void set_source_date_epoch_envvar ()
 
static bool driver_unknown_option_callback (const struct cl_decoded_option *decoded)
 
static void driver_wrong_lang_callback (const struct cl_decoded_option *decoded, unsigned int lang_mask)
 
static bool check_offload_target_name (const char *target, ptrdiff_t len)
 
static void check_foffload_target_names (const char *arg)
 
static void handle_foffload_option (const char *arg)
 
static void forward_offload_option (size_t opt_index, const char *arg, bool validated)
 
static bool driver_handle_option (struct gcc_options *opts, struct gcc_options *opts_set, const struct cl_decoded_option *decoded, unsigned int lang_mask, int kind, location_t loc, const struct cl_option_handlers *handlers, diagnostic_context *dc, void(*)(void))
 
static bool adds_single_suffix_p (const char *f2, const char *f1)
 
static void set_option_handlers (struct cl_option_handlers *handlers)
 
static int single_input_file_index ()
 
static void end_going_arg (void)
 
int do_spec (const char *spec)
 
static void * spec_path (char *path, void *data)
 
static bool compile_input_file_p (struct infile *infile)
 
static void do_specs_vec (vec< char_p > vec)
 
static void putenv_COLLECT_AS_OPTIONS (vec< char_p > vec)
 
static bool input_spec_matches (const char *atom, const char *end_atom)
 
static void print_configuration (FILE *file)
 
static bool files_equal_p (char *file1, char *file2)
 
static bool check_repro (char **temp_stdout_files, char **temp_stderr_files)
 
static enum attempt_status run_attempt (const char **new_argv, const char *out_temp, const char *err_temp, int emit_system_info, int append)
 
static void insert_comments (const char *file_in, const char *file_out)
 
static void do_report_bug (const char **new_argv, const int nargs, char **out_file, char **err_file)
 
void set_input (const char *filename)
 
static int compare_files (char *cmpfile[])
 
static int compare_version_strings (const char *v1, const char *v2)
 
static unsigned HOST_WIDE_INT get_random_number (void)
 
static void path_prefix_reset (path_prefix *prefix)
 
static char * quote_string (char *orig, bool(*quote_p)(char, void *), void *p)
 
static bool whitespace_to_convert_p (char c, void *)
 
static bool quote_spec_char_p (char c, void *)
 
void driver_get_configure_time_options (void(*cb)(const char *option, void *user_data), void *user_data)
 

Variables

static env_manager env
 
static const char dir_separator_str [] = { DIR_SEPARATOR, 0 }
 
int is_cpp_driver
 
static bool at_file_supplied
 
static int print_help_list
 
static int print_version
 
static const char * completion = NULL
 
static int verbose_only_flag
 
static int print_subprocess_help
 
static const char * use_ld
 
FILE * report_times_to_file = NULL
 
static const char * target_system_root = DEFAULT_TARGET_SYSTEM_ROOT
 
static int target_system_root_changed
 
static const char * target_sysroot_suffix = 0
 
static const char * target_sysroot_hdrs_suffix = 0
 
static enum save_temps save_temps_flag
 
static bool save_temps_overrides_dumpdir = false
 
static char * dumpdir
 
static char * dumpbase
 
static char * dumpbase_ext
 
static size_t dumpdir_length = 0
 
static bool dumpdir_trailing_dash_added = false
 
static bool any_link_options_p
 
static bool static_p
 
static char * outbase
 
static size_t outbase_length = 0
 
static const char * compiler_version
 
static const char *const spec_version = DEFAULT_TARGET_VERSION
 
static const char * spec_machine = DEFAULT_TARGET_MACHINE
 
static const char * spec_host_machine = DEFAULT_REAL_TARGET_MACHINE
 
static char * offload_targets = NULL
 
static const char * cross_compile = "0"
 
static int greatest_status = 1
 
static struct obstack obstack
 
static struct obstack collect_obstack
 
static const char * asm_debug = ASM_DEBUG_SPEC
 
static const char * asm_debug_option = ASM_DEBUG_OPTION_SPEC
 
static const char * cpp_spec = CPP_SPEC
 
static const char * cc1_spec = CC1_SPEC OS_CC1_SPEC
 
static const char * cc1plus_spec = CC1PLUS_SPEC
 
static const char * link_gcc_c_sequence_spec = LINK_GCC_C_SEQUENCE_SPEC
 
static const char * link_ssp_spec = LINK_SSP_SPEC
 
static const char * asm_spec = ASM_SPEC
 
static const char * asm_final_spec = ASM_FINAL_SPEC
 
static const char * link_spec = LINK_SPEC
 
static const char * lib_spec = LIB_SPEC
 
static const char * link_gomp_spec = ""
 
static const char * libgcc_spec = LIBGCC_SPEC
 
static const char * endfile_spec = ENDFILE_SPEC
 
static const char * startfile_spec = STARTFILE_SPEC
 
static const char * linker_name_spec = LINKER_NAME
 
static const char * linker_plugin_file_spec = ""
 
static const char * lto_wrapper_spec = ""
 
static const char * lto_gcc_spec = ""
 
static const char * post_link_spec = POST_LINK_SPEC
 
static const char * link_command_spec = LINK_COMMAND_SPEC
 
static const char * link_libgcc_spec = LINK_LIBGCC_SPEC
 
static const char * startfile_prefix_spec = STARTFILE_PREFIX_SPEC
 
static const char * sysroot_spec = SYSROOT_SPEC
 
static const char * sysroot_suffix_spec = SYSROOT_SUFFIX_SPEC
 
static const char * sysroot_hdrs_suffix_spec = SYSROOT_HEADERS_SUFFIX_SPEC
 
static const char * self_spec = ""
 
static const char * trad_capable_cpp
 
static const char * cpp_unique_options
 
static const char * cpp_options
 
static const char * cpp_debug_options = DUMPS_OPTIONS ("")
 
static const char * cc1_options
 
static const char * asm_options
 
static const char * invoke_as
 
static struct obstack multilib_obstack
 
static const char * multilib_select
 
static const char * multilib_matches
 
static const char * multilib_defaults
 
static const char * multilib_exclusions
 
static const char * multilib_reuse
 
static const char *const multilib_defaults_raw [] = MULTILIB_DEFAULTS
 
static const char *const driver_self_specs []
 
static const struct default_spec option_default_specs [] = { OPTION_DEFAULT_SPECS }
 
static struct user_specsuser_specs_head
 
static struct user_specsuser_specs_tail
 
static struct compilercompilers
 
static int n_compilers
 
static const struct compiler default_compilers []
 
static const int n_default_compilers = ARRAY_SIZE (default_compilers) - 1
 
static vec< char_plinker_options
 
static vec< char_passembler_options
 
static vec< char_ppreprocessor_options
 
static struct path_prefix exec_prefixes = { 0, 0, "exec" }
 
static struct path_prefix startfile_prefixes = { 0, 0, "startfile" }
 
static struct path_prefix include_prefixes = { 0, 0, "include" }
 
static const char * machine_suffix = 0
 
static const char * just_machine_suffix = 0
 
static const char * gcc_exec_prefix
 
static const char * gcc_libexec_prefix
 
static const char *const standard_exec_prefix = STANDARD_EXEC_PREFIX
 
static const char *const standard_libexec_prefix = STANDARD_LIBEXEC_PREFIX
 
static const char *const standard_bindir_prefix = STANDARD_BINDIR_PREFIX
 
static const char *const standard_startfile_prefix = STANDARD_STARTFILE_PREFIX
 
static const char * md_exec_prefix = MD_EXEC_PREFIX
 
static const char * md_startfile_prefix = MD_STARTFILE_PREFIX
 
static const char * md_startfile_prefix_1 = MD_STARTFILE_PREFIX_1
 
static const char *const standard_startfile_prefix_1 = STANDARD_STARTFILE_PREFIX_1
 
static const char *const standard_startfile_prefix_2 = STANDARD_STARTFILE_PREFIX_2
 
static const char *const tooldir_base_prefix = TOOLDIR_BASE_PREFIX
 
static const char *const accel_dir_suffix = ACCEL_DIR_SUFFIX
 
static const char * multilib_dir
 
static const char * multilib_os_dir
 
static const char * multiarch_dir
 
static struct spec_list static_specs []
 
static struct spec_listspecs = (struct spec_list *) 0
 
static const struct spec_function static_spec_functions []
 
static int processing_spec_function
 
static vec< const_char_pargbuf
 
static vec< const_char_pat_file_argbuf
 
static bool in_at_file = false
 
static int have_c = 0
 
static int have_o = 0
 
static int have_E = 0
 
static const char * output_file = 0
 
static const char * totruncate_file = 0
 
static struct temp_nametemp_names
 
static int execution_count
 
static int signal_count
 
static const char * temp_filename
 
static int temp_filename_length
 
static struct temp_filealways_delete_queue
 
static struct temp_filefailure_delete_queue
 
static struct switchstrswitches
 
static int n_switches
 
static int n_switches_alloc
 
int compare_debug
 
int compare_debug_second
 
const char * compare_debug_opt
 
static struct switchstrswitches_debug_check [2]
 
static int n_switches_debug_check [2]
 
static int n_switches_alloc_debug_check [2]
 
static char * debug_check_temp_file [2]
 
static struct infileinfiles
 
int n_infiles
 
static int n_infiles_alloc
 
static bool spec_undefvar_allowed
 
static bool combine_inputs
 
static int added_libraries
 
const char ** outfiles
 
static const char * spec_lang = 0
 
static int last_language_n_infiles
 
static const char * gcc_input_filename
 
static int input_file_number
 
size_t input_filename_length
 
static int basename_length
 
static int suffixed_basename_length
 
static const char * input_basename
 
static const char * input_suffix
 
static struct stat input_stat
 
static int input_stat_set
 
static struct compilerinput_file_compiler
 
static int arg_going
 
static int delete_this_arg
 
static int this_is_output_file
 
static int this_is_library_file
 
static int this_is_linker_script
 
static int input_from_pipe
 
static const char * suffix_subst
 
static struct mdswitchstrmdswitches
 
static int n_mdswitches
 
used_arg_t used_arg
 

Macro Definition Documentation

◆ ASM_COMPRESS_DEBUG_SPEC

#define ASM_COMPRESS_DEBUG_SPEC    " %{gz*:%e-gz is not supported in this configuration} "
Assembler options for compressed debug sections.   
Reject if the linker cannot write compressed debug sections.   

◆ ASM_DEBUG_DWARF_OPTION

#define ASM_DEBUG_DWARF_OPTION   "--gdwarf2"
Define ASM_DEBUG_SPEC to be a spec suitable for translating '-g'
to the assembler, when compiling assembly sources only.   

◆ ASM_DEBUG_OPTION_SPEC

#define ASM_DEBUG_OPTION_SPEC   ""
Define ASM_DEBUG_OPTION_SPEC to be a spec suitable for translating '-g'
to the assembler when compiling all sources.   

◆ ASM_DEBUG_SPEC

#define ASM_DEBUG_SPEC   ""

◆ ASM_FINAL_SPEC

#define ASM_FINAL_SPEC    "%{gsplit-dwarf: \n\ objcopy --extract-dwo \ %{c:%{o*:%*}%{!o*:%w%b%O}}%{!c:%U%O} \ %b.dwo \n\ objcopy --strip-dwo \ %{c:%{o*:%*}%{!o*:%w%b%O}}%{!c:%U%O} \ }"
config.h can define ASM_FINAL_SPEC to run a post processor after
the assembler has run.   

◆ ASM_MAP

#define ASM_MAP   ""

◆ ASM_SPEC

#define ASM_SPEC   ""
The Specs Language

Specs are strings containing lines, each of which (if not blank)
is made up of a program name, and arguments separated by spaces.
The program name must be exact and start from root, since no path
is searched and it is unreliable to depend on the current working directory.
Redirection of input or output is not supported; the subprograms must
accept filenames saying what files to read and write.

In addition, the specs can contain %-sequences to substitute variable text
or for conditional text.  Here is a table of all defined %-sequences.
Note that spaces are not generated automatically around the results of
expanding these sequences; therefore, you can concatenate them together
or with constant text in a single argument.

 %%     substitute one % into the program name or argument.
 %"     substitute an empty argument.
 %i     substitute the name of the input file being processed.
 %b     substitute the basename for outputs related with the input file
        being processed.  This is often a substring of the input file name,
        up to (and not including) the last period but, unless %w is active,
        it is affected by the directory selected by -save-temps=*, by
        -dumpdir, and, in case of multiple compilations, even by -dumpbase
        and -dumpbase-ext and, in case of linking, by the linker output
        name.  When %w is active, it derives the main output name only from
        the input file base name; when it is not, it names aux/dump output
        file.
 %B     same as %b, but include the input file suffix (text after the last
        period).
 %gSUFFIX
        substitute a file name that has suffix SUFFIX and is chosen
        once per compilation, and mark the argument a la %d.  To reduce
        exposure to denial-of-service attacks, the file name is now
        chosen in a way that is hard to predict even when previously
        chosen file names are known.  For example, `%g.s ... %g.o ... %g.s'
        might turn into `ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s'.  SUFFIX matches
        the regexp "[.0-9A-Za-z]*%O"; "%O" is treated exactly as if it
        had been pre-processed.  Previously, %g was simply substituted
        with a file name chosen once per compilation, without regard
        to any appended suffix (which was therefore treated just like
        ordinary text), making such attacks more likely to succeed.
 %|SUFFIX
        like %g, but if -pipe is in effect, expands simply to "-".
 %mSUFFIX
        like %g, but if -pipe is in effect, expands to nothing.  (We have both
        %| and %m to accommodate differences between system assemblers; see
        the AS_NEEDS_DASH_FOR_PIPED_INPUT target macro.)
 %uSUFFIX
        like %g, but generates a new temporary file name even if %uSUFFIX
        was already seen.
 %USUFFIX
        substitutes the last file name generated with %uSUFFIX, generating a
        new one if there is no such last file name.  In the absence of any
        %uSUFFIX, this is just like %gSUFFIX, except they don't share
        the same suffix "space", so `%g.s ... %U.s ... %g.s ... %U.s'
        would involve the generation of two distinct file names, one
        for each `%g.s' and another for each `%U.s'.  Previously, %U was
        simply substituted with a file name chosen for the previous %u,
        without regard to any appended suffix.
 %jSUFFIX
        substitutes the name of the HOST_BIT_BUCKET, if any, and if it is
        writable, and if save-temps is off; otherwise, substitute the name
        of a temporary file, just like %u.  This temporary file is not
        meant for communication between processes, but rather as a junk
        disposal mechanism.
 %.SUFFIX
        substitutes .SUFFIX for the suffixes of a matched switch's args when
        it is subsequently output with %*. SUFFIX is terminated by the next
        space or %.
 %d     marks the argument containing or following the %d as a
        temporary file name, so that file will be deleted if GCC exits
        successfully.  Unlike %g, this contributes no text to the argument.
 %w     marks the argument containing or following the %w as the
        "output file" of this compilation.  This puts the argument
        into the sequence of arguments that %o will substitute later.
 %V     indicates that this compilation produces no "output file".
 %W{...}
        like %{...} but marks the last argument supplied within as a file
        to be deleted on failure.
 %@{...}
        like %{...} but puts the result into a FILE and substitutes @FILE
        if an @file argument has been supplied.
 %o     substitutes the names of all the output files, with spaces
        automatically placed around them.  You should write spaces
        around the %o as well or the results are undefined.
        %o is for use in the specs for running the linker.
        Input files whose names have no recognized suffix are not compiled
        at all, but they are included among the output files, so they will
        be linked.
 %O     substitutes the suffix for object files.  Note that this is
        handled specially when it immediately follows %g, %u, or %U
        (with or without a suffix argument) because of the need for
        those to form complete file names.  The handling is such that
        %O is treated exactly as if it had already been substituted,
        except that %g, %u, and %U do not currently support additional
        SUFFIX characters following %O as they would following, for
        example, `.o'.
 %I     Substitute any of -iprefix (made from GCC_EXEC_PREFIX), -isysroot
        (made from TARGET_SYSTEM_ROOT), -isystem (made from COMPILER_PATH
        and -B options) and -imultilib as necessary.
 %s     current argument is the name of a library or startup file of some sort.
        Search for that file in a standard list of directories
        and substitute the full name found.
 %T     current argument is the name of a linker script.
        Search for that file in the current list of directories to scan for
        libraries.  If the file is located, insert a --script option into the
        command line followed by the full path name found.  If the file is
        not found then generate an error message.
        Note: the current working directory is not searched.
 %eSTR  Print STR as an error message.  STR is terminated by a newline.
        Use this when inconsistent options are detected.
 %nSTR  Print STR as a notice.  STR is terminated by a newline.
 %x{OPTION}     Accumulate an option for %X.
 %X     Output the accumulated linker options specified by compilations.
 %Y     Output the accumulated assembler options specified by compilations.
 %Z     Output the accumulated preprocessor options specified by compilations.
 %a     process ASM_SPEC as a spec.
        This allows config.h to specify part of the spec for running as.
 %A     process ASM_FINAL_SPEC as a spec.  A capital A is actually
        used here.  This can be used to run a post-processor after the
        assembler has done its job.
 %D     Dump out a -L option for each directory in startfile_prefixes.
        If multilib_dir is set, extra entries are generated with it affixed.
 %l     process LINK_SPEC as a spec.
 %L     process LIB_SPEC as a spec.
 %M     Output multilib_os_dir.
 %P     Output a RUNPATH_OPTION for each directory in startfile_prefixes.
 %G     process LIBGCC_SPEC as a spec.
 %R     Output the concatenation of target_system_root and
        target_sysroot_suffix.
 %S     process STARTFILE_SPEC as a spec.  A capital S is actually used here.
 %E     process ENDFILE_SPEC as a spec.  A capital E is actually used here.
 %C     process CPP_SPEC as a spec.
 %1     process CC1_SPEC as a spec.
 %2     process CC1PLUS_SPEC as a spec.
 %*     substitute the variable part of a matched option.  (See below.)
        Note that each comma in the substituted string is replaced by
        a single space.  A space is appended after the last substition
        unless there is more text in current sequence.
 %<S    remove all occurrences of -S from the command line.
        Note - this command is position dependent.  % commands in the
        spec string before this one will see -S, % commands in the
        spec string after this one will not.
 %>S    Similar to "%<S", but keep it in the GCC command line.
 %<S*   remove all occurrences of all switches beginning with -S from the
        command line.
 %:function(args)
        Call the named function FUNCTION, passing it ARGS.  ARGS is
        first processed as a nested spec string, then split into an
        argument vector in the usual fashion.  The function returns
        a string which is processed as if it had appeared literally
        as part of the current spec.
 %{S}   substitutes the -S switch, if that switch was given to GCC.
        If that switch was not specified, this substitutes nothing.
        Here S is a metasyntactic variable.
 %{S*}  substitutes all the switches specified to GCC whose names start
        with -S.  This is used for -o, -I, etc; switches that take
        arguments.  GCC considers `-o foo' as being one switch whose
        name starts with `o'.  %{o*} would substitute this text,
        including the space; thus, two arguments would be generated.
 %{S*&T*} likewise, but preserve order of S and T options (the order
        of S and T in the spec is not significant).  Can be any number
        of ampersand-separated variables; for each the wild card is
        optional.  Useful for CPP as %{D*&U*&A*}.

 %{S:X}   substitutes X, if the -S switch was given to GCC.
 %{!S:X}  substitutes X, if the -S switch was NOT given to GCC.
 %{S*:X}  substitutes X if one or more switches whose names start
          with -S was given to GCC.  Normally X is substituted only
          once, no matter how many such switches appeared.  However,
          if %* appears somewhere in X, then X will be substituted
          once for each matching switch, with the %* replaced by the
          part of that switch that matched the '*'.  A space will be
          appended after the last substition unless there is more
          text in current sequence.
 %{.S:X}  substitutes X, if processing a file with suffix S.
 %{!.S:X} substitutes X, if NOT processing a file with suffix S.
 %{,S:X}  substitutes X, if processing a file which will use spec S.
 %{!,S:X} substitutes X, if NOT processing a file which will use spec S.

 %{S|T:X} substitutes X if either -S or -T was given to GCC.  This may be
          combined with '!', '.', ',', and '*' as above binding stronger
          than the OR.
          If %* appears in X, all of the alternatives must be starred, and
          only the first matching alternative is substituted.
 %{%:function(args):X}
          Call function named FUNCTION with args ARGS.  If the function
          returns non-NULL, then X is substituted, if it returns
          NULL, it isn't substituted.
 %{S:X;   if S was given to GCC, substitutes X;
   T:Y;   else if T was given to GCC, substitutes Y;
    :D}   else substitutes D.  There can be as many clauses as you need.
          This may be combined with '.', '!', ',', '|', and '*' as above.

 %(Spec) processes a specification defined in a specs file as *Spec:

The switch matching text S in a %{S}, %{S:X}, or similar construct can use
a backslash to ignore the special meaning of the character following it,
thus allowing literal matching of a character that is otherwise specially
treated.  For example, %{std=iso9899\:1999:X} substitutes X if the
-std=iso9899:1999 option is given.

The conditional text X in a %{S:X} or similar construct may contain
other nested % constructs or spaces, or even newlines.  They are
processed as usual, as described above.  Trailing white space in X is
ignored.  White space may also appear anywhere on the left side of the
colon in these constructs, except between . or * and the corresponding
word.

The -O, -f, -g, -m, and -W switches are handled specifically in these
constructs.  If another value of -O or the negated form of a -f, -m, or
-W switch is found later in the command line, the earlier switch
value is ignored, except with {S*} where S is just one letter; this
passes all matching options.

The character | at the beginning of the predicate text is used to indicate
that a command should be piped to the following command, but only if -pipe
is specified.

Note that it is built into GCC which switches take arguments and which
do not.  You might think it would be useful to generalize this to
allow each compiler's spec to say which switches take arguments.  But
this cannot be done in a consistent fashion.  GCC cannot even decide
which input files have been specified without knowing which switches
take arguments, and it must know which input files to compile in order
to tell which compilers to run.

GCC also knows implicitly that arguments starting in `-l' are to be
treated as compiler output files, and passed to the linker in their
proper position among the other output files.   
Define the macros used for specs %a, %l, %L, %S, %C, %1.   
config.h can define ASM_SPEC to provide extra args to the assembler
or extra switch-translations.   

◆ CC1_SPEC

#define CC1_SPEC   ""
config.h can define CC1_SPEC to provide extra args to cc1 and cc1plus
or extra switch-translations.   

◆ CC1PLUS_SPEC

#define CC1PLUS_SPEC   ""
config.h can define CC1PLUS_SPEC to provide extra args to cc1plus
or extra switch-translations.   

◆ CPP_SPEC

#define CPP_SPEC   ""
config.h can define CPP_SPEC to provide extra args to the C preprocessor
or extra switch-translations.   

◆ DEFAULT_TARGET_SYSTEM_ROOT

#define DEFAULT_TARGET_SYSTEM_ROOT   (0)
Nonzero means place this string before uses of /, so that include
and library files can be found in an alternate location.   

Referenced by driver::finalize().

◆ DELETE_IF_ORDINARY

#define DELETE_IF_ORDINARY ( NAME,
ST,
VERBOSE_FLAG )
Value:
do \
{ \
if (stat (NAME, &ST) >= 0 && S_ISREG (ST.st_mode)) \
if (unlink (NAME) < 0) \
if (VERBOSE_FLAG) \
error ("%s: %m", (NAME)); \
} while (0)
#define S_ISREG(m)
Definition system.h:616
@ NAME
Definition tree-ssa-pre.cc:242
Delete all the temporary files whose names we previously recorded.   

Referenced by delete_if_ordinary().

◆ DRIVER_SELF_SPECS

#define DRIVER_SELF_SPECS   ""

◆ DUMPS_OPTIONS

#define DUMPS_OPTIONS ( EXTS)     "%<dumpdir %<dumpbase %<dumpbase-ext %{d*} %:dumps(" EXTS ")"
Pass -d* flags, possibly modifying -dumpdir, -dumpbase et al.

Make it easy for a language to override the argument for the
%:dumps specs function call.   

◆ ENDFILE_SPEC

#define ENDFILE_SPEC   ""
config.h can define ENDFILE_SPEC to override the default crtn files.   

◆ FPIC1_SPEC

#define FPIC1_SPEC   "fpic"

◆ FPIC2_SPEC

#define FPIC2_SPEC   "fPIC"

◆ FPIC_SPEC

#define FPIC_SPEC   FPIC1_SPEC "|" FPIC2_SPEC

◆ FPIE1_OR_FPIC1_SPEC

#define FPIE1_OR_FPIC1_SPEC   FPIE1_SPEC "|" FPIC1_SPEC

◆ FPIE1_SPEC

#define FPIE1_SPEC   "fpie"

◆ FPIE2_OR_FPIC2_SPEC

#define FPIE2_OR_FPIC2_SPEC   FPIE2_SPEC "|" FPIC2_SPEC

◆ FPIE2_SPEC

#define FPIE2_SPEC   "fPIE"

◆ FPIE_OR_FPIC_SPEC

#define FPIE_OR_FPIC_SPEC   FPIE_SPEC "|" FPIC_SPEC

◆ FPIE_SPEC

#define FPIE_SPEC   FPIE1_SPEC "|" FPIE2_SPEC

◆ GOMP_SELF_SPECS

#define GOMP_SELF_SPECS
Value:
"%{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1): " \
"-pthread}"
Linking to libgomp implies pthreads.  This is particularly important
for targets that use different start files and suchlike.   

◆ GTM_SELF_SPECS

#define GTM_SELF_SPECS   "%{fgnu-tm: -pthread}"
Likewise for -fgnu-tm.   

◆ HOST_EXECUTABLE_SUFFIX

#define HOST_EXECUTABLE_SUFFIX   ""
By default there is no special suffix for host executables.   

Referenced by find_a_file(), find_a_file(), main(), and driver::maybe_print_and_exit().

◆ INCLUDE_STRING

#define INCLUDE_STRING
Compiler driver program that can handle many languages.
   Copyright (C) 1987-2024 Free Software Foundation, Inc.

This file is part of GCC.

GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.

GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
for more details.

You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3.  If not see
<http://www.gnu.org/licenses/>.   
This program is the user interface to the C compiler and possibly to
other compilers.  It is used because compilation is a complicated procedure
which involves running several programs and passing temporary files between
them, forwarding the users switches to those programs selectively,
and deleting the temporary files at the end.

CC recognizes how to compile each input file by suffixes in the file names.
Once it knows which kind of compilation to perform, the procedure for
compilation is specified by a string called a "spec".   

◆ INIT_STATIC_SPEC

#define INIT_STATIC_SPEC ( NAME,
PTR )
Value:
{ NAME, NULL, PTR, (struct spec_list *) 0, sizeof (NAME) - 1, false, false, \
*PTR }
Definition gcc.cc:1679
#define NULL
Definition system.h:50

◆ LD_PIE_SPEC

#define LD_PIE_SPEC   ""

Referenced by process_command().

◆ LIB_SPEC

#define LIB_SPEC   "%{!shared:%{g*:-lg} %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}}"
config.h can define LIB_SPEC to override the default libraries.   

◆ LIBASAN_EARLY_SPEC

#define LIBASAN_EARLY_SPEC   ""

◆ LIBASAN_SPEC

#define LIBASAN_SPEC   "-lasan" STATIC_LIBASAN_LIBS

◆ LIBGCC_SPEC

#define LIBGCC_SPEC   "-lgcc"
config.h can define LIBGCC_SPEC to override how and when libgcc.a is
included.   

◆ LIBHWASAN_EARLY_SPEC

#define LIBHWASAN_EARLY_SPEC   ""

◆ LIBHWASAN_SPEC

#define LIBHWASAN_SPEC   "-lhwasan" STATIC_LIBHWASAN_LIBS

◆ LIBLSAN_EARLY_SPEC

#define LIBLSAN_EARLY_SPEC   ""

◆ LIBLSAN_SPEC

#define LIBLSAN_SPEC   "-llsan" STATIC_LIBLSAN_LIBS

◆ LIBRARY_PATH_ENV

#define LIBRARY_PATH_ENV   "LIBRARY_PATH"
Most every one is fine with LIBRARY_PATH.  For some, it conflicts.   

Referenced by process_command().

◆ LIBTSAN_EARLY_SPEC

#define LIBTSAN_EARLY_SPEC   ""

◆ LIBTSAN_SPEC

#define LIBTSAN_SPEC   "-ltsan" STATIC_LIBTSAN_LIBS

◆ LIBUBSAN_SPEC

#define LIBUBSAN_SPEC   "-lubsan" STATIC_LIBUBSAN_LIBS

◆ LINK_COMMAND_SPEC

#define LINK_COMMAND_SPEC
Value:
"\%{!fsyntax-only:%{!c:%{!M:%{!MM:%{!E:%{!S:\ %(linker) " \
"%{flto|flto=*:%<fcompare-debug*} \ %{flto} %{fno-lto} %{flto=*} %l " LINK_PIE_SPEC \
"%{fuse-ld=*:-fuse-ld=%*} " LINK_COMPRESS_DEBUG_SPEC \
"%X %{o*} %{e*} %{N} %{n} %{r}\ %{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!r:%{!nostartfiles:%S}}} \ %{static|no-pie|static-pie:} %@{L*} %(link_libgcc) " \
VTABLE_VERIFICATION_SPEC " " SANITIZER_EARLY_SPEC " %o "" \ %{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1):\ %:include(libgomp.spec)%(link_gomp)}\ %{fgnu-tm:%:include(libitm.spec)%(link_itm)}\ " STACK_SPLIT_SPEC "\ %{fprofile-arcs|fcondition-coverage|fprofile-generate*|coverage:-lgcov} " SANITIZER_SPEC " \ %{!nostdlib:%{!r:%{!nodefaultlibs:%(link_ssp) %(link_gcc_c_sequence)}}}\ %{!nostdlib:%{!r:%{!nostartfiles:%E}}} %{T*} \n%(post_link) }}}}}}"
#define LINK_PIE_SPEC
Definition gcc.cc:1048
#define STACK_SPLIT_SPEC
Definition gcc.cc:761
#define SANITIZER_EARLY_SPEC
Definition gcc.cc:1097
#define LINK_COMPRESS_DEBUG_SPEC
Definition gcc.cc:851
#define SANITIZER_SPEC
Definition gcc.cc:1106
#define LINK_PLUGIN_SPEC
Definition gcc.cc:1091
#define VTABLE_VERIFICATION_SPEC
Definition gcc.cc:1131
-u* was put back because both BSD and SysV seem to support it.   
%{static|no-pie|static-pie:} simply prevents an error message:
 1. If the target machine doesn't handle -static.
 2. If PIE isn't enabled by default.
 3. If the target machine doesn't handle -static-pie.
We want %{T*} after %{L*} and %D so that it can be used to specify linker
scripts which exist in user specified directories, or in standard
directories.   
We pass any -flto flags on to the linker, which is expected
to understand them.  In practice, this means it had better be collect2.   
%{e*} includes -export-dynamic; see comment in common.opt.   

Referenced by driver::finalize().

◆ LINK_COMPRESS_DEBUG_SPEC

#define LINK_COMPRESS_DEBUG_SPEC    " %{gz*:%e-gz is not supported in this configuration} "
Linker options for compressed debug sections.   
No linker support.   

◆ LINK_GCC_C_SEQUENCE_SPEC

#define LINK_GCC_C_SEQUENCE_SPEC   "%G %{!nolibc:%L %G}"
Here is the spec for running the linker, after compiling all files.   
This is overridable by the target in case they need to specify the
-lgcc and -lc order specially, yet not require them to override all
of LINK_COMMAND_SPEC.   

◆ LINK_LIBGCC_SPEC

#define LINK_LIBGCC_SPEC   "%D"
Generate -L options for startfile prefix list.   

◆ LINK_PIE_SPEC

#define LINK_PIE_SPEC   "%{static|shared|r:;" PIE_SPEC ":" LD_PIE_SPEC "} "

◆ LINK_PLUGIN_SPEC

#define LINK_PLUGIN_SPEC   "%{fuse-linker-plugin:\ %e-fuse-linker-plugin is not supported in this configuration}"
Conditional to test whether the LTO plugin is used or not.
FIXME: For slim LTO we will need to enable plugin unconditionally.  This
still cause problems with PLUGIN_LD != LD and when plugin is built but
not useable.  For GCC 4.6 we don't support slim LTO and thus we can enable
plugin only when LTO is enabled.  We still honor explicit
-fuse-linker-plugin if the linker used understands -plugin.   
The linker has some plugin support.   
The linker used doesn't support -plugin, reject -fuse-linker-plugin.   

◆ LINK_SPEC

#define LINK_SPEC   ""
config.h can define LINK_SPEC to provide extra args to the linker
or extra switch-translations.   

◆ LINK_SSP_SPEC

#define LINK_SSP_SPEC
Value:
"%{fstack-protector|fstack-protector-all" \
"|fstack-protector-strong|fstack-protector-explicit" \
":-lssp_nonshared -lssp}"

◆ LINKER_NAME

#define LINKER_NAME   "collect2"

◆ LTO_PLUGIN_SPEC

#define LTO_PLUGIN_SPEC   ""

◆ MATH_LIBRARY

#define MATH_LIBRARY   "m"

Referenced by forward_offload_option().

◆ MD_EXEC_PREFIX

#define MD_EXEC_PREFIX   ""
If no prefixes defined, use the null string, which will disable them.   

Referenced by driver::finalize().

◆ MD_STARTFILE_PREFIX

#define MD_STARTFILE_PREFIX   ""

Referenced by driver::finalize().

◆ MD_STARTFILE_PREFIX_1

#define MD_STARTFILE_PREFIX_1   ""

Referenced by driver::finalize().

◆ MIN_FATAL_STATUS

#define MIN_FATAL_STATUS   1
If a stage of compilation returns an exit status >= 1,
compilation of that file ceases.   

Referenced by execute().

◆ MULTILIB_DEFAULTS

#define MULTILIB_DEFAULTS   { "" }
Check whether a particular argument is a default argument.   

◆ NO_FPIC1_SPEC

#define NO_FPIC1_SPEC   FPIC1_SPEC ":;"

◆ NO_FPIC2_SPEC

#define NO_FPIC2_SPEC   FPIC2_SPEC ":;"

◆ NO_FPIC_SPEC

#define NO_FPIC_SPEC   FPIC_SPEC ":;"

◆ NO_FPIE1_AND_FPIC1_SPEC

#define NO_FPIE1_AND_FPIC1_SPEC   FPIE1_OR_FPIC1_SPEC ":;"

◆ NO_FPIE1_SPEC

#define NO_FPIE1_SPEC   FPIE1_SPEC ":;"

◆ NO_FPIE2_AND_FPIC2_SPEC

#define NO_FPIE2_AND_FPIC2_SPEC   FPIE1_OR_FPIC2_SPEC ":;"

◆ NO_FPIE2_SPEC

#define NO_FPIE2_SPEC   FPIE2_SPEC ":;"

◆ NO_FPIE_AND_FPIC_SPEC

#define NO_FPIE_AND_FPIC_SPEC   FPIE_OR_FPIC_SPEC ":;"

◆ NO_FPIE_SPEC

#define NO_FPIE_SPEC   FPIE_SPEC ":;"

◆ OPTION_DEFAULT_SPECS

#define OPTION_DEFAULT_SPECS   { "", "" }

◆ OS_CC1_SPEC

#define OS_CC1_SPEC   ""
Operating systems can define OS_CC1_SPEC to provide extra args to cc1 and
cc1plus or extra switch-translations.  The OS_CC1_SPEC is appended
to CC1_SPEC in the initialization of cc1_spec.   

◆ PIE_SPEC

#define PIE_SPEC   "pie"

◆ POST_LINK_SPEC

#define POST_LINK_SPEC   ""

◆ RETRY_ICE_ATTEMPTS

#define RETRY_ICE_ATTEMPTS   3

Referenced by check_repro(), and try_generate_repro().

◆ RUNPATH_OPTION

#define RUNPATH_OPTION   "-rpath"

Referenced by do_spec_1().

◆ SANITIZER_EARLY_SPEC

#define SANITIZER_EARLY_SPEC   "\%{!nostdlib:%{!r:%{!nodefaultlibs:%{%:sanitize(address):" LIBASAN_EARLY_SPEC "} \ %{%:sanitize(hwaddress):" LIBHWASAN_EARLY_SPEC "} \ %{%:sanitize(thread):" LIBTSAN_EARLY_SPEC "} \ %{%:sanitize(leak):" LIBLSAN_EARLY_SPEC "}}}}"
Linker command line options for -fsanitize= early on the command line.   

◆ SANITIZER_SPEC

#define SANITIZER_SPEC   "\%{!nostdlib:%{!r:%{!nodefaultlibs:%{%:sanitize(address):" LIBASAN_SPEC "\ %{static:%ecannot specify -static with -fsanitize=address}}\ %{%:sanitize(hwaddress):" LIBHWASAN_SPEC "\ %{static:%ecannot specify -static with -fsanitize=hwaddress}}\ %{%:sanitize(thread):" LIBTSAN_SPEC "\ %{static:%ecannot specify -static with -fsanitize=thread}}\ %{%:sanitize(undefined):" LIBUBSAN_SPEC "}\ %{%:sanitize(leak):" LIBLSAN_SPEC "}}}}"
Linker command line options for -fsanitize= late on the command line.   

◆ SKIP_WHITE [1/2]

#define SKIP_WHITE ( )    do { while (*p == ' ' || *p == '\t') p++; } while (0)

Referenced by handle_braces(), and validate_switches().

◆ SKIP_WHITE [2/2]

#define SKIP_WHITE ( )    do { while (*p == ' ' || *p == '\t') p++; } while (0)

◆ STACK_SPLIT_SPEC

#define STACK_SPLIT_SPEC   " %{fsplit-stack: --wrap=pthread_create}"
When using -fsplit-stack we need to wrap pthread_create, in order
to initialize the stack guard.  We always use wrapping, rather than
shared library ordering, and we keep the wrapper function in
libgcc.  This is not yet a real spec, though it could become one;
it is currently just stuffed into LINK_SPEC.  FIXME: This wrapping
only works with GNU ld and gold.   

◆ STANDARD_STARTFILE_PREFIX_1

#define STANDARD_STARTFILE_PREFIX_1   "/lib/"
Default prefixes to attach to command names.   

◆ STANDARD_STARTFILE_PREFIX_2

#define STANDARD_STARTFILE_PREFIX_2   "/usr/lib/"

◆ STARTFILE_PREFIX_SPEC

#define STARTFILE_PREFIX_SPEC   ""

◆ STARTFILE_SPEC

#define STARTFILE_SPEC    "%{!shared:%{pg:gcrt0%O%s}%{!pg:%{p:mcrt0%O%s}%{!p:crt0%O%s}}}"
config.h can define STARTFILE_SPEC to override the default crt0 files.   

◆ STATIC_LIBASAN_LIBS

#define STATIC_LIBASAN_LIBS    " %{static-libasan|static:%:include(libsanitizer.spec)%(link_libasan)}"

◆ STATIC_LIBHWASAN_LIBS

#define STATIC_LIBHWASAN_LIBS    " %{static-libhwasan|static:%:include(libsanitizer.spec)%(link_libhwasan)}"

◆ STATIC_LIBLSAN_LIBS

#define STATIC_LIBLSAN_LIBS    " %{static-liblsan|static:%:include(libsanitizer.spec)%(link_liblsan)}"

◆ STATIC_LIBTSAN_LIBS

#define STATIC_LIBTSAN_LIBS    " %{static-libtsan|static:%:include(libsanitizer.spec)%(link_libtsan)}"

◆ STATIC_LIBUBSAN_LIBS

#define STATIC_LIBUBSAN_LIBS    " %{static-libubsan|static:%:include(libsanitizer.spec)%(link_libubsan)}"

◆ SYSROOT_HEADERS_SUFFIX_SPEC

#define SYSROOT_HEADERS_SUFFIX_SPEC   ""

◆ SYSROOT_SPEC

#define SYSROOT_SPEC   "--sysroot=%R"

◆ SYSROOT_SUFFIX_SPEC

#define SYSROOT_SUFFIX_SPEC   ""

◆ TARGET_EXECUTABLE_SUFFIX

#define TARGET_EXECUTABLE_SUFFIX   ""
Forbid other uses of getenv and putenv.   
By default there is no special suffix for target executables.   

Referenced by process_command().

◆ TARGET_OBJECT_SUFFIX

#define TARGET_OBJECT_SUFFIX   ".o"
By default, the suffix for target object files is ".o".   

Referenced by do_spec_1().

◆ VTABLE_VERIFICATION_SPEC

#define VTABLE_VERIFICATION_SPEC   "\%{fvtable-verify=none:} \%{fvtable-verify=std: \ %e-fvtable-verify=std is not supported in this configuration} \%{fvtable-verify=preinit: \ %e-fvtable-verify=preinit is not supported in this configuration}"
This is the spec to use, once the code for creating the vtable
verification runtime library, libvtv.so, has been created.  Currently
the vtable verification runtime functions are in libstdc++, so we use
the spec just below this one.   

Typedef Documentation

◆ char_p

typedef char* char_p

◆ const_char_p

typedef const char* const_char_p
Accumulate a command (program name and args), and run it.   

Enumeration Type Documentation

◆ attempt_status

Enumerator
ATTEMPT_STATUS_FAIL_TO_RUN 
ATTEMPT_STATUS_SUCCESS 
ATTEMPT_STATUS_ICE 

◆ path_prefix_priority

Ranking of prefixes in the sort list. -B prefixes are put before
all others.   
Enumerator
PREFIX_PRIORITY_B_OPT 
PREFIX_PRIORITY_LAST 

◆ save_temps

enum save_temps
Nonzero means write "temp" files in source directory
and use the source file's name in them, and don't delete them.   
Enumerator
SAVE_TEMPS_NONE 
SAVE_TEMPS_CWD 
SAVE_TEMPS_DUMP 
SAVE_TEMPS_OBJ 

Function Documentation

◆ access_check()

static int access_check ( const char * name,
int mode )
static
Check whether NAME can be accessed in MODE.  This is like access,
except that it never considers directories to be executable.   

References S_ISDIR, and X_OK.

Referenced by file_at_path(), and process_command().

◆ add_assembler_option()

static void add_assembler_option ( const char * option,
int len )
static

◆ add_infile()

static void add_infile ( const char * name,
const char * language )
static
Store an input file with the given NAME and LANGUAGE in
infiles.   

References alloc_infile(), infiles, infile::language, n_infiles, and infile::name.

Referenced by driver_handle_option(), and process_command().

◆ add_linker_option()

static void add_linker_option ( const char * option,
int len )
static

◆ add_prefix()

static void add_prefix ( struct path_prefix * pprefix,
const char * prefix,
const char * component,
int priority,
int require_machine_suffix,
int os_multilib )
static
Add an entry for PREFIX in PLIST.  The PLIST is kept in ascending
order according to PRIORITY.  Within each PRIORITY, new entries are
appended.

If WARN is nonzero, we will warn if no file is found
through this prefix.  WARN should point to an int
which will be set to 1 if this entry is used.

COMPONENT is the value to be passed to update_path.

REQUIRE_MACHINE_SUFFIX is 1 if this prefix can't be used without
the complete value of machine_suffix.
2 means try both machine_suffix and just_machine_suffix.   

References path_prefix::max_len, prefix_list::next, NULL, prefix_list::os_multilib, path_prefix::plist, prefix_list::prefix, prefix_list::priority, prefix_list::require_machine_suffix, and update_path().

Referenced by add_sysrooted_hdrs_prefix(), add_sysrooted_prefix(), driver_handle_option(), find_fortran_preinclude_file(), and process_command().

◆ add_preprocessor_option()

static void add_preprocessor_option ( const char * option,
int len )
static

◆ add_sysrooted_hdrs_prefix()

static void add_sysrooted_hdrs_prefix ( struct path_prefix * pprefix,
const char * prefix,
const char * component,
int priority,
int require_machine_suffix,
int os_multilib )
static

◆ add_sysrooted_prefix()

static void add_sysrooted_prefix ( struct path_prefix * pprefix,
const char * prefix,
const char * component,
int priority,
int require_machine_suffix,
int os_multilib )
static
Same as add_prefix, but prepending target_system_root to prefix.   
The target_system_root prefix has been relocated by gcc_exec_prefix.   

References add_prefix(), DIR_SEPARATOR, fatal_error(), free(), input_location, NULL, prefix_list::os_multilib, prefix_list::prefix, prefix_list::priority, prefix_list::require_machine_suffix, target_sysroot_suffix, and target_system_root.

Referenced by driver::set_up_specs().

◆ add_to_obstack()

static void * add_to_obstack ( char * path,
void * data )
static

◆ adds_single_suffix_p()

static bool adds_single_suffix_p ( const char * f2,
const char * f1 )
inlinestatic
Return true if F2 is F1 followed by a single suffix, i.e., by a
period and additional characters other than a period.   

References f1, f2, and NULL.

Referenced by process_command().

◆ alloc_args()

static void alloc_args ( void )
static
Allocate the argument vector.   

References argbuf, and at_file_argbuf.

Referenced by eval_spec_function(), and driver::global_initializations().

◆ alloc_infile()

static void alloc_infile ( void )
static
Allocate space for an input file in infiles.   

References infiles, n_infiles, and n_infiles_alloc.

Referenced by add_infile(), and process_command().

◆ alloc_switch()

static void alloc_switch ( void )
static
Allocate space for a switch in switches.   

References n_switches, n_switches_alloc, and switches.

Referenced by do_self_spec(), process_command(), and save_switch().

◆ build_search_list()

static char * build_search_list ( const struct path_prefix * paths,
const char * prefix,
bool check_dir,
bool do_multi )
static
Build a list of search directories from PATHS.
PREFIX is a string to prepend to the list.
If CHECK_DIR_P is true we ensure the directory exists.
If DO_MULTI is true, multilib paths are output first, then
non-multilib paths.
This is used mostly by putenv_from_prefixes so we use `collect_obstack'.
It is also used by the --print-search-dirs flag.   

References add_to_obstack(), add_to_obstack_info::check_dir, collect_obstack, add_to_obstack_info::first_time, for_each_path(), and add_to_obstack_info::ob.

Referenced by driver::maybe_print_and_exit(), and putenv_from_prefixes().

◆ check_foffload_target_names()

static void check_foffload_target_names ( const char * arg)
static
Sanity check for -foffload-options.   

References check_offload_target_name(), end(), error(), and NULL.

Referenced by driver_handle_option().

◆ check_live_switch()

static int check_live_switch ( int switchnum,
int prefix_length )
static
Return 0 iff switch number SWITCHNUM is obsoleted by a later switch
on the command line.  PREFIX_LENGTH is the length of XXX in an {XXX*}
spec, or -1 if either exact match or %* is used.

A -O switch is obsoleted by a later -O switch.  A -f, -g, -m, or -W switch
whose value does not begin with "no-" is obsoleted by the same value
with the "no-", similarly for a switch with the "no-" prefix.   

References i, switchstr::live_cond, n_switches, spec_function::name, switchstr::part1, startswith(), SWITCH_FALSE, SWITCH_IGNORE_PERMANENTLY, SWITCH_LIVE, switches, and switchstr::validated.

Referenced by mark_matching_switches(), process_brace_body(), switch_matches(), and version_compare_spec_function().

◆ check_offload_target_name()

static bool check_offload_target_name ( const char * target,
ptrdiff_t len )
static
Check that GCC is configured to support the offload target.   

References candidates, candidates_list_and_hint(), error(), inform(), NULL, and UNKNOWN_LOCATION.

Referenced by check_foffload_target_names(), and handle_foffload_option().

◆ check_repro()

static bool check_repro ( char ** temp_stdout_files,
char ** temp_stderr_files )
static
Check that compiler's output doesn't differ across runs.
TEMP_STDOUT_FILES and TEMP_STDERR_FILES are arrays of files, containing
stdout and stderr for each compiler run.  Return true if all of
TEMP_STDOUT_FILES and TEMP_STDERR_FILES are equivalent.   

References files_equal_p(), fnotice(), i, and RETRY_ICE_ATTEMPTS.

Referenced by try_generate_repro().

◆ clear_args()

static void clear_args ( void )
static
Clear out the vector of arguments (after a command is executed).   

References argbuf, and at_file_argbuf.

Referenced by do_spec_1(), do_spec_2(), and driver::finalize().

◆ clear_failure_queue()

static void clear_failure_queue ( void )
static

◆ close_at_file()

static void close_at_file ( void )
static
Close the temporary @file and add @file to the argument list.   

References at_file_argbuf, CONST_CAST, fatal_error(), fopen, i, in_at_file, input_location, make_at_file(), NULL, record_temp_file(), save_temps_flag, and store_arg().

Referenced by do_spec_1().

◆ compare_debug_dump_opt_spec_function()

static const char * compare_debug_dump_opt_spec_function ( int arg,
const char ** argv )
static
%:compare-debug-dump-opt spec function.  Save the last argument,
expected to be the last -fdump-final-insns option, or generate a
temporary.   

References argbuf, compare_debug, debug_check_temp_file, do_spec_1(), do_spec_2(), fatal_error(), free(), gcc_assert, get_random_number(), HOST_BITS_PER_WIDE_INT, HOST_WIDE_INT_PRINT_HEX, input_location, NULL, quote_spec(), and random_seed.

◆ compare_debug_self_opt_spec_function()

static const char * compare_debug_self_opt_spec_function ( int arg,
const char ** argv )
static
%:compare-debug-self-opt spec function.  Expands to the options
that are to be passed in the second compilation of
compare-debug.   

References compare_debug, compare_debug_opt, fatal_error(), input_location, and NULL.

◆ compare_files()

static int compare_files ( char * cmpfile[])
static
Compare the contents of the two files named CMPFILE[0] and
CMPFILE[1].  Return zero if they're identical, nonzero
otherwise.   

References error(), fopen, gcc_input_filename, i, map, MAP_FAILED, NULL, O_RDONLY, and S_ISREG.

Referenced by driver::do_spec_on_infiles().

◆ compare_version_strings()

static int compare_version_strings ( const char * v1,
const char * v2 )
static
Given two version numbers, compares the two numbers.
  A version number must match the regular expression
  ([1-9][0-9]*|0)(\.([1-9][0-9]*|0))*

References abort, fatal_error(), input_location, NULL, and r.

Referenced by version_compare_spec_function().

◆ compile_input_file_p()

static bool compile_input_file_p ( struct infile * infile)
static
True if we should compile INFILE.  

References infile::incompiler, input_file_compiler, and infile::language.

Referenced by do_spec_1().

◆ convert_white_space()

static char * convert_white_space ( char * orig)
static
Insert backslash before spaces in ORIG (usually a file path), to 
avoid being broken by spec parser.

This function is needed as do_spec_1 treats white space (' ' and '\t')
as the end of an argument. But in case of -plugin /usr/gcc install/xxx.so,
the file name should be treated as a single argument rather than being
broken into multiple. Solution is to insert '\\' before the space in a 
file name.

This function converts and only converts all occurrence of ' ' 
to '\\' + ' ' and '\t' to '\\' + '\t'.  For example:
"a b"  -> "a\\ b"
"a  b" -> "a\\ \\ b"
"a\tb" -> "a\\\tb"
"a\\ b" -> "a\\\\ b"

orig: input null-terminating string that was allocated by xalloc. The
memory it points to might be freed in this function. Behavior undefined
if ORIG wasn't xalloced or was freed already at entry.

Return: ORIG if no conversion needed. Otherwise a newly allocated string
that was converted from ORIG.   

References NULL, quote_string(), and whitespace_to_convert_p().

Referenced by driver::maybe_putenv_COLLECT_LTO_WRAPPER(), and driver::maybe_run_linker().

◆ debug_level_greater_than_spec_func()

static const char * debug_level_greater_than_spec_func ( int argc,
const char ** argv )
static
Returns "" if debug_info_level is greater than ARGV[ARGC-1].
Otherwise, return NULL.   

References fatal_error(), gcc_assert, input_location, and NULL.

◆ default_arg()

static int default_arg ( const char * p,
int len )
static

References i, mdswitches, and n_mdswitches.

Referenced by print_multilib_info(), and set_multilib_dir().

◆ delete_failure_queue()

static void delete_failure_queue ( void )
static
Delete all the files to be deleted on error.   

References delete_if_ordinary(), failure_delete_queue, temp_file::name, and temp_file::next.

Referenced by driver::do_spec_on_infiles(), fatal_signal(), and driver::final_actions().

◆ delete_if_ordinary()

static void delete_if_ordinary ( const char * name)
static

References DELETE_IF_ORDINARY, and i.

Referenced by delete_failure_queue(), and delete_temp_files().

◆ delete_temp_files()

static void delete_temp_files ( void )
static

◆ display_help()

static void display_help ( void )
static
Display the command line switches accepted by gcc.   

References _, and progname.

Referenced by driver::maybe_print_and_exit().

◆ do_option_spec()

static void do_option_spec ( const char * name,
const char * spec )
static
Process the given spec string and add any new options to the end
of the switches/n_switches array.   

References alloca, do_self_spec(), i, NULL, and compiler::spec.

Referenced by driver_get_configure_time_options(), and driver::set_up_specs().

◆ do_report_bug()

static void do_report_bug ( const char ** new_argv,
const int nargs,
char ** out_file,
char ** err_file )
static
This routine adds preprocessed source code into the given ERR_FILE.
To do this, it adds "-E" to NEW_ARGV and execute RUN_ATTEMPT routine to
add information in report file.  RUN_ATTEMPT should return
ATTEMPT_STATUS_SUCCESS, in other case we cannot generate the report.   

References ATTEMPT_STATUS_SUCCESS, fnotice(), free(), i, NULL, and run_attempt().

Referenced by try_generate_repro().

◆ do_self_spec()

◆ do_spec()

int do_spec ( const char * spec)
Process the spec SPEC and run the commands specified therein.
Returns 0 if the spec is successfully processed; -1 if failed.   

References argbuf, do_spec_2(), execute(), NULL, set_collect_gcc_options(), and compiler::spec.

Referenced by driver::do_spec_on_infiles(), and driver::maybe_run_linker().

◆ do_spec_1()

static int do_spec_1 ( const char * spec,
int inswitch,
const char * soft_matched_part )
static
Process the sub-spec SPEC as a portion of a larger spec.
This is like processing a whole spec except that we do
not initialize at the beginning and we do not supply a
newline by default at the end.
INSWITCH nonzero means don't process %-sequences in SPEC;
in this case, % is treated as an ordinary character.
This is used while substituting switches.
INSWITCH nonzero also causes SPC not to terminate an argument.

Value is zero unless a line was finished
and the command on that line reported an error.   

References _, add_linker_option(), alloca, spec_path_info::append, spec_path_info::append_len, arg_going, argbuf, asm_final_spec, asm_spec, assembler_options, at_file_supplied, basename_length, cc1_spec, cc1plus_spec, clear_args(), close_at_file(), combine_inputs, compare_debug, compile_input_file_p(), infile::compiled, compiler::cpp_spec, cpp_spec, delete_this_arg, dir_separator_str, do_spec_1(), do_specs_vec(), dumpdir, dumpdir_length, dumpdir_trailing_dash_added, end_going_arg(), endfile_spec, error(), execute(), fatal_error(), temp_name::filename, temp_name::filename_length, fnotice(), for_each_path(), free(), gcc_assert, gcc_exec_prefix, gcc_input_filename, handle_braces(), handle_spec_function(), HOST_BIT_BUCKET, i, include_prefixes, infiles, inform(), input_basename, input_file_compiler, input_file_number, input_filename_length, input_from_pipe, input_location, input_stat, input_stat_set, lang_specific_extra_outfiles, temp_name::length, lib_spec, libgcc_spec, link_spec, linker_options, switchstr::live_cond, multiarch_dir, multilib_dir, multilib_os_dir, n_infiles, n_switches, spec_list::name, spec_list::next, temp_name::next, NULL, obstack, spec_path_info::omit_relative, open_at_file(), spec_path_info::option, outbase, outbase_length, outfiles, preprocessor_options, processing_spec_function, spec_path_info::realpaths, record_temp_file(), RUNPATH_OPTION, S_ISDIR, save_string(), save_temps_flag, spec_path_info::separate_options, set_collect_gcc_options(), sl, spec_path(), specs, startfile_prefixes, startfile_spec, store_arg(), temp_name::suffix, suffix_subst, suffixed_basename_length, SWITCH_IGNORE, SWITCH_KEEP_FOR_GCC, switches, sysroot_hdrs_suffix_spec, TARGET_OBJECT_SUFFIX, target_sysroot_hdrs_suffix, target_sysroot_suffix, target_system_root, target_system_root_changed, temp_filename, temp_filename_length, temp_names, this_is_library_file, this_is_linker_script, this_is_output_file, temp_name::unique, UNKNOWN_LOCATION, switchstr::validated, and W_OK.

Referenced by compare_debug_dump_opt_spec_function(), do_self_spec(), do_spec_1(), do_spec_2(), do_specs_vec(), give_switch(), handle_spec_function(), print_configuration(), process_brace_body(), driver::set_up_specs(), and spec_path().

◆ do_spec_2()

static int do_spec_2 ( const char * spec,
const char * soft_matched_part )
static
Process the spec SPEC, with SOFT_MATCHED_PART designating the current value
of a matched * pattern which may be re-injected by way of %*.   

References arg_going, clear_args(), delete_this_arg, do_spec_1(), end_going_arg(), input_from_pipe, NULL, compiler::spec, suffix_subst, this_is_library_file, this_is_linker_script, and this_is_output_file.

Referenced by compare_debug_dump_opt_spec_function(), do_self_spec(), do_spec(), eval_spec_function(), and driver::set_up_specs().

◆ do_specs_vec()

static void do_specs_vec ( vec< char_p > vec)
static
Process each member of VEC as a spec.   

References do_spec_1(), and NULL.

Referenced by do_spec_1().

◆ driver_get_configure_time_options()

void driver_get_configure_time_options ( void(* cb )(const char *option, void *user_data),
void * user_data )
PR jit/64810.
Targets can provide configure-time default options in
OPTION_DEFAULT_SPECS.  The jit needs to access these, but
they are expressed in the spec language.

Run just enough of the driver to be able to expand these
specs, and then call the callback CB on each
such option.  The options strings are *without* a leading
'-' character e.g. ("march=x86-64").  Finally, clean up.   

References do_option_spec(), gcc_assert, i, init_opts_obstack(), n_switches, path_prefix::name, NULL, obstack, option_default_specs, opts_obstack, switchstr::part1, and switches.

◆ driver_handle_option()

static bool driver_handle_option ( struct gcc_options * opts,
struct gcc_options * opts_set,
const struct cl_decoded_option * decoded,
unsigned int lang_mask,
int kind,
location_t loc,
const struct cl_option_handlers * handlers,
diagnostic_context * dc,
void(*  )(void) )
static
Handle a driver option; arguments and return value as for
handle_option.   

References add_assembler_option(), add_infile(), add_linker_option(), add_prefix(), add_preprocessor_option(), any_link_options_p, cl_decoded_option::arg, cl_decoded_option::canonical_option, cl_decoded_option::canonical_option_num_elements, check_foffload_target_names(), compare_debug, compare_debug_opt, compare_debug_second, completion, diagnostic_color_init(), diagnostic_output_format_init(), diagnostic_urls_init(), DIR_SEPARATOR, dumpbase, dumpbase_ext, dumpdir, exec_prefixes, fatal_error(), user_specs::filename, fopen, forward_offload_option(), free(), gcc_assert, gcc_unreachable, global_dc, global_options, global_options_set, handle_foffload_option(), have_c, have_E, have_o, include_prefixes, init_spec(), input_location, is_cpp_driver, is_directory(), last_language_n_infiles, link_command_spec, n_infiles, spec_list::next, user_specs::next, NULL, cl_decoded_option::opt_index, cl_decoded_option::orig_option_with_args_text, output_file, PREFIX_PRIORITY_B_OPT, print_help_list, print_subprocess_help, print_version, report_times_to_file, save_string(), save_switch(), SAVE_TEMPS_CWD, SAVE_TEMPS_DUMP, save_temps_flag, SAVE_TEMPS_OBJ, save_temps_overrides_dumpdir, diagnostic_context::set_show_highlight_colors(), set_source_date_epoch_envvar(), diagnostic_context::set_text_art_charset(), sl, spec_lang, spec_machine, spec_version, specs, startfile_prefixes, static_p, target_system_root, target_system_root_changed, totruncate_file, UNKNOWN_LOCATION, use_ld, user_specs_head, user_specs_tail, cl_decoded_option::value, and verbose_only_flag.

Referenced by set_option_handlers().

◆ driver_unknown_option_callback()

static bool driver_unknown_option_callback ( const struct cl_decoded_option * decoded)
static

◆ driver_wrong_lang_callback()

static void driver_wrong_lang_callback ( const struct cl_decoded_option * decoded,
unsigned int lang_mask )
static

◆ dumps_spec_func()

const char * dumps_spec_func ( int argc,
const char ** argv )
static
%:dumps spec function.  Take an optional argument that overrides
the default extension for -dumpbase and -dumpbase-ext.
Return -dumpdir, -dumpbase and -dumpbase-ext, if needed.   

References basename_length, compare_debug, dumpbase, dumpbase_ext, dumpdir, fatal_error(), free(), gcc_checking_assert, input_basename, input_location, NULL, outbase, outbase_length, quote_spec_arg(), and suffixed_basename_length.

◆ dwarf_version_greater_than_spec_func()

static const char * dwarf_version_greater_than_spec_func ( int argc,
const char ** argv )
static
Returns "" if dwarf_version is greater than ARGV[ARGC-1].
Otherwise, return NULL.   

References fatal_error(), gcc_assert, input_location, and NULL.

◆ end_going_arg()

static void end_going_arg ( void )
static
If there is an argument being accumulated, terminate it and store it.   

References arg_going, delete_this_arg, error(), find_a_file(), find_file(), input_file_number, NULL, obstack, outfiles, R_OK, startfile_prefixes, store_arg(), this_is_library_file, this_is_linker_script, and this_is_output_file.

Referenced by do_spec_1(), and do_spec_2().

◆ eval_spec_function()

static const char * eval_spec_function ( const char * func,
const char * args,
const char * soft_matched_part )
static

◆ execute()

static int execute ( void )
static
Execute the command specified by the arguments on the current line of spec.
When using pipes, this includes several piped-together commands
with `|' between them.

Return 0 if successful, -1 if failed.   

References argbuf, CONST_CAST, DIR_SEPARATOR, errno, execution_count, fatal_error(), find_a_program(), fnotice(), fputc(), free(), G_, gcc_assert, greatest_status, i, ICE_EXIT_CODE, input_location, insert_wrapper(), internal_error_no_backtrace(), MIN_FATAL_STATUS, NULL, print_help_list, processing_spec_function, progname, report_times_to_file, signal_count, startswith(), strsignal(), temp_filename, try_generate_repro(), verbose_only_flag, WEXITSTATUS, WIFEXITED, WIFSIGNALED, and WTERMSIG.

Referenced by do_spec(), and do_spec_1().

◆ fatal_signal()

static void fatal_signal ( int signum)
static
On fatal signals, delete all the temporary files.   

References delete_failure_queue(), delete_temp_files(), and kill.

◆ file_at_path()

static void * file_at_path ( char * path,
void * data )
static

◆ files_equal_p()

static bool files_equal_p ( char * file1,
char * file2 )
static
Returns true if FILE1 and FILE2 contain equivalent data, 0 otherwise.   

References error(), free(), and O_RDONLY.

Referenced by check_repro().

◆ find_a_file()

static char * find_a_file ( const struct path_prefix * pprefix,
const char * name,
int mode,
bool do_multi )
static
Search for NAME using the prefix list PREFIXES.  MODE is passed to
access to check permissions.  If DO_MULTI is true, search multilib
paths then non-multilib paths, otherwise do not search multilib paths.
Return 0 if not found, otherwise return its name, allocated with malloc.   

References file_at_path(), for_each_path(), HOST_EXECUTABLE_SUFFIX, file_at_path_info::mode, file_at_path_info::name, file_at_path_info::name_len, NULL, file_at_path_info::suffix, file_at_path_info::suffix_len, and X_OK.

Referenced by end_going_arg(), find_a_program(), find_file(), find_fortran_preinclude_file(), include_spec_function(), and read_specs().

◆ find_a_program()

static char * find_a_program ( const char * name)
static
Specialization of find_a_file for programs that also takes into account
configure-specified default programs.  

References exec_prefixes, find_a_file(), file_at_path_info::name, and X_OK.

Referenced by execute(), driver::maybe_print_and_exit(), driver::maybe_putenv_COLLECT_LTO_WRAPPER(), and driver::maybe_run_linker().

◆ find_file()

static const char * find_file ( const char * name)
static
Search for a file named NAME trying various prefixes including the
user's -B prefix and some standard ones.
Return the absolute file name found.  If nothing is found, return NAME.   

References find_a_file(), R_OK, and startfile_prefixes.

Referenced by end_going_arg(), find_file_spec_function(), find_plugindir_spec_function(), and driver::maybe_print_and_exit().

◆ find_file_spec_function()

static const char * find_file_spec_function ( int argc,
const char ** argv )
static
%:find-file spec function.  This function replaces its argument by
the file found through find_file, that is the -print-file-name gcc
program option.  

References abort, and find_file().

◆ find_fortran_preinclude_file()

static const char * find_fortran_preinclude_file ( int argc,
const char ** argv )
static
The function takes 3 arguments: OPTION name, file name and location
where we search for Fortran modules.
When the FILE is found by find_file, return OPTION=path_to_file.   

References add_prefix(), add_sysrooted_hdrs_prefix(), find_a_file(), include_prefixes, NULL, path_prefix_reset(), and R_OK.

◆ find_plugindir_spec_function()

static const char * find_plugindir_spec_function ( int argc,
const char ** argv )
static
%:find-plugindir spec function.  This function replaces its argument
by the -iplugindir=<dir> option.  `dir' is found through find_file, that
is the -print-file-name gcc program option.  

References abort, find_file(), NULL, and option().

◆ for_each_path()

static void * for_each_path ( const struct path_prefix * paths,
bool do_multi,
size_t extra_space,
void *(* callback )(char *, void *),
void * callback_info )
static
Call CALLBACK for each path in PATHS, breaking out early if CALLBACK
returns non-NULL.
If DO_MULTI is true iterate over the paths twice, first with multilib
suffix then without, otherwise iterate over the paths once without
adding a multilib suffix.  When DO_MULTI is true, some attempt is made
to avoid visiting the same path twice, but we could do better.  For
instance, /usr/lib/../lib is considered different from /usr/lib.
At least EXTRA_SPACE chars past the end of the path passed to
CALLBACK are available for use by the callback.
CALLBACK_INFO allows extra parameters to be passed to CALLBACK.

Returns the value returned by CALLBACK.   

References CONST_CAST, dir_separator_str, free(), just_machine_suffix, machine_suffix, MAX, path_prefix::max_len, multiarch_dir, multilib_dir, multilib_os_dir, prefix_list::next, NULL, prefix_list::os_multilib, path_prefix::plist, prefix_list::prefix, and prefix_list::require_machine_suffix.

Referenced by build_search_list(), do_spec_1(), and find_a_file().

◆ forward_offload_option()

static void forward_offload_option ( size_t opt_index,
const char * arg,
bool validated )
static
Forward certain options to offloading compilation.   

References gcc_unreachable, MATH_LIBRARY, NULL, and save_switch().

Referenced by driver_handle_option().

◆ get_random_number()

static unsigned HOST_WIDE_INT get_random_number ( void )
static
Get a random number for -frandom-seed  

References NULL, and O_RDONLY.

Referenced by compare_debug_dump_opt_spec_function().

◆ getenv_spec_function()

static const char * getenv_spec_function ( int argc,
const char ** argv )
static
getenv built-in spec function.

Returns the value of the environment variable given by its first argument,
concatenated with the second argument.  If the variable is not defined, a
fatal error is issued unless such undefs are internally allowed, in which
case the variable name prefixed by a '/' is used as the variable value.

The leading '/' allows using the result at a spot where a full path would
normally be expected and when the actual value doesn't really matter since
undef vars are allowed.   

References env, fatal_error(), env_manager::get(), input_location, NULL, and spec_undefvar_allowed.

◆ give_switch()

static void give_switch ( int switchnum,
int omit_first_word )
static
Pass a switch to the current accumulating command
in the same form that we received it.
SWITCHNUM identifies the switch; it is an index into
the vector of switches gcc received, which is `switches'.
This cannot fail since it never finishes a command line.

If OMIT_FIRST_WORD is nonzero, then we omit .part1 of the argument.   

References CONST_CAST, do_spec_1(), NULL, suffix_subst, SWITCH_IGNORE, switches, and switchstr::validated.

Referenced by process_brace_body(), and process_marked_switches().

◆ greater_than_spec_func()

static const char * greater_than_spec_func ( int argc,
const char ** argv )
static
Returns "" if ARGV[ARGC - 2] is greater than ARGV[ARGC-1].
Otherwise, return NULL.   

References gcc_assert, and NULL.

◆ handle_braces()

static const char * handle_braces ( const char * p)
static
Handle a %{ ... } construct.  P points just inside the leading {.
Returns a pointer one past the end of the brace block, or 0
if we call do_spec_1 and that returns -1.   

References ap, fatal_error(), free(), handle_spec_function(), input_location, input_spec_matches(), input_suffix_matches(), mark_matching_switches(), NULL, process_brace_body(), process_marked_switches(), SKIP_WHITE, and switch_matches().

Referenced by do_spec_1().

◆ handle_foffload_option()

static void handle_foffload_option ( const char * arg)
static
Parse -foffload option argument.   

References check_offload_target_name(), end(), free(), NULL, and offload_targets.

Referenced by driver_handle_option(), and process_command().

◆ handle_spec_function()

static const char * handle_spec_function ( const char * p,
bool * retval_nonnull,
const char * soft_matched_part )
static
Handle a spec function call of the form:

%:function(args)

ARGS is processed as a spec in a separate context and split into an
argument vector in the normal fashion.  The function returns a string
containing a spec which we then process in the caller's context, or
NULL if no processing is required.

If RETVAL_NONNULL is not NULL, then store a bool whether function
returned non-NULL.

SOFT_MATCHED_PART holds the current value of a matched * pattern, which
may be re-expanded with a %* as part of the function arguments.   

References count, do_spec_1(), eval_spec_function(), fatal_error(), free(), spec_function::func, input_location, NULL, processing_spec_function, and save_string().

Referenced by do_spec_1(), and handle_braces().

◆ if_exists_else_spec_function()

static const char * if_exists_else_spec_function ( int argc,
const char ** argv )
static
if-exists-else built-in spec function.

This is like if-exists, but takes an additional argument which
is returned if the first argument does not exist.   

References NULL, and R_OK.

◆ if_exists_spec_function()

static const char * if_exists_spec_function ( int argc,
const char ** argv )
static
if-exists built-in spec function.

Checks to see if the file specified by the absolute pathname in
ARGS exists.  Returns that pathname if found.

The usual use for this function is to check for a library file
(whose name has been expanded with %s).   

References NULL, and R_OK.

◆ if_exists_then_else_spec_function()

static const char * if_exists_then_else_spec_function ( int argc,
const char ** argv )
static
if-exists-then-else built-in spec function.

Checks to see if the file specified by the absolute pathname in
the first arg exists.  Returns the second arg if so, otherwise returns
the third arg if it is present.   

References NULL, and R_OK.

◆ include_spec_function()

static const char * include_spec_function ( int argc,
const char ** argv )
static
%:include builtin spec function.  This differs from %include in that it
can be nested inside a spec, and thus be conditionalized.  It takes
one argument, the filename, and looks for it in the startfile path.
The result is always NULL, i.e. an empty expansion.   

References abort, find_a_file(), NULL, R_OK, read_specs(), and startfile_prefixes.

◆ init_spec()

static void init_spec ( void )
static
Add appropriate libgcc specs to OBSTACK, taking into account
various permutations of -shared-libgcc, -shared, and such.   
Initialize the specs lookup routines.   

References asm_spec, fnotice(), gcc_assert, i, libgcc_spec, link_spec, spec_list::name, spec_list::name_len, spec_list::next, NULL, obstack, sl, specs, startswith(), and static_specs.

Referenced by driver_handle_option(), and driver::set_up_specs().

◆ input_spec_matches()

static bool input_spec_matches ( const char * atom,
const char * end_atom )
static
Subroutine of handle_braces.  Returns true if the current
input file's spec name matches the atom bracketed by ATOM and END_ATOM.   

References input_file_compiler, and compiler::suffix.

Referenced by handle_braces().

◆ input_suffix_matches()

static bool input_suffix_matches ( const char * atom,
const char * end_atom )
inlinestatic
Inline subroutine of handle_braces.  Returns true if the current
input suffix matches the atom bracketed by ATOM and END_ATOM.   

References input_suffix.

Referenced by handle_braces().

◆ insert_comments()

static void insert_comments ( const char * file_in,
const char * file_out )
static
This routine reads lines from IN file, adds C++ style comments
at the begining of each line and writes result into OUT.   

References fopen, and NULL.

Referenced by try_generate_repro().

◆ insert_wrapper()

static void insert_wrapper ( const char * wrapper)
static
Parse the WRAPPER string which is a comma separated list of the command line
and insert them into the beginning of argbuf.   

References argbuf, gcc_assert, i, and NULL.

Referenced by execute().

◆ is_directory()

static int is_directory ( const char * path1,
bool linker )
static
Determine whether a directory exists.  If LINKER, return 0 for
certain fixed names not needed by the linker.   

References alloca, DIR_SEPARATOR, path, and S_ISDIR.

Referenced by add_to_obstack(), driver_handle_option(), and spec_path().

◆ join_spec_func()

static const char * join_spec_func ( int argc,
const char ** argv )
static
The function takes any number of arguments and joins them together.

This seems to be necessary to build "-fjoined=foo.b" from "-fseparate foo.a"
with a %{fseparate*:-fjoined=%.b$*} rule without adding undesired spaces:
when doing $* replacement we first replace $* with the rest of the switch
(in this case ""), and then add any arguments as arguments after the result,
resulting in "-fjoined= foo.b".  Using this function with e.g.
%{fseparate*:-fjoined=%:join(%.b$*)} gets multiple words as separate argv
elements instead of separated by spaces, and we paste them together.   

References i, and obstack.

◆ load_specs()

static char * load_specs ( const char * filename)
static
Load specs from a file name named FILENAME, replacing occurrences of
various different types of line-endings, \r\n, \n\r and just \r, with
a single \n.   

References fatal_error(), fnotice(), free(), input_location, O_RDONLY, and specs.

Referenced by read_specs().

◆ lookup_compiler()

static struct compiler * lookup_compiler ( const char * name,
size_t length,
const char * language )
static
Find the proper compilation spec for the file name NAME,
whose length is LENGTH.  LANGUAGE is the specified language,
or 0 if this file is to be passed to the linker.   

References compilers, error(), fatal_error(), have_E, input_location, lookup_compiler(), n_compilers, NULL, compiler::spec, and compiler::suffix.

Referenced by driver::do_spec_on_infiles(), lookup_compiler(), and driver::prepare_infiles().

◆ lookup_spec_function()

static const struct spec_function * lookup_spec_function ( const char * name)
static
Look up a spec function.   

References spec_function::name, NULL, and static_spec_functions.

Referenced by eval_spec_function().

◆ make_at_file()

static char * make_at_file ( void )
static
Create a temporary @file name.   

References dumpbase, dumpdir, dumpdir_trailing_dash_added, temp_name::filename, NULL, and save_temps_flag.

Referenced by close_at_file().

◆ mark_matching_switches()

static void mark_matching_switches ( const char * atom,
const char * end_atom,
int starred )
inlinestatic
Inline subroutine of handle_braces.  Mark all of the switches which
match ATOM (extends to END_ATOM; STARRED indicates whether there
was a star after the atom) for later processing.   

References check_live_switch(), i, n_switches, switchstr::ordering, and switches.

Referenced by handle_braces().

◆ not_actual_file_p()

static bool not_actual_file_p ( const char * name)
static

References HOST_BIT_BUCKET.

Referenced by process_command().

◆ open_at_file()

static void open_at_file ( void )
static
Open a temporary @file into which subsequent arguments will be stored.   

References fatal_error(), in_at_file, and input_location.

Referenced by do_spec_1().

◆ pass_through_libs_spec_func()

const char * pass_through_libs_spec_func ( int argc,
const char ** argv )
static
%:pass-through-libs spec function.  Finds all -l options and input
file names in the lib spec passed to it, and makes a list of them
prepended with the plugin option to cause them to be passed through
to the final link after all the new object files have been added.   

References free(), and NULL.

◆ path_prefix_reset()

static void path_prefix_reset ( path_prefix * prefix)
static

◆ print_asm_header_spec_function()

static const char * print_asm_header_spec_function ( int arg,
const char ** argv )
static
%:print-asm-header spec function.  Print a banner to say that the
following output is from the assembler.   

References _, and NULL.

◆ print_configuration()

static void print_configuration ( FILE * file)
static
Print GCC configuration (e.g. version, thread model, target,
configuration_arguments) to a given FILE.   

References compiler_version, do_spec_1(), fnotice(), obstack, and spec_machine.

Referenced by driver::maybe_print_and_exit(), and run_attempt().

◆ print_multilib_info()

static void print_multilib_info ( void )
static
Print out the multiple library subdirectory selection
information.  This prints out a series of lines.  Each line looks
like SUBDIRECTORY;@OPTION@OPTION, with as many options as is
required.  Only the desired options are printed out, the negative
matches.  The options are print without a leading dash.  There are
no spaces to make it easy to use the information in the shell.
Each subdirectory is printed only once.  This assumes the ordering
generated by the genmultilib script. Also, we leave out ones that match
the exclusions.   

References default_arg(), fatal_error(), input_location, multilib_exclusions, and multilib_select.

Referenced by driver::maybe_print_and_exit().

◆ process_brace_body()

static const char * process_brace_body ( const char * p,
const char * atom,
const char * end_atom,
int starred,
int matched )
static
Subroutine of handle_braces.  Scan and process a brace substitution body
(X in the description of %{} syntax).  P points one past the colon;
ATOM and END_ATOM bracket the first atom which was found to be true
(present) in the current disjunction; STARRED indicates whether all
the atoms in the current disjunction were starred (for syntax validation);
MATCHED indicates whether the disjunction matched or not, and therefore
whether or not the body is to be processed through do_spec_1 or just
skipped.  Returns a pointer to the closing } or ;, or 0 if do_spec_1
returns -1.   

References check_live_switch(), do_spec_1(), fatal_error(), free(), give_switch(), i, input_location, n_switches, NULL, save_string(), suffix_subst, and switches.

Referenced by handle_braces().

◆ process_command()

static void process_command ( unsigned int decoded_options_count,
struct cl_decoded_option * decoded_options )
static
Create the vector `switches' and its contents.
Store its length in `n_switches'.   

References accel_dir_suffix, access_check(), add_infile(), add_prefix(), added_libraries, adds_single_suffix_p(), alloc_infile(), alloc_switch(), alloca, any_link_options_p, cl_decoded_option::arg, CL_DRIVER, compare_debug, compare_debug_opt, compiler_version, cross_compile, DINFO_LEVEL_NONE, DINFO_LEVEL_NORMAL, DIR_SEPARATOR, dir_separator_str, dumpbase, dumpbase_ext, dumpdir, dumpdir_length, dumpdir_trailing_dash_added, env, exec_prefixes, F_OK, fatal_error(), free(), gcc_assert, gcc_exec_prefix, gcc_libexec_prefix, gcd(), env_manager::get(), global_dc, global_options, global_options_set, handle_foffload_option(), cl_option_handlers::handlers, have_c, HOST_BIT_BUCKET, i, include_prefixes, infiles, input_location, lang_specific_driver(), last_language_n_infiles, LD_PIE_SPEC, LIBRARY_PATH_ENV, n_infiles, n_switches, infile::name, not_actual_file_p(), NULL, offload_targets, outbase, outbase_length, output_file, switchstr::part1, PATH_SEPARATOR, PREFIX_PRIORITY_LAST, print_help_list, print_subprocess_help, print_version, read_cmdline_option(), save_switch(), SAVE_TEMPS_CWD, SAVE_TEMPS_DUMP, save_temps_flag, save_temps_overrides_dumpdir, set_option_handlers(), set_std_prefix(), single_input_file_index(), spec_host_machine, spec_lang, spec_machine, spec_undefvar_allowed, spec_version, standard_bindir_prefix, standard_exec_prefix, standard_libexec_prefix, startfile_prefixes, static_p, switches, TARGET_EXECUTABLE_SUFFIX, target_system_root, target_system_root_changed, tooldir_base_prefix, UNKNOWN_LOCATION, warning(), warning_at(), and xputenv().

Referenced by driver::set_up_specs().

◆ process_marked_switches()

static void process_marked_switches ( void )
inlinestatic
Inline subroutine of handle_braces.  Process all the currently
marked switches through give_switch, and clear the marks.   

References give_switch(), i, n_switches, switchstr::ordering, and switches.

Referenced by handle_braces().

◆ putenv_COLLECT_AS_OPTIONS()

static void putenv_COLLECT_AS_OPTIONS ( vec< char_p > vec)
static
Add options passed via -Xassembler or -Wa to COLLECT_AS_OPTIONS.   

References collect_obstack, FOR_EACH_VEC_ELT, and xputenv().

Referenced by driver::main().

◆ putenv_from_prefixes()

static void putenv_from_prefixes ( const struct path_prefix * paths,
const char * env_var,
bool do_multi )
static
Rebuild the COMPILER_PATH and LIBRARY_PATH environment variables
for collect.   

References build_search_list(), and xputenv().

Referenced by driver::maybe_run_linker().

◆ quote_spec()

static char * quote_spec ( char * orig)
inlinestatic
Like convert_white_space, but deactivate all active spec chars by
quoting them.   

References NULL, quote_spec_char_p(), and quote_string().

Referenced by compare_debug_dump_opt_spec_function(), and quote_spec_arg().

◆ quote_spec_arg()

static char * quote_spec_arg ( char * orig)
inlinestatic
Like quote_spec, but also turn an empty string into the spec for an
empty argument.   

References free(), and quote_spec().

Referenced by dumps_spec_func().

◆ quote_spec_char_p()

static bool quote_spec_char_p ( char c,
void *  )
inlinestatic
Return true iff C matches any of the spec active characters.   

Referenced by quote_spec().

◆ quote_string()

static char * quote_string ( char * orig,
bool(* quote_p )(char, void *),
void * p )
inlinestatic
If any character in ORIG fits QUOTE_P (_, P), reallocate the string
so as to precede every one of them with a backslash.  Return the
original string or the reallocated one.   

References free().

Referenced by convert_white_space(), and quote_spec().

◆ read_specs()

static void read_specs ( const char * filename,
bool main_p,
bool user_p )
static
Read compilation specs from a file named FILENAME,
replacing the default ones.

A suffix which starts with `*' is a definition for
one of the machine-specific sub-specs.  The "suffix" should be
*asm, *cc1, *cpp, *link, *startfile, etc.
The corresponding spec is stored in asm_spec, etc.,
rather than in the `compilers' vector.

Anything invalid in the file is a fatal error.   

References compilers, CONST_CAST, fatal_error(), find_a_file(), fnotice(), free(), input_location, link_command_spec, load_specs(), n_compilers, spec_list::name, spec_list::name_len, spec_list::next, R_OK, read_specs(), save_string(), set_spec(), skip_whitespace(), sl, compiler::spec, specs, startfile_prefixes, startswith(), compiler::suffix, and spec_list::user_p.

Referenced by include_spec_function(), read_specs(), and driver::set_up_specs().

◆ record_temp_file()

void record_temp_file ( const char * filename,
int always_delete,
int fail_delete )
Record FILENAME as a file to be deleted automatically.
ALWAYS_DELETE nonzero means delete it if all compilation succeeds;
otherwise delete it in any case.
FAIL_DELETE nonzero means delete it if a compilation step fails;
otherwise delete it in any case.   

References always_delete_queue, failure_delete_queue, free(), temp_file::name, and temp_file::next.

Referenced by close_at_file(), do_spec_1(), and store_arg().

◆ remove_outfile_spec_function()

static const char * remove_outfile_spec_function ( int argc,
const char ** argv )
static
remove-outfile built-in spec function.
*
*    This looks for the first argument in the outfiles array's name and
*       removes it.   

References abort, i, n_infiles, NULL, and outfiles.

◆ replace_outfile_spec_function()

static const char * replace_outfile_spec_function ( int argc,
const char ** argv )
static
replace-outfile built-in spec function.

This looks for the first argument in the outfiles array's name and
replaces it with the second argument.   

References abort, i, n_infiles, NULL, and outfiles.

◆ run_attempt()

static enum attempt_status run_attempt ( const char ** new_argv,
const char * out_temp,
const char * err_temp,
int emit_system_info,
int append )
static
Run compiler with arguments NEW_ARGV to reproduce the ICE, storing stdout
to OUT_TEMP and stderr to ERR_TEMP.  If APPEND is TRUE, append to OUT_TEMP
and ERR_TEMP instead of truncating.  If EMIT_SYSTEM_INFO is TRUE, also write
GCC configuration into to ERR_TEMP.  Return ATTEMPT_STATUS_FAIL_TO_RUN if
compiler failed to run, ATTEMPT_STATUS_ICE if compiled ICE-ed and
ATTEMPT_STATUS_SUCCESS otherwise.   

References ATTEMPT_STATUS_FAIL_TO_RUN, ATTEMPT_STATUS_ICE, ATTEMPT_STATUS_SUCCESS, CONST_CAST2, errno, fatal_error(), fopen, G_, ICE_EXIT_CODE, input_location, NULL, print_configuration(), SUCCESS_EXIT_CODE, and WEXITSTATUS.

Referenced by do_report_bug(), and try_generate_repro().

◆ sanitize_spec_function()

static const char * sanitize_spec_function ( int argc,
const char ** argv )
static
sanitize built-in spec function.

This returns non-NULL, if sanitizing address, thread or
any of the undefined behavior sanitizers.   

References NULL, SANITIZE_ADDRESS, SANITIZE_KERNEL_ADDRESS, SANITIZE_KERNEL_HWADDRESS, SANITIZE_LEAK, SANITIZE_THREAD, SANITIZE_UNDEFINED, SANITIZE_UNDEFINED_NONDEFAULT, SANITIZE_USER_ADDRESS, and SANITIZE_USER_HWADDRESS.

◆ save_string()

◆ save_switch()

static void save_switch ( const char * opt,
size_t n_args,
const char *const * args,
bool validated,
bool known )
static
Save an option OPT with N_ARGS arguments in array ARGS, marking it
as validated if VALIDATED and KNOWN if it is an internal switch.   

References alloc_switch(), switchstr::args, switchstr::known, switchstr::live_cond, n_switches, NULL, switchstr::ordering, switchstr::part1, switches, and switchstr::validated.

Referenced by do_self_spec(), driver_handle_option(), driver_unknown_option_callback(), driver_wrong_lang_callback(), forward_offload_option(), and process_command().

◆ set_collect_gcc_options()

static void set_collect_gcc_options ( void )
static
Store switches not filtered out by %<S in spec in COLLECT_GCC_OPTIONS
and place that in the environment.   

References collect_obstack, dumpdir, i, n_switches, switchstr::part1, SWITCH_IGNORE, SWITCH_KEEP_FOR_GCC, switches, and xputenv().

Referenced by do_spec(), and do_spec_1().

◆ set_input()

void set_input ( const char * filename)
Set up the various global variables to indicate that we're processing
the input file named FILENAME.   

References basename_length, gcc_input_filename, input_basename, input_filename_length, input_stat_set, input_suffix, and suffixed_basename_length.

Referenced by driver::do_spec_on_infiles().

◆ set_multilib_dir()

static void set_multilib_dir ( void )
static
Work out the subdirectory to use based on the options. The format of
multilib_select is a list of elements. Each element is a subdirectory
name followed by a list of options followed by a semicolon. The format
of multilib_exclusions is the same, but without the preceding
directory. First gcc will check the exclusions, if none of the options
beginning with an exclamation point are present, and all of the other
options are present, then we will ignore this completely. Passing
that, gcc will consider each multilib_select in turn using the same
rules for matching the options. If a match is found, that subdirectory
will be used.
A subdirectory name is optionally followed by a colon and the corresponding
multiarch name.   

References CONST_CAST, default_arg(), end(), fatal_error(), free(), i, input_location, mdswitchstr::len, mdswitches, multiarch_dir, multilib_defaults, multilib_dir, multilib_exclusions, multilib_matches, multilib_obstack, multilib_os_dir, multilib_reuse, multilib_select, n_mdswitches, n_switches, NULL, mdswitchstr::str, switches, and used_arg.

Referenced by driver::set_up_specs().

◆ set_option_handlers()

◆ set_source_date_epoch_envvar()

static void set_source_date_epoch_envvar ( )
static
Set the SOURCE_DATE_EPOCH environment variable to the current time if it is
not set already.   

References errno, and NULL.

Referenced by driver_handle_option().

◆ set_spec()

static void set_spec ( const char * name,
const char * spec,
bool user_p )
static
Change the value of spec NAME to SPEC.  If SPEC is empty, then the spec is
removed; If the spec starts with a + then SPEC is added to the end of the
current spec.   

References CONST_CAST, spec_list::default_ptr, fnotice(), free(), i, spec_list::name, spec_list::name_len, spec_list::next, NULL, sl, specs, static_specs, and spec_list::user_p.

Referenced by read_specs(), and driver::set_up_specs().

◆ set_static_spec()

static void set_static_spec ( const char ** spec,
const char * value,
bool alloc_p )
static
Update the entry for SPEC in the static_specs table to point to VALUE,
ensuring that we free the previous value if necessary.  Set alloc_p for the
entry to ALLOC_P: this determines whether we take ownership of VALUE (i.e.
whether we need to free it later on).   

References spec_list::alloc_p, free(), gcc_assert, i, NULL, spec_list::ptr_spec, sl, and static_specs.

Referenced by set_static_spec_owned(), and set_static_spec_shared().

◆ set_static_spec_owned()

static void set_static_spec_owned ( const char ** spec,
const char * val )
static
Update a static spec to a new string, taking ownership of that
string's memory.   

References set_static_spec().

Referenced by driver::maybe_putenv_COLLECT_LTO_WRAPPER().

◆ set_static_spec_shared()

static void set_static_spec_shared ( const char ** spec,
const char * val )
static
Update a static spec to point to a new value, but don't take
ownership of (i.e. don't free) that string.   

References set_static_spec().

Referenced by driver::finalize(), and driver::maybe_run_linker().

◆ single_input_file_index()

static int single_input_file_index ( )
inlinestatic
Return the index into infiles for the single non-library
non-lto-wpa input file, -1 if there isn't any, or -2 if there is
more than one.   

References i, infiles, and n_infiles.

Referenced by process_command().

◆ skip_whitespace()

static char * skip_whitespace ( char * p)
static

Referenced by read_specs().

◆ spec_path()

◆ store_arg()

static void store_arg ( const char * arg,
int delete_always,
int delete_failure )
static
Add one argument to the vector at the end.
This is done when a space is seen or at the end of the line.
If DELETE_ALWAYS is nonzero, the arg is a filename
 and the file should be deleted eventually.
If DELETE_FAILURE is nonzero, the arg is a filename
 and the file should be deleted if this compilation fails.   

References argbuf, at_file_argbuf, in_at_file, and record_temp_file().

Referenced by close_at_file(), do_spec_1(), and end_going_arg().

◆ switch_matches()

static bool switch_matches ( const char * atom,
const char * end_atom,
int starred )
inlinestatic
Subroutine of handle_braces.  Returns true if a switch
matching the atom bracketed by ATOM and END_ATOM appeared on the
command line.   

References check_live_switch(), i, n_switches, and switches.

Referenced by handle_braces(), and driver::maybe_run_linker().

◆ try_generate_repro()

static void try_generate_repro ( const char ** argv)
static
Try to reproduce ICE.  If bug is reproducible, generate report .err file
containing GCC configuration, backtrace, compiler's command line options
and preprocessed source code.   

References ATTEMPT_STATUS_ICE, check_repro(), do_report_bug(), fnotice(), free(), gcc_input_filename, i, insert_comments(), NULL, RETRY_ICE_ATTEMPTS, and run_attempt().

Referenced by execute().

◆ validate_all_switches()

static void validate_all_switches ( void )
static

◆ validate_switches()

static const char * validate_switches ( const char * start,
bool user_spec,
bool braced )
static
Look at the switch-name that comes after START and mark as valid
all supplied switches that match it.  If BRACED, handle other
switches after '|' and '&', and specs after ':' until ';' or '}',
going back for more switches after ';'.  Without BRACED, handle
only one atom.  Return a pointer to whatever follows the handled
items, after the closing brace if BRACED.   

References i, n_switches, SKIP_WHITE, switches, validate_switches(), and switchstr::validated.

Referenced by validate_switches(), and validate_switches_from_spec().

◆ validate_switches_from_spec()

static void validate_switches_from_spec ( const char * spec,
bool user )
inlinestatic

◆ version_compare_spec_function()

static const char * version_compare_spec_function ( int argc,
const char ** argv )
static
version_compare built-in spec function.

This takes an argument of the following form:

<comparison-op> <arg1> [<arg2>] <switch> <result>

and produces "result" if the comparison evaluates to true,
and nothing if it doesn't.

The supported <comparison-op> values are:

>=  true if switch is a later (or same) version than arg1
!>  opposite of >=
<   true if switch is an earlier version than arg1
!<  opposite of <
><  true if switch is arg1 or later, and earlier than arg2
<>  true if switch is earlier than arg1 or is arg2 or later

If the switch is not present, the condition is false unless
the first character of the <comparison-op> is '!'.

For example,
%:version-compare(>= 10.3 mmacosx-version-min= -lmx)
adds -lmx if -mmacosx-version-min=10.3.9 was passed.   

References abort, check_live_switch(), compare_version_strings(), fatal_error(), i, input_location, n_switches, NULL, switchstr::part1, and switches.

◆ whitespace_to_convert_p()

static bool whitespace_to_convert_p ( char c,
void *  )
inlinestatic
Return true iff C is any of the characters convert_white_space
should quote.   

Referenced by convert_white_space().

◆ xputenv()

static void xputenv ( const char * string)
static

Variable Documentation

◆ accel_dir_suffix

const char* const accel_dir_suffix = ACCEL_DIR_SUFFIX
static
A prefix to be used when this is an accelerator compiler.   

Referenced by process_command(), and driver::set_up_specs().

◆ added_libraries

int added_libraries
static
This counts the number of libraries added by lang_specific_driver, so that
we can tell if there were any user supplied any files or libraries.   

Referenced by driver::finalize(), driver::prepare_infiles(), and process_command().

◆ always_delete_queue

struct temp_file* always_delete_queue
static
Queue of files to delete on success or failure of compilation.   

Referenced by delete_temp_files(), driver::finalize(), and record_temp_file().

◆ any_link_options_p

bool any_link_options_p
static
True if -r, -shared, -pie, or -no-pie were specified on the command
line.   

Referenced by driver_handle_option(), and process_command().

◆ arg_going

int arg_going
static
These are variables used within do_spec and do_spec_1.   
Nonzero if an arg has been started and not yet terminated
(with space, tab or newline).   

Referenced by do_spec_1(), do_spec_2(), end_going_arg(), eval_spec_function(), and driver::finalize().

◆ argbuf

vec<const_char_p> argbuf
static

◆ asm_debug

const char* asm_debug = ASM_DEBUG_SPEC
static

◆ asm_debug_option

const char* asm_debug_option = ASM_DEBUG_OPTION_SPEC
static

◆ asm_final_spec

const char* asm_final_spec = ASM_FINAL_SPEC
static

Referenced by do_spec_1().

◆ asm_options

const char* asm_options
static
Initial value:
=
"%{-target-help:%:print-asm-header()} "
"%(asm_debug_option)"
"%a %Y %{c:%W{o*}%{!o*:-o %w%b%O}}%{!c:-o %d%w%u%O}"
#define ASM_COMPRESS_DEBUG_SPEC
Definition gcc.cc:908

◆ asm_spec

const char* asm_spec = ASM_SPEC
static

Referenced by do_spec_1(), and init_spec().

◆ assembler_options

vec<char_p> assembler_options
static
A vector of options to give to the assembler.
These options are accumulated by -Wa,
and substituted into the assembler command with %Y.   

Referenced by add_assembler_option(), do_spec_1(), driver::finalize(), and driver::main().

◆ at_file_argbuf

vec<const_char_p> at_file_argbuf
static
Likewise, but for the current @file.   

Referenced by alloc_args(), clear_args(), close_at_file(), and store_arg().

◆ at_file_supplied

bool at_file_supplied
static
Flag set to nonzero if an @file argument has been supplied to gcc.   

Referenced by do_spec_1().

◆ basename_length

int basename_length
static

◆ cc1_options

const char* cc1_options
static
Initial value:
=
"%{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\
%{!iplugindir*:%{fplugin*:%:find-plugindir()}}\
%1 %{!Q:-quiet} %(cpp_debug_options) %{m*} %{aux-info*}\
%{g*} %{O*} %{W*&pedantic*} %{w} %{std*&ansi&trigraphs}\
%{v:-version} %{pg:-p} %{p} %{f*} %{undef}\
%{Qn:-fno-ident} %{Qy:} %{-help:--help}\
%{-target-help:--target-help}\
%{-version:--version}\
%{-help=*:--help=%*}\
%{!fsyntax-only:%{S:%W{o*}%{!o*:-o %w%b.s}}}\
%{fsyntax-only:-o %j} %{-param*}\
%{coverage:-fprofile-arcs -ftest-coverage}\
%{fprofile-arcs|fcondition-coverage|fprofile-generate*|coverage:\
%{!fprofile-update=single:\
%{pthread:-fprofile-update=prefer-atomic}}}"
NB: This is shared amongst all front-ends, except for Ada.   

◆ cc1_spec

const char* cc1_spec = CC1_SPEC OS_CC1_SPEC
static

Referenced by do_spec_1().

◆ cc1plus_spec

const char* cc1plus_spec = CC1PLUS_SPEC
static

Referenced by do_spec_1().

◆ collect_obstack

struct obstack collect_obstack
static
This is the obstack to build an environment variable to pass to
collect2 that describes all of the relevant switches of what to
pass the compiler in building the list of pointers to constructors
and destructors.   

Referenced by build_search_list(), driver::finalize(), driver::maybe_putenv_COLLECT_LTO_WRAPPER(), driver::maybe_putenv_OFFLOAD_TARGETS(), putenv_COLLECT_AS_OPTIONS(), driver::putenv_COLLECT_GCC(), and set_collect_gcc_options().

◆ combine_inputs

bool combine_inputs
static
True if multiple input files are being compiled to a single
assembly file.   

Referenced by do_spec_1(), driver::finalize(), and driver::prepare_infiles().

◆ compare_debug

int compare_debug
Set to zero if -fcompare-debug is disabled, positive if it's
enabled and we're running the first compilation, negative if it's
enabled and we're running the second compilation.  For most of the
time, it's in the range -1..1, but it can be temporarily set to 2
or 3 to indicate that the -fcompare-debug flags didn't come from
the command-line, but rather from the GCC_COMPARE_DEBUG environment
variable, until a synthesized -fcompare-debug flag is added to the
command line.   

Referenced by compare_debug_dump_opt_spec_function(), compare_debug_self_opt_spec_function(), do_spec_1(), driver::do_spec_on_infiles(), driver_handle_option(), dumps_spec_func(), driver::finalize(), process_command(), and driver::set_up_specs().

◆ compare_debug_opt

const char* compare_debug_opt
Set to the flags that should be passed to the second compilation in
a -fcompare-debug compilation.   

Referenced by compare_debug_self_opt_spec_function(), driver_handle_option(), driver::finalize(), and process_command().

◆ compare_debug_second

int compare_debug_second
Set to nonzero if we've seen the -fcompare-debug-second flag.   

Referenced by driver_handle_option(), driver::finalize(), and driver::set_up_specs().

◆ compiler_version

const char* compiler_version
static
The compiler version.   

Referenced by print_configuration(), and process_command().

◆ compilers

struct compiler* compilers
static
Pointer to a vector of `struct compiler' that gives the spec for
compiling a file, based on its suffix.
A file that does not end in any of these suffixes will be passed
unchanged to the loader and nothing else will be done to it.

An entry containing two 0s is used to terminate the vector.

If multiple entries match a file, the last matching one is used.   

Referenced by driver::finalize(), lookup_compiler(), read_specs(), driver::set_up_specs(), and validate_all_switches().

◆ completion

const char* completion = NULL
static
Flag that stores string prefix for which we provide bash completion.   

Referenced by driver_handle_option(), and driver::main().

◆ cpp_debug_options

const char* cpp_debug_options = DUMPS_OPTIONS ("")
static
This contains cpp options which are not passed when the preprocessor
output will be used by another program.   

◆ cpp_options

const char* cpp_options
static
Initial value:
=
"%(cpp_unique_options) %1 %{m*} %{std*&ansi&trigraphs} %{W*&pedantic*} %{w}\
%{f*} %{g*:%{%:debug-level-gt(0):%{g*}\
%{!fno-working-directory:-fworking-directory}}} %{O*}\
%{undef} %{save-temps*:-fpch-preprocess}"
This contains cpp options which are common with cc1_options and are passed
only when preprocessing only to avoid duplication.  We pass the cc1 spec
options to the preprocessor so that it the cc1 spec may manipulate
options used to set target flags.  Those special target flags settings may
in turn cause preprocessor symbols to be defined specially.   

Referenced by register_include_chains(), and remove_duplicates().

◆ cpp_spec

const char* cpp_spec = CPP_SPEC
static

Referenced by do_spec_1().

◆ cpp_unique_options

const char* cpp_unique_options
static
Initial value:
=
"%{!Q:-quiet} %{nostdinc*} %{C} %{CC} %{v} %@{I*&F*} %{P} %I\
%{MD:-MD %{!o:%b.d}%{o*:%.d%*}}\
%{MMD:-MMD %{!o:%b.d}%{o*:%.d%*}}\
%{M} %{MM} %{MF*} %{MG} %{MP} %{MQ*} %{MT*}\
%{Mmodules} %{Mno-modules}\
%{!E:%{!M:%{!MM:%{!MT:%{!MQ:%{MD|MMD:%{o*:-MQ %*}}}}}}}\
%{remap} %{%:debug-level-gt(2):-dD}\
%{!iplugindir*:%{fplugin*:%:find-plugindir()}}\
%{H} %C %{D*&U*&A*} %{i*} %Z %i\
%{E|M|MM:%W{o*}}\
%{fdeps-format=*:%{!fdeps-file=*:-fdeps-file=%:join(%{!o:%b.ddi}%{o*:%.ddi%*})}}\
%{fdeps-format=*:%{!fdeps-target=*:-fdeps-target=%:join(%{!o:%b.o}%{o*:%.o%*})}}"
We don't wrap .d files in %W{} since a missing .d file, and
therefore no dependency entry, confuses make into thinking a .o
file that happens to exist is up-to-date.   

◆ cross_compile

const char* cross_compile = "0"
static
Nonzero if cross-compiling.
When -b is used, the value comes from the `specs' file.   

Referenced by process_command(), and driver::set_up_specs().

◆ debug_check_temp_file

char* debug_check_temp_file[2]
static

◆ default_compilers

const struct compiler default_compilers[]
static
The default list of file name suffixes and their compilation specs.   

Referenced by driver::set_up_specs().

◆ delete_this_arg

int delete_this_arg
static
Nonzero means %d or %g has been seen; the next arg to be terminated
is a temporary file name.   

Referenced by do_spec_1(), do_spec_2(), end_going_arg(), eval_spec_function(), and driver::finalize().

◆ dir_separator_str

const char dir_separator_str[] = { DIR_SEPARATOR, 0 }
static

◆ driver_self_specs

const char* const driver_self_specs[]
static
Initial value:
= {
"%{fdump-final-insns:-fdump-final-insns=.} %<fdump-final-insns",
"%<fmultiflags"
}
#define GOMP_SELF_SPECS
Definition gcc.cc:1344
#define DRIVER_SELF_SPECS
Definition gcc.cc:1338
#define GTM_SELF_SPECS
Definition gcc.cc:1351

Referenced by driver::set_up_specs().

◆ dumpbase

◆ dumpbase_ext

char * dumpbase_ext
static

◆ dumpdir

char* dumpdir
static
-dumpdir, -dumpbase and -dumpbase-ext flags passed in, possibly
rearranged as they are to be passed down, e.g., dumpbase and
dumpbase_ext may be cleared if integrated with dumpdir or
dropped.   

Referenced by do_spec_1(), driver_handle_option(), dumps_spec_func(), driver::finalize(), make_at_file(), driver::maybe_run_linker(), process_command(), and set_collect_gcc_options().

◆ dumpdir_length

size_t dumpdir_length = 0
static
Usually the length of the string in dumpdir.  However, during
linking, it may be shortened to omit a driver-added trailing dash,
by then replaced with a trailing period, that is still to be passed
to sub-processes in -dumpdir, but not to be generally used in spec
filename expansions.  See maybe_run_linker.   

Referenced by do_spec_1(), driver::finalize(), driver::maybe_run_linker(), and process_command().

◆ dumpdir_trailing_dash_added

bool dumpdir_trailing_dash_added = false
static
Set if the last character in dumpdir is (or was) a dash that the
driver added to dumpdir after dumpbase or linker output name.   

Referenced by do_spec_1(), driver::finalize(), make_at_file(), driver::maybe_run_linker(), and process_command().

◆ endfile_spec

const char* endfile_spec = ENDFILE_SPEC
static

Referenced by do_spec_1().

◆ env

◆ exec_prefixes

struct path_prefix exec_prefixes = { 0, 0, "exec" }
static

◆ execution_count

int execution_count
static
Number of commands executed so far.   

Referenced by execute(), driver::finalize(), and driver::maybe_run_linker().

◆ failure_delete_queue

struct temp_file* failure_delete_queue
static
Queue of files to delete on failure of compilation.   

Referenced by clear_failure_queue(), delete_failure_queue(), driver::finalize(), and record_temp_file().

◆ gcc_exec_prefix

const char* gcc_exec_prefix
static
Adjusted value of GCC_EXEC_PREFIX envvar.   

Referenced by do_spec_1(), and process_command().

◆ gcc_input_filename

const char* gcc_input_filename
static
Process a spec string, accumulating and running commands.   
These variables describe the input file name.
input_file_number is the index on outfiles of this file,
so that the output file name can be stored for later use by %o.
input_basename is the start of the part of the input file
sans all directory names, and basename_length is the number
of characters starting there excluding the suffix .c or whatever.   

Referenced by compare_files(), do_spec_1(), driver::do_spec_on_infiles(), driver::finalize(), set_input(), and try_generate_repro().

◆ gcc_libexec_prefix

const char* gcc_libexec_prefix
static
Adjusted value of standard_libexec_prefix.   

Referenced by driver::finalize(), and process_command().

◆ greatest_status

int greatest_status = 1
static
Greatest exit code of sub-processes that has been encountered up to
now.   

Referenced by execute(), driver::finalize(), and driver::get_exit_code().

◆ have_c

◆ have_E

int have_E = 0
static
Was the option -E passed.   

Referenced by driver_handle_option(), and lookup_compiler().

◆ have_o

int have_o = 0
static
Was the option -o passed.   

Referenced by driver_handle_option(), driver::finalize(), and driver::prepare_infiles().

◆ in_at_file

bool in_at_file = false
static
Whether an @file is currently open.   

Referenced by close_at_file(), open_at_file(), and store_arg().

◆ include_prefixes

struct path_prefix include_prefixes = { 0, 0, "include" }
static
List of prefixes to try when looking for include files.   

Referenced by do_spec_1(), driver_handle_option(), driver::finalize(), find_fortran_preinclude_file(), and process_command().

◆ infiles

◆ input_basename

const char* input_basename
static

◆ input_file_compiler

struct compiler* input_file_compiler
static
The compiler used to process the current input file.   

Referenced by compile_input_file_p(), do_spec_1(), driver::do_spec_on_infiles(), driver::finalize(), input_spec_matches(), and driver::prepare_infiles().

◆ input_file_number

int input_file_number
static

◆ input_filename_length

size_t input_filename_length

◆ input_from_pipe

int input_from_pipe
static
Nonzero means that the input of this command is coming from a pipe.   

Referenced by do_spec_1(), do_spec_2(), eval_spec_function(), and driver::finalize().

◆ input_stat

struct stat input_stat
static

Referenced by do_spec_1().

◆ input_stat_set

int input_stat_set
static

◆ input_suffix

const char* input_suffix
static

◆ invoke_as

const char* invoke_as
static
Initial value:
=
"%{!fwpa*:\
%{fcompare-debug=*|fdump-final-insns=*:%:compare-debug-dump-opt()}\
%{!S:-o %|.s |\n as %(asm_options) %m.s %A }\
}"

◆ is_cpp_driver

int is_cpp_driver
Flag set by cppspec.cc to 1.   

Referenced by driver_handle_option(), and driver::finalize().

◆ just_machine_suffix

const char* just_machine_suffix = 0
static
Suffix to attach to directories searched for commands.
This is just `MACHINE/'.   

Referenced by driver::finalize(), for_each_path(), and driver::set_up_specs().

◆ last_language_n_infiles

int last_language_n_infiles
static

◆ lib_spec

const char* lib_spec = LIB_SPEC
static

Referenced by do_spec_1().

◆ libgcc_spec

const char* libgcc_spec = LIBGCC_SPEC
static

Referenced by do_spec_1(), and init_spec().

◆ link_command_spec

◆ link_gcc_c_sequence_spec

const char* link_gcc_c_sequence_spec = LINK_GCC_C_SEQUENCE_SPEC
static

◆ link_gomp_spec

const char* link_gomp_spec = ""
static

◆ link_libgcc_spec

const char* link_libgcc_spec = LINK_LIBGCC_SPEC
static

◆ link_spec

const char* link_spec = LINK_SPEC
static

◆ link_ssp_spec

const char* link_ssp_spec = LINK_SSP_SPEC
static

◆ linker_name_spec

const char* linker_name_spec = LINKER_NAME
static

◆ linker_options

vec<char_p> linker_options
static
A vector of options to give to the linker.
These options are accumulated by %x,
and substituted into the linker command with %X.   

Referenced by add_linker_option(), do_spec_1(), and driver::finalize().

◆ linker_plugin_file_spec

const char* linker_plugin_file_spec = ""
static

◆ lto_gcc_spec

const char* lto_gcc_spec = ""
static

◆ lto_wrapper_spec

const char* lto_wrapper_spec = ""
static

◆ machine_suffix

const char* machine_suffix = 0
static
Suffix to attach to directories searched for commands.
This looks like `MACHINE/VERSION/'.   

Referenced by driver::finalize(), for_each_path(), driver::maybe_print_and_exit(), and driver::set_up_specs().

◆ md_exec_prefix

const char* md_exec_prefix = MD_EXEC_PREFIX
static
For native compilers, these are well-known paths containing
components that may be provided by the system.  For cross
compilers, these paths are not used.   

Referenced by driver::finalize(), and driver::set_up_specs().

◆ md_startfile_prefix

const char* md_startfile_prefix = MD_STARTFILE_PREFIX
static

◆ md_startfile_prefix_1

const char* md_startfile_prefix_1 = MD_STARTFILE_PREFIX_1
static

◆ mdswitches

◆ multiarch_dir

const char* multiarch_dir
static
Subdirectory to use for locating libraries in multiarch conventions.  Set by
set_multilib_dir based on the compilation options.   

Referenced by do_spec_1(), driver::finalize(), for_each_path(), driver::maybe_print_and_exit(), and set_multilib_dir().

◆ multilib_defaults

const char* multilib_defaults
static

◆ multilib_defaults_raw

const char* const multilib_defaults_raw[] = MULTILIB_DEFAULTS
static

◆ multilib_dir

const char* multilib_dir
static
Subdirectory to use for locating libraries.  Set by
set_multilib_dir based on the compilation options.   

Referenced by do_spec_1(), driver::finalize(), for_each_path(), driver::maybe_print_and_exit(), and set_multilib_dir().

◆ multilib_exclusions

const char* multilib_exclusions
static

◆ multilib_matches

const char* multilib_matches
static

◆ multilib_obstack

struct obstack multilib_obstack
static
Some compilers have limits on line lengths, and the multilib_select
and/or multilib_matches strings can be very long, so we build them at
run time.   

Referenced by driver::build_multilib_strings(), driver::finalize(), and set_multilib_dir().

◆ multilib_os_dir

const char* multilib_os_dir
static
Subdirectory to use for locating libraries in OS conventions.  Set by
set_multilib_dir based on the compilation options.   

Referenced by do_spec_1(), driver::finalize(), for_each_path(), driver::maybe_print_and_exit(), and set_multilib_dir().

◆ multilib_reuse

const char* multilib_reuse
static

◆ multilib_select

const char* multilib_select
static

◆ n_compilers

int n_compilers
static
Number of entries in `compilers', not counting the null terminator.   

Referenced by driver::finalize(), lookup_compiler(), read_specs(), and driver::set_up_specs().

◆ n_default_compilers

const int n_default_compilers = ARRAY_SIZE (default_compilers) - 1
static
Number of elements in default_compilers, not counting the terminator.   

Referenced by driver::finalize(), and driver::set_up_specs().

◆ n_infiles

◆ n_infiles_alloc

int n_infiles_alloc
static

Referenced by alloc_infile(), and driver::finalize().

◆ n_mdswitches

int n_mdswitches
static

◆ n_switches

◆ n_switches_alloc

int n_switches_alloc
static

◆ n_switches_alloc_debug_check

int n_switches_alloc_debug_check[2]
static

◆ n_switches_debug_check

int n_switches_debug_check[2]
static

◆ obstack

◆ offload_targets

char* offload_targets = NULL
static
List of offload targets.  Separated by colon.  Empty string for
-foffload=disable.   

Referenced by handle_foffload_option(), driver::maybe_putenv_OFFLOAD_TARGETS(), and process_command().

◆ option_default_specs

const struct default_spec option_default_specs[] = { OPTION_DEFAULT_SPECS }
static

◆ outbase

char* outbase
static
Basename of dump and aux outputs, computed from dumpbase (given or
derived from output name), to override input_basename in non-%w %b
et al.   

Referenced by do_spec_1(), dumps_spec_func(), driver::finalize(), driver::maybe_run_linker(), and process_command().

◆ outbase_length

size_t outbase_length = 0
static

◆ outfiles

◆ output_file

const char* output_file = 0
static
Pointer to output file name passed in with -o.  

Referenced by driver_handle_option(), and process_command().

◆ post_link_spec

const char* post_link_spec = POST_LINK_SPEC
static

◆ preprocessor_options

vec<char_p> preprocessor_options
static
A vector of options to give to the preprocessor.
These options are accumulated by -Wp,
and substituted into the preprocessor command with %Z.   

Referenced by add_preprocessor_option(), do_spec_1(), and driver::finalize().

◆ print_help_list

int print_help_list
static
Definition of string containing the arguments given to configure.   
Flag saying to print the command line options understood by gcc and its
sub-processes.   

Referenced by driver_handle_option(), execute(), driver::final_actions(), driver::finalize(), driver::maybe_print_and_exit(), and process_command().

◆ print_subprocess_help

int print_subprocess_help
static
Flag indicating how to print command line options of sub-processes.   

Referenced by driver_handle_option(), driver::finalize(), driver::maybe_run_linker(), and process_command().

◆ print_version

int print_version ( void )
static
Flag saying to print the version of gcc and its sub-processes.   

Referenced by driver_handle_option(), driver::finalize(), init_asm_output(), toplev::main(), driver::maybe_print_and_exit(), and process_command().

◆ processing_spec_function

int processing_spec_function
static

◆ report_times_to_file

FILE* report_times_to_file = NULL
Whether we should report subprocess execution times to a file.   

Referenced by driver_handle_option(), execute(), and driver::finalize().

◆ save_temps_flag

◆ save_temps_overrides_dumpdir

bool save_temps_overrides_dumpdir = false
static
Set this iff the dumppfx implied by a -save-temps=* option is to
override a -dumpdir option, if any.   

Referenced by driver_handle_option(), driver::finalize(), and process_command().

◆ self_spec

const char* self_spec = ""
static

◆ signal_count

int signal_count
static
Number of commands that exited with a signal.   

Referenced by execute(), driver::finalize(), and driver::get_exit_code().

◆ spec_host_machine

const char* spec_host_machine = DEFAULT_REAL_TARGET_MACHINE
static

◆ spec_lang

const char* spec_lang = 0
static

◆ spec_machine

const char* spec_machine = DEFAULT_TARGET_MACHINE
static

◆ spec_undefvar_allowed

bool spec_undefvar_allowed
static
True if undefined environment variables encountered during spec processing
are ok to ignore, typically when we're running for --help or --version.   

Referenced by getenv_spec_function(), and process_command().

◆ spec_version

const char* const spec_version = DEFAULT_TARGET_VERSION
static
The target version.   

Referenced by driver_handle_option(), process_command(), and driver::set_up_specs().

◆ specs

struct spec_list* specs = (struct spec_list *) 0
static

◆ standard_bindir_prefix

const char* const standard_bindir_prefix = STANDARD_BINDIR_PREFIX
static

Referenced by process_command().

◆ standard_exec_prefix

const char* const standard_exec_prefix = STANDARD_EXEC_PREFIX
static
These directories are locations set at configure-time based on the
--prefix option provided to configure.  Their initializers are
defined in Makefile.in.  These paths are not *directly* used when
gcc_exec_prefix is set because, in that case, we know where the
compiler has been installed, and use paths relative to that
location instead.   

Referenced by process_command().

◆ standard_libexec_prefix

const char* const standard_libexec_prefix = STANDARD_LIBEXEC_PREFIX
static

Referenced by process_command().

◆ standard_startfile_prefix

const char* const standard_startfile_prefix = STANDARD_STARTFILE_PREFIX
static

Referenced by driver::set_up_specs().

◆ standard_startfile_prefix_1

const char* const standard_startfile_prefix_1 = STANDARD_STARTFILE_PREFIX_1
static

Referenced by driver::set_up_specs().

◆ standard_startfile_prefix_2

const char* const standard_startfile_prefix_2 = STANDARD_STARTFILE_PREFIX_2
static

Referenced by driver::set_up_specs().

◆ startfile_prefix_spec

const char* startfile_prefix_spec = STARTFILE_PREFIX_SPEC
static

Referenced by driver::set_up_specs().

◆ startfile_prefixes

struct path_prefix startfile_prefixes = { 0, 0, "startfile" }
static

◆ startfile_spec

const char* startfile_spec = STARTFILE_SPEC
static

Referenced by do_spec_1().

◆ static_p

bool static_p
static
True if -static was specified on the command line.   

Referenced by driver_handle_option(), gimple_parm_array_size(), process_command(), should_duplicate_loop_header_p(), and spill_for().

◆ static_spec_functions

const struct spec_function static_spec_functions[]
static
Initial value:
=
{
{ "getenv", getenv_spec_function },
{ "if-exists", if_exists_spec_function },
{ "if-exists-else", if_exists_else_spec_function },
{ "if-exists-then-else", if_exists_then_else_spec_function },
{ "sanitize", sanitize_spec_function },
{ "replace-outfile", replace_outfile_spec_function },
{ "remove-outfile", remove_outfile_spec_function },
{ "version-compare", version_compare_spec_function },
{ "include", include_spec_function },
{ "find-file", find_file_spec_function },
{ "find-plugindir", find_plugindir_spec_function },
{ "print-asm-header", print_asm_header_spec_function },
{ "compare-debug-dump-opt", compare_debug_dump_opt_spec_function },
{ "compare-debug-self-opt", compare_debug_self_opt_spec_function },
{ "pass-through-libs", pass_through_libs_spec_func },
{ "dumps", dumps_spec_func },
{ "debug-level-gt", debug_level_greater_than_spec_func },
{ "dwarf-version-gt", dwarf_version_greater_than_spec_func },
{ "fortran-preinclude-file", find_fortran_preinclude_file},
{ "join", join_spec_func},
{ 0, 0 }
}
static const char * getenv_spec_function(int, const char **)
Definition gcc.cc:10313
static const char * replace_outfile_spec_function(int, const char **)
Definition gcc.cc:10457
static const char * find_plugindir_spec_function(int, const char **)
Definition gcc.cc:10651
static const char * find_file_spec_function(int, const char **)
Definition gcc.cc:10635
static const char * if_exists_then_else_spec_function(int, const char **)
Definition gcc.cc:10402
static const char * greater_than_spec_func(int, const char **)
Definition gcc.cc:10956
static const char * dwarf_version_greater_than_spec_func(int, const char **)
Definition gcc.cc:11002
static const char * debug_level_greater_than_spec_func(int, const char **)
Definition gcc.cc:10981
static const char * version_compare_spec_function(int, const char **)
Definition gcc.cc:10547
static const char * if_exists_else_spec_function(int, const char **)
Definition gcc.cc:10383
static const char * compare_debug_dump_opt_spec_function(int, const char **)
Definition gcc.cc:10718
static const char * include_spec_function(int, const char **)
Definition gcc.cc:10618
static const char * join_spec_func(int, const char **)
Definition gcc.cc:11087
static const char * remove_outfile_spec_function(int, const char **)
Definition gcc.cc:10478
static const char * if_exists_spec_function(int, const char **)
Definition gcc.cc:10368
static const char * dumps_spec_func(int, const char **)
Definition gcc.cc:10862
static const char * pass_through_libs_spec_func(int, const char **)
Definition gcc.cc:10814
static const char * print_asm_header_spec_function(int, const char **)
Definition gcc.cc:10667
static const char * sanitize_spec_function(int, const char **)
Definition gcc.cc:10424
static const char * compare_debug_self_opt_spec_function(int, const char **)
Definition gcc.cc:10791
static const char * find_fortran_preinclude_file(int, const char **)
Definition gcc.cc:11040
List of static spec functions.   

Referenced by lookup_spec_function().

◆ static_specs

struct spec_list static_specs[]
static
List of statically defined specs.   

Referenced by driver::finalize(), init_spec(), set_spec(), and set_static_spec().

◆ suffix_subst

const char* suffix_subst
static
Nonnull means substitute this for any suffix when outputting a switches
arguments.   

Referenced by do_spec_1(), do_spec_2(), eval_spec_function(), driver::finalize(), give_switch(), and process_brace_body().

◆ suffixed_basename_length

int suffixed_basename_length
static

◆ switches

◆ switches_debug_check

struct switchstr* switches_debug_check[2]
static

◆ sysroot_hdrs_suffix_spec

const char* sysroot_hdrs_suffix_spec = SYSROOT_HEADERS_SUFFIX_SPEC
static

◆ sysroot_spec

const char* sysroot_spec = SYSROOT_SPEC
static

◆ sysroot_suffix_spec

const char* sysroot_suffix_spec = SYSROOT_SUFFIX_SPEC
static

Referenced by driver::set_up_specs().

◆ target_sysroot_hdrs_suffix

const char* target_sysroot_hdrs_suffix = 0
static
Nonzero means append this string to target_system_root for headers.   

Referenced by add_sysrooted_hdrs_prefix(), do_spec_1(), driver::finalize(), driver::maybe_print_and_exit(), and driver::set_up_specs().

◆ target_sysroot_suffix

const char* target_sysroot_suffix = 0
static
Nonzero means append this string to target_system_root.   

Referenced by add_sysrooted_prefix(), do_spec_1(), driver::finalize(), driver::maybe_print_and_exit(), and driver::set_up_specs().

◆ target_system_root

◆ target_system_root_changed

int target_system_root_changed
static
Nonzero means pass the updated target_system_root to the compiler.   

Referenced by do_spec_1(), driver_handle_option(), driver::finalize(), and process_command().

◆ temp_filename

const char* temp_filename
static
Record the names of temporary files we tell compilers to write,
and delete them at the end of the run.   
This is the common prefix we use to make temp file names.
It is chosen once for each run of this program.
It is substituted into a spec by %g or %j.
Thus, all temp file names contain this prefix.
In practice, all temp file names start with this prefix.

This prefix comes from the envvar TMPDIR if it is defined;
otherwise, from the P_tmpdir macro if that is defined;
otherwise, in /usr/tmp or /tmp;
or finally the current directory if all else fails.   

Referenced by do_spec_1(), execute(), and driver::finalize().

◆ temp_filename_length

int temp_filename_length
static
Length of the prefix.   

Referenced by do_spec_1(), and driver::finalize().

◆ temp_names

struct temp_name * temp_names
static

Referenced by do_spec_1(), and driver::finalize().

◆ this_is_library_file

int this_is_library_file
static
Nonzero means %s has been seen; the next arg to be terminated
is the name of a library file and we should try the standard
search dirs for it.   

Referenced by do_spec_1(), do_spec_2(), end_going_arg(), eval_spec_function(), and driver::finalize().

◆ this_is_linker_script

int this_is_linker_script
static
Nonzero means %T has been seen; the next arg to be terminated
is the name of a linker script and we should try all of the
standard search dirs for it.  If it is found insert a --script
command line switch and then substitute the full path in place,
otherwise generate an error message.   

Referenced by do_spec_1(), do_spec_2(), end_going_arg(), eval_spec_function(), and driver::finalize().

◆ this_is_output_file

int this_is_output_file
static
Nonzero means %w has been seen; the next arg to be terminated
is the output file name of this compilation.   

Referenced by do_spec_1(), do_spec_2(), end_going_arg(), eval_spec_function(), and driver::finalize().

◆ tooldir_base_prefix

const char* const tooldir_base_prefix = TOOLDIR_BASE_PREFIX
static
A relative path to be used in finding the location of tools
relative to the driver.   

Referenced by process_command().

◆ totruncate_file

const char* totruncate_file = 0
static
Pointer to input file name passed in with -truncate.
This file should be truncated after linking.  

Referenced by driver_handle_option(), and driver::final_actions().

◆ trad_capable_cpp

const char* trad_capable_cpp
static
Initial value:
=
"cc1 -E %{traditional|traditional-cpp:-traditional-cpp}"
Standard options to cpp, cc1, and as, to reduce duplication in specs.
There should be no need to override these in target dependent files,
but we need to copy them to the specs file so that newer versions
of the GCC driver can correctly drive older tool chains with the
appropriate -B options.   
When cpplib handles traditional preprocessing, get rid of this, and
call cc1 (or cc1obj in objc/lang-specs.h) from the main specs so
that we default the front end language better.   

◆ use_ld

const char* use_ld
static
Linker suffix passed to -fuse-ld=...  

Referenced by driver_handle_option(), driver::finalize(), and driver::maybe_print_and_exit().

◆ used_arg

◆ user_specs_head

struct user_specs* user_specs_head
static

◆ user_specs_tail

struct user_specs * user_specs_tail
static

◆ verbose_only_flag

int verbose_only_flag
static
Flag indicating whether we should ONLY print the command and
arguments (like verbose_flag) without executing the command.
Displayed arguments are quoted so that the generated command
line is suitable for execution.  This is intended for use in
shell scripts to capture the driver-generated command line.   

Referenced by driver_handle_option(), execute(), and driver::finalize().