GCC Middle and Back End API Reference
gcc.c 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 "gcc.h"
#include "diagnostic.h"
#include "flags.h"
#include "opts.h"
#include "params.h"
#include "vec.h"
#include "filenames.h"
#include "configargs.h"
#include "specs.h"
Include dependency graph for gcc.c:

Data Structures

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  switchstr
struct  infile
struct  spec_path_info
struct  mdswitchstr

Macros

#define HOST_EXECUTABLE_SUFFIX   ""
#define TARGET_OBJECT_SUFFIX   ".o"
#define LIBRARY_PATH_ENV   "LIBRARY_PATH"
#define MIN_FATAL_STATUS   1
#define ASM_SPEC   ""
#define ASM_FINAL_SPEC   "%{gsplit-dwarf: \n\ objcopy --extract-dwo \ %{c:%{o*:%*}%{!o*:%b%O}}%{!c:%U%O} \ %{c:%{o*:%:replace-extension(%{o*:%*} .dwo)}%{!o*:%b.dwo}}%{!c:%b.dwo} \n\ objcopy --strip-dwo \ %{c:%{o*:%*}%{!o*:%b%O}}%{!c:%U%O} \ }"
#define CPP_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 ADD_STATIC_LIBASAN_LIBS
#define LIBASAN_SPEC   "-lasan" ADD_STATIC_LIBASAN_LIBS
#define LIBASAN_EARLY_SPEC   ""
#define ADD_STATIC_LIBTSAN_LIBS
#define LIBTSAN_SPEC   "-ltsan" ADD_STATIC_LIBTSAN_LIBS
#define LIBTSAN_EARLY_SPEC   ""
#define ADD_STATIC_LIBUBSAN_LIBS
#define LIBUBSAN_SPEC   "-lubsan" ADD_STATIC_LIBUBSAN_LIBS
#define LIBUBSAN_EARLY_SPEC   ""
#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_DEBUG_SPEC   ""
#define LINK_GCC_C_SEQUENCE_SPEC   "%G %L %G"
#define LINK_SSP_SPEC   "%{fstack-protector|fstack-protector-strong|fstack-protector-all:-lssp_nonshared -lssp}"
#define LINK_PIE_SPEC   "%{pie:} "
#define LINK_PLUGIN_SPEC   "%{fuse-linker-plugin:\ %e-fuse-linker-plugin is not supported in this configuration}"
#define SANITIZER_EARLY_SPEC   "\%{!nostdlib:%{!nodefaultlibs:%{%:sanitize(address):" LIBASAN_EARLY_SPEC "} \ %{%:sanitize(thread):" LIBTSAN_EARLY_SPEC "} \ %{%:sanitize(undefined):" LIBUBSAN_EARLY_SPEC "}}}"
#define SANITIZER_SPEC   "\%{!nostdlib:%{!nodefaultlibs:%{%:sanitize(address):" LIBASAN_SPEC "\ %{static:%ecannot specify -static with -fsanitize=address}\ %{%:sanitize(thread):%e-fsanitize=address is incompatible with -fsanitize=thread}}\ %{%:sanitize(thread):" LIBTSAN_SPEC "\ %{!pie:%{!shared:%e-fsanitize=thread linking must be done with -pie or -shared}}}\ %{%:sanitize(undefined):" LIBUBSAN_SPEC "}}}"
#define VTABLE_VERIFICATION_SPEC   "\%{!nostdlib:%{fvtable-verify=std: -lvtv -u_vtable_map_vars_start -u_vtable_map_vars_end}\ %{fvtable-verify=preinit: -lvtv -u_vtable_map_vars_start -u_vtable_map_vars_end}}"
#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 MULTILIB_DEFAULTS   { "" }
#define DRIVER_SELF_SPECS   ""
#define GOMP_SELF_SPECS   "%{fopenmp|ftree-parallelize-loops=*: -pthread}"
#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)   { NAME, NULL, PTR, (struct spec_list *) 0, sizeof (NAME) - 1, false, false }
#define DELETE_IF_ORDINARY(NAME, ST, VERBOSE_FLAG)
#define SWITCH_LIVE   (1 << 0)
#define SWITCH_FALSE   (1 << 1)
#define SWITCH_IGNORE   (1 << 2)
#define SWITCH_IGNORE_PERMANENTLY   (1 << 3)
#define SWITCH_KEEP_FOR_GCC   (1 << 4)
#define SKIP_WHITE()   do { while (*p == ' ' || *p == '\t') p++; } while (0)
#define SKIP_WHITE()   do { while (*p == ' ' || *p == '\t') p++; } while (0)
#define OPT   "-auxbase "

Typedefs

typedef char * char_p
typedef const char * const_char_p

Enumerations

enum  save_temps { SAVE_TEMPS_NONE, SAVE_TEMPS_CWD, SAVE_TEMPS_OBJ }
enum  path_prefix_priority { PREFIX_PRIORITY_B_OPT, PREFIX_PRIORITY_LAST }

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 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 struct spec_functionlookup_spec_function (const char *)
static const char * eval_spec_function (const char *, const char *)
static const char * handle_spec_function (const char *, bool *)
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 *)
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)
static void validate_all_switches (void)
static void validate_switches_from_spec (const char *, bool)
static void give_switch (int, int)
static int used_arg (const char *, int)
static int default_arg (const char *, int)
static void set_multilib_dir (void)
static void print_multilib_info (void)
static void perror_with_name (const char *)
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 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 * 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 * compare_debug_auxbase_opt_spec_function (int, const char **)
static const char * pass_through_libs_spec_func (int, const char **)
static const char * replace_extension_spec_func (int, const char **)
static char * convert_white_space (char *)
static char * skip_whitespace ()
static void set_spec ()
static void store_arg ()
static char * load_specs ()
static void read_specs ()
void record_temp_file ()
static void delete_if_ordinary ()
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 ()
static void xputenv ()
static int access_check ()
static void * file_at_path ()
static void add_preprocessor_option ()
static void add_assembler_option ()
static void add_linker_option ()
static void alloc_infile ()
static void add_infile ()
static void alloc_switch ()
static void save_switch (const char *opt, size_t n_args, const char *const *args, bool validated, bool known)
static bool driver_unknown_option_callback ()
static void driver_wrong_lang_callback (const struct cl_decoded_option *decoded, unsigned int lang_mask)
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)
static void set_option_handlers ()
static void end_going_arg ()
static void insert_wrapper ()
int do_spec ()
static int do_spec_2 ()
static void do_option_spec ()
static void do_self_spec ()
static void * spec_path ()
static void create_at_file ()
static bool compile_input_file_p ()
static void do_specs_vec ()
static int do_spec_1 ()
static struct spec_functionlookup_spec_function ()
static const char * eval_spec_function ()
static const char * handle_spec_function ()
static bool input_suffix_matches ()
static bool input_spec_matches ()
static bool switch_matches ()
static void mark_matching_switches ()
static const char * handle_braces ()
static int check_live_switch ()
static void give_switch ()
static const char * find_file ()
static int is_directory ()
void set_input ()
static void fatal_signal ()
static int compare_files ()
int main (int, char **)
int main ()
static struct compilerlookup_compiler ()
static char * save_string ()
void pfatal_with_name ()
static void perror_with_name ()
static void validate_switches_from_spec ()
static const char * validate_switches ()
static int used_arg ()
static int default_arg ()
static const char * getenv_spec_function ()
static const char * if_exists_spec_function ()
static const char * if_exists_else_spec_function ()
static const char * sanitize_spec_function ()
static const char * replace_outfile_spec_function ()
static const char * remove_outfile_spec_function ()
static int compare_version_strings ()
static const char * version_compare_spec_function ()
static const char * include_spec_function ()
static const char * find_file_spec_function ()
static const char * find_plugindir_spec_function ()
static unsigned HOST_WIDE_INT get_random_number ()
const char * pass_through_libs_spec_func ()
const char * replace_extension_spec_func ()
static char * convert_white_space ()

Variables

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 int verbose_only_flag
static int print_subprocess_help
FILE * report_times_to_file = NULL
static const char * target_system_root = 0
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 char * save_temps_prefix = 0
static size_t save_temps_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 * 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 * cpp_spec = CPP_SPEC
static const char * cc1_spec = 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 * 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 = "cc1 -E %{traditional|traditional-cpp:-traditional-cpp}"
static const char * cpp_unique_options
static const char * cpp_options
static const char * cpp_debug_options = "%{d*}"
static const char * cc1_options
static const char * asm_options = "%a %Y %{c:%W{o*}%{!o*:-o %w%b%O}}%{!c:-o %d%w%u%O}"
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 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 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 * 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 struct spec_function static_spec_functions []
static int processing_spec_function
static vec< const_char_pargbuf
static int have_o_argbuf_index = 0
static int have_c = 0
static int have_o = 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 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
static const char * debug_auxbase_opt

Macro Definition Documentation

#define ADD_STATIC_LIBASAN_LIBS
#define ADD_STATIC_LIBTSAN_LIBS
#define ADD_STATIC_LIBUBSAN_LIBS
#define ASM_DEBUG_SPEC   ""

Define ASM_DEBUG_SPEC to be a spec suitable for translating '-g' to the assembler.

#define ASM_FINAL_SPEC   "%{gsplit-dwarf: \n\ objcopy --extract-dwo \ %{c:%{o*:%*}%{!o*:%b%O}}%{!c:%U%O} \ %{c:%{o*:%:replace-extension(%{o*:%*} .dwo)}%{!o*:%b.dwo}}%{!c:%b.dwo} \n\ objcopy --strip-dwo \ %{c:%{o*:%*}%{!o*:%b%O}}%{!c:%U%O} \ }"

config.h can define ASM_FINAL_SPEC to run a post processor after the assembler has run.

#define ASM_MAP   ""
#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. i substitute the name of the input file being processed. b substitute the basename of the input file being processed. This is the substring up to (and not including) the last period and not including the directory unless -save-temps was specified to put temporaries in a different location. B same as b, but include the 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 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 mark last argument supplied within as a file to be deleted on failure. 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. 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. 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. %<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 '*'. %{.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 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.

#define CC1_SPEC   ""

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

#define CC1PLUS_SPEC   ""

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

#define CPP_SPEC   ""

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

#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) \
perror_with_name (NAME); \
} while (0)

Delete all the temporary files whose names we previously recorded.

#define DRIVER_SELF_SPECS   ""
#define ENDFILE_SPEC   ""

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

#define GOMP_SELF_SPECS   "%{fopenmp|ftree-parallelize-loops=*: -pthread}"

Adding -fopenmp should imply pthreads. This is particularly important for targets that use different start files and suchlike.

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

Likewise for -fgnu-tm.

#define HOST_EXECUTABLE_SUFFIX   ""

Compiler driver program that can handle many languages. Copyright (C) 1987-2013 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". By default there is no special suffix for target executables. FIXME: when autoconf is fixed, remove the host check - dj By default there is no special suffix for host executables.

Referenced by find_a_file().

#define INIT_STATIC_SPEC (   NAME,
  PTR 
)    { NAME, NULL, PTR, (struct spec_list *) 0, sizeof (NAME) - 1, false, false }
#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.

#define LIBASAN_EARLY_SPEC   ""
#define LIBASAN_SPEC   "-lasan" ADD_STATIC_LIBASAN_LIBS
#define LIBGCC_SPEC   "-lgcc"

config.h can define LIBGCC_SPEC to override how and when libgcc.a is included.

#define LIBRARY_PATH_ENV   "LIBRARY_PATH"

Most every one is fine with LIBRARY_PATH. For some, it conflicts.

#define LIBTSAN_EARLY_SPEC   ""
#define LIBTSAN_SPEC   "-ltsan" ADD_STATIC_LIBTSAN_LIBS
#define LIBUBSAN_EARLY_SPEC   ""
#define LIBUBSAN_SPEC   "-lubsan" ADD_STATIC_LIBUBSAN_LIBS
#define LINK_COMMAND_SPEC
Value:
"\%{!fsyntax-only:%{!c:%{!M:%{!MM:%{!E:%{!S:\ %(linker) " \
LINK_PLUGIN_SPEC \
"%{flto|flto=*:%<fcompare-debug*} \ %{flto} %{flto=*} %l " LINK_PIE_SPEC \
"%{fuse-ld=*:-fuse-ld=%*}\ %X %{o*} %{e*} %{N} %{n} %{r}\ %{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!nostartfiles:%S}} " VTABLE_VERIFICATION_SPEC " \ %{static:} %{L*} %(mfwrap) %(link_libgcc) " SANITIZER_EARLY_SPEC " %o\ %{fopenmp|ftree-parallelize-loops=*:%:include(libgomp.spec)%(link_gomp)}\ %{fgnu-tm:%:include(libitm.spec)%(link_itm)}\ %(mflib) " STACK_SPLIT_SPEC "\ %{fprofile-arcs|fprofile-generate*|coverage:-lgcov} " SANITIZER_SPEC " \ %{!nostdlib:%{!nodefaultlibs:%(link_ssp) %(link_gcc_c_sequence)}}\ %{!nostdlib:%{!nostartfiles:%E}} %{T*} }}}}}}"

-u* was put back because both BSD and SysV seem to support it. %{static:} simply prevents an error message if the target machine doesn't handle -static. 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.

#define LINK_GCC_C_SEQUENCE_SPEC   "%G %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.

#define LINK_LIBGCC_SPEC   "%D"

Generate -L options for startfile prefix list.

#define LINK_PIE_SPEC   "%{pie:} "
#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.

#define LINK_SPEC   ""

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

#define LINK_SSP_SPEC   "%{fstack-protector|fstack-protector-strong|fstack-protector-all:-lssp_nonshared -lssp}"
#define LINKER_NAME   "collect2"
#define MD_EXEC_PREFIX   ""

If no prefixes defined, use the null string, which will disable them.

#define MD_STARTFILE_PREFIX   ""
#define MD_STARTFILE_PREFIX_1   ""
#define MIN_FATAL_STATUS   1

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

#define MULTILIB_DEFAULTS   { "" }

Check whether a particular argument is a default argument.

#define OPT   "-auxbase "
#define OPTION_DEFAULT_SPECS   { "", "" }
#define SANITIZER_EARLY_SPEC   "\%{!nostdlib:%{!nodefaultlibs:%{%:sanitize(address):" LIBASAN_EARLY_SPEC "} \ %{%:sanitize(thread):" LIBTSAN_EARLY_SPEC "} \ %{%:sanitize(undefined):" LIBUBSAN_EARLY_SPEC "}}}"

Linker command line options for -fsanitize= early on the command line.

#define SANITIZER_SPEC   "\%{!nostdlib:%{!nodefaultlibs:%{%:sanitize(address):" LIBASAN_SPEC "\ %{static:%ecannot specify -static with -fsanitize=address}\ %{%:sanitize(thread):%e-fsanitize=address is incompatible with -fsanitize=thread}}\ %{%:sanitize(thread):" LIBTSAN_SPEC "\ %{!pie:%{!shared:%e-fsanitize=thread linking must be done with -pie or -shared}}}\ %{%:sanitize(undefined):" LIBUBSAN_SPEC "}}}"

Linker command line options for -fsanitize= late on the command line.

#define SKIP_WHITE ( )    do { while (*p == ' ' || *p == '\t') p++; } while (0)
#define SKIP_WHITE ( )    do { while (*p == ' ' || *p == '\t') p++; } while (0)
#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.

#define STANDARD_STARTFILE_PREFIX_1   "/lib/"

Default prefixes to attach to command names.

#define STANDARD_STARTFILE_PREFIX_2   "/usr/lib/"
#define STARTFILE_PREFIX_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.

#define SWITCH_FALSE   (1 << 1)
#define SWITCH_IGNORE   (1 << 2)
#define SWITCH_IGNORE_PERMANENTLY   (1 << 3)
#define SWITCH_KEEP_FOR_GCC   (1 << 4)
#define SWITCH_LIVE   (1 << 0)

Find all the switches given to us and make a vector describing them. The elements of the vector are strings, one per switch given. If a switch uses following arguments, then the `part1' field is the switch itself and the `args' field is a null-terminated vector containing the following arguments. Bits in the `live_cond' field are: SWITCH_LIVE to indicate this switch is true in a conditional spec. SWITCH_FALSE to indicate this switch is overridden by a later switch. SWITCH_IGNORE to indicate this switch should be ignored (used in %<S). SWITCH_IGNORE_PERMANENTLY to indicate this switch should be ignored in all do_spec calls afterwards. Used for %<S from self specs. The `validated' field is nonzero if any spec has looked at this switch; if it remains zero at the end of the run, it must be meaningless.

#define SYSROOT_HEADERS_SUFFIX_SPEC   ""
#define SYSROOT_SPEC   "--sysroot=%R"
#define SYSROOT_SUFFIX_SPEC   ""
#define TARGET_OBJECT_SUFFIX   ".o"

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

#define VTABLE_VERIFICATION_SPEC   "\%{!nostdlib:%{fvtable-verify=std: -lvtv -u_vtable_map_vars_start -u_vtable_map_vars_end}\ %{fvtable-verify=preinit: -lvtv -u_vtable_map_vars_start -u_vtable_map_vars_end}}"

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

typedef char* char_p
typedef const char* const_char_p

Accumulate a command (program name and args), and run it.


Enumeration Type Documentation

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

Enumerator:
PREFIX_PRIORITY_B_OPT 
PREFIX_PRIORITY_LAST 
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_OBJ 

Function Documentation

static int access_check ( const char *  ,
int   
)
static
static int access_check ( )
static

Check whether NAME can be accessed in MODE. This is like access, except that it never considers directories to be executable.

static void add_assembler_option ( const char *  ,
int   
)
static

Referenced by display_help(), and save_switch().

static void add_assembler_option ( )
static
static void add_infile ( )
static

Store an input file with the given NAME and LANGUAGE in infiles.

static void add_linker_option ( const char *  ,
int   
)
static

Referenced by display_help().

static void add_linker_option ( )
static
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.

Keep track of the longest prefix.

 Insert after PREV.   
static void add_preprocessor_option ( const char *  ,
int   
)
static

Referenced by display_help().

static void add_preprocessor_option ( )
static
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.

We have to override this because GCC's notion of sysroot moves along with GCC.

Parameters:
priorityenum prefix_priority

References NULL.

static void* add_to_obstack ( )
static
static void alloc_args ( )
static

Allocate the argument vector.

static void alloc_infile ( )
static

Allocate space for an input file in infiles.

static void alloc_switch ( )
static

Allocate space for a switch in switches.

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.

static int check_live_switch ( int  ,
int   
)
static

Referenced by handle_spec_function().

static int check_live_switch ( )
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.

 If we already processed this switch and determined if it was
 live or not, return our past determination.   
 In the common case of {<at-most-one-letter>*}, a negating
 switch would always match, so ignore that case.  We will just
 send the conflicting switches to the compiler phase.   
 Now search for duplicate in a manner that depends on the name.   
         We have Xno-YYY, search for XYYY.   
               &ndash;specs are validated with the validate_switches mechanism.   
         We have XYYY, search for Xno-YYY.   
               &ndash;specs are validated with the validate_switches mechanism.   
 Otherwise the switch is live.   
static void clear_args ( )
static

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

static void clear_failure_queue ( void  )
static
static const char * compare_debug_auxbase_opt_spec_function ( int  arg,
const char **  argv 
)
static

%:compare-debug-auxbase-opt spec function. Expands to the auxbase options that are to be passed in the second compilation of compare-debug. It expects, as an argument, the basename of the current input file name, with the .gk suffix appended to it.

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.

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.

static int compare_files ( )
static

Compare the contents of the two files named CMPFILE[0] and CMPFILE[1]. Return zero if they're identical, nonzero otherwise.

References compare_debug, do_self_spec(), n_switches, n_switches_alloc, save_temps_flag, SAVE_TEMPS_NONE, and switches.

static int compare_version_strings ( )
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))*

static bool compile_input_file_p ( )
static

True if we should compile INFILE.

References alloca.

static char* convert_white_space ( char *  )
static
static char* convert_white_space ( )
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 '') 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 '' to '\' + ''. 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.

static void create_at_file ( )
static

Create a temporary FILE with the contents of ARGV. Add to the argument list.

References NULL.

static int default_arg ( const char *  ,
int   
)
static
static int default_arg ( )
static
static void delete_failure_queue ( )
static

Delete all the files to be deleted on error.

static void delete_if_ordinary ( const char *  )
static
static void delete_if_ordinary ( )
static
static void delete_temp_files ( void  )
static
static void display_help ( )
static
static void do_option_spec ( const char *  ,
const char *   
)
static
static void do_option_spec ( )
static

Process the given spec string and add any new options to the end of the switches/n_switches array.

Compute the size of the final spec.

 Replace each %(VALUE) by the specified value.   
static void do_self_spec ( const char *  )
static

Referenced by compare_files().

static void do_self_spec ( )
static

Process the given spec string and add any new options to the end of the switches/n_switches array.

 Mark %<S switches processed by do_self_spec to be ignored permanently.
 do_self_specs adds the replacements to switches array, so it shouldn't
 be processed afterwards.   
     Create a copy of argbuf with a dummy argv[0] entry for
     decode_cmdline_options_to_array.   
             Specs should only generate options, not input
             files.   
             Avoid duplicate processing of some options from
             compare-debug specs; just save them here.   

References spec_path_info::append_len, for_each_path(), spec_path_info::omit_relative, spec_path_info::option, spec_path_info::separate_options, and spec_path().

int do_spec ( )

Process the spec SPEC and run the commands specified therein. Returns 0 if the spec is successfully processed; -1 if failed.

Force out any unfinished command. If -pipe, this forces out the last command if it ended in `|'.

References end_going_arg().

static int do_spec_1 ( const char *  ,
int  ,
const char *   
)
static
static int do_spec_1 ( )
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.

 If it's an empty string argument to a switch, keep it as is.   
   If substituting a switch, treat all chars like letters.
   Otherwise, NL, SPC, TAB and % are special.   
           A `|' before the newline means use a pipe here,
           but only if -pipe was specified.
           Otherwise, execute now and don't pass the `|' as an arg.   
       Reinitialize for a new command, and for a new argument.   
       Use pipe  
       Reinitialize for a new argument.   
         Dump out the directories specified with LIBRARY_PATH,
         followed by the absolute directories
         that we search for startfiles.   
           %efoo means report an error with `foo' as error message
           and don't execute any more commands for this file.   
           %nfoo means report a notice with `foo' on stderr.   
             If save_temps_flag is off, and the HOST_BIT_BUCKET is
             defined, and it is not a directory, and it is
             writable, use it.  Otherwise, treat this like any
             other temporary file.   
               consume suffix  
               consume suffix  
                   We don't support extra suffix characters after %O.   
               If -save-temps=obj and -o were specified, use that for the
               temp file.   
               If the gcc_input_filename has the same suffix specified
               for the %g, %u, or %U, and -save-temps is specified,
               we could end up using that file as an intermediate
               thus clobbering the user's source file (.e.g.,
               gcc -save-temps foo.s would clobber foo.s with the
               output of cpp0).  So check for this condition and
               generate a temp file as the intermediate.   
                       Note, set_input() resets input_stat_set to 0.   
                       If we have the stat for the gcc_input_filename
                       and we can do the stat for the temp_filename
                       then the they could still refer to the same
                       file if st_dev/st_ino's are the same.   
               See if we already have an association of %g/%u/%U and
               suffix.   
               Make a new association if needed.  %u and %j
               require one.   
                   We are going to expand `%i' to `@FILE', where FILE
                   is a newly-created temporary filename.  The filenames
                   that would usually be expanded in place of %o will be
                   written to the temporary file.   
                   Copy the strings over.   
                 Make this a separate argument.   
                 Make this a separate argument.   
                 Make this a separate argument.   
                 Make this a separate argument.   
                 We are going to expand `%o' to `@FILE', where FILE
                 is a newly-created temporary filename.  The filenames
                 that would usually be expanded in place of %o will be
                 written to the temporary file.   
                 Convert OUTFILES into a form suitable for writeargv.   
                 Determine how many are non-NULL.   
                 Copy the strings over.   
             Handle the {...} following the %W.   
             If any args were output, mark the last one for deletion
             on failure.   
         %x{OPTION} records OPTION for %X to output.   
             Skip past the option value and make a copy.   
             See if we already recorded this option.   
             This option is new; add it.   
         Dump out the options accumulated previously using %x.   
         Dump out the options accumulated previously using -Wa,.   
         Dump out the options accumulated previously using -Wp,.   
           Here are digits and numbers that just process
           a certain constant string as a spec.   
           We assume there is a directory
           separator at the end of this string.   
           Here we define characters other than letters and digits.   
          Henceforth ignore the option(s) matching the pattern
          after the %<.   
                   User switch be validated from validate_all_switches.
                   when the definition is seen from the spec file.
                   If not defined anywhere, will be rejected.   
             Catch the case where a spec string contains something like
             '%{foo:%*}'.  i.e. there is no * in the pattern on the left
             hand side of the :.   
           Process a string found as the value of a spec given by name.
           This feature allows individual machine descriptions
           to add and use their own specs.   
             The string after the S/P is the name of a spec that is to be
             processed.   
             See if it's in the list.   
             Discard the closing paren.   
       Backslash: treat next character as ordinary.   
       Fall through.   
       Ordinary character: put it into the current argument.   
 End of string.  If we are processing a spec function, we need to
 end any pending argument.   

References obstack, and save_string().

static int do_spec_2 ( const char *  )
static
static int do_spec_2 ( )
static
static void do_specs_vec ( )
static

Process each member of VEC as a spec.

Make each accumulated option a separate argument.

References input_stat.

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 
)
static

Handle a driver option; arguments and return value as for handle_option.

     CPP driver cannot obtain switch from cc1_options.   
     CPP driver cannot obtain switch from cc1_options.   
     CPP driver cannot obtain switch from cc1_options.   
     These options set the variables specified in common.opt
     automatically, and do not need to be saved for spec
     processing.   
       Pass the rest of this option to the assembler.   
       Split the argument at commas.   
       Record the part after the last comma.   
       Pass the rest of this option to the preprocessor.   
       Split the argument at commas.   
       Record the part after the last comma.   
       Split the argument at commas.   
       Record the part after the last comma.   
     POSIX allows separation of -l and the lib arg; canonicalize
     by concatenating -l with its arg  
     Similarly, canonicalize -L for linkers that may not accept
     separate arguments.   
     Likewise -F.   
     Already handled as a special case, so ignored here.   
     These options set the variables specified in common.opt
     automatically, but do need to be saved for spec
     processing.   
     "-###"
     This is similar to -v except that there is no execution
     of the commands and the echoed arguments are quoted.  It
     is intended for use in shell scripts to capture the
     driver-generated command line.   
       Catch the case where the user has forgotten to append a
       directory separator to the path.  Note, they may be using
       -B to add an executable name prefix, eg "i386-elf-", in
       order to distinguish between multiple installations of
       GCC in the same directory.  Hence we must check to see
       if appending a directory separator actually makes a
       valid directory name.   
       Suppress the warning if -xnone comes after the last input
       file, because alternate command interfaces like g++ might
       find it useful to place -xnone after each input file.   
     Save the output name in case -save-temps=obj was used.   
     On some systems, ld cannot handle "-o" without a space.  So
     split the option from its argument.   
     These are always valid, since gcc.c itself understands the
     first two, gfortranspec.c understands -static-libgfortran and
     g++spec.c understands -static-libstdc++  
     Various driver options need no special processing at this
     point, having been handled in a prescan above or being
     handled by specs.   
static bool driver_unknown_option_callback ( )
static

Handle an option DECODED that is unknown to the option-processing machinery.

Leave unknown -Wno-* options for the compiler proper, to be diagnosed only if there are warnings.

     Give it a chance to define it a a spec file.   
static void driver_wrong_lang_callback ( const struct cl_decoded_option decoded,
unsigned int  lang_mask 
)
static

Handle an option DECODED that is not marked as CL_DRIVER. LANG_MASK will always be CL_DRIVER.

At this point, non-driver options are accepted (and expected to be passed down by specs) unless marked to be rejected by the driver. Options to be rejected by the driver but accepted by the compilers proper are treated just like completely unknown options.

static void end_going_arg ( )
static

If there is an argument being accumulated, terminate it and store it.

Script was not found on search path.

Referenced by do_spec().

static const char* eval_spec_function ( const char *  ,
const char *   
)
static
static const char* eval_spec_function ( )
static

Evaluate a spec function.

 Saved spec processing context.   
 Push the spec processing context.   
 If we have some object growing now, finalize it so the args and function
 eval proceed from a cleared context.  This is needed to prevent the first
 constructed arg from mistakenly including the growing value.  We'll push
 this value back on the obstack once the function evaluation is done, to
 restore a consistent processing context for our caller.  This is fine as
 the address of growing objects isn't guaranteed to remain stable until
 they are finalized, and we expect this situation to be rare enough for
 the extra copy not to be an issue.   
 Create a new spec processing context, and build the function
 arguments.   
 argbuf_index is an index for the next argument to be inserted, and
 so contains the count of the args already inserted.   
 Pop the spec processing context.   
static int execute ( )
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.

 Count # of piped commands.   
 Get storage for each command.   
 Split argbuf into its separate piped processes,
 and record info about each one.
 Also search for the programs that are to be run.   
 If -v, print what we are about to do, and maybe query.   
     For help listings, put a blank line between sub-processes.   
     Print each piped command as a separate line.   
                 If it's empty, print "".   
             If it's empty, print "".   
         Print a pipe symbol after all but the last command.   
         verbose_only_flag should act as if the spec was
         executed, so increment execution_count before
         returning.  This prevents spurious warnings about
         unused linker input files, etc.   
 Run each piped subprocess.   
 Wait for all the subprocesses to finish.   

References errno.

Referenced by uncprop_dom_walker::before_dom_children(), compute_ld_motion_mems(), cse_change_cc_mode_insns(), delete_points_to_sets(), delete_redundant_insns_1(), diagnose_tm_blocks(), eliminate_const_or_copy(), execute_build_cfg(), free_inline_summary(), gate_dce(), gate_pass_return_slot(), gate_tracer(), gate_tree_complete_unroll(), gate_vect_slp(), instantiate_decls_1(), invalidate_any_buried_refs(), make_pass_tm_mark(), move_deaths(), one_cprop_pass(), remove_cgraph_callee_edges(), rest_of_handle_initialize_regs(), rest_of_handle_ud_dce(), run_word_dce(), and tree_call_cdce().

static void fatal_signal ( int  )
static
static void fatal_signal ( )
static

On fatal signals, delete all the temporary files.

Get the same signal again, this time not handled, so its normal effect occurs.

References user_specs::filename, find_a_file(), R_OK, and read_specs().

static void* file_at_path ( )
static

Some systems have a suffix for executable files. So try appending that first.

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.

Determine the filename to execute (special case for absolute paths).

static const char* find_file ( const char *  )
static
static const char* find_file ( )
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.

static const char* find_file_spec_function ( int  ,
const char **   
)
static
static const char* find_file_spec_function ( )
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.

static const char* find_plugindir_spec_function ( int  ,
const char **   
)
static
static const char* find_plugindir_spec_function ( )
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.

static void* for_each_path ( const struct path_prefix paths,
bool  do_multi,
size_t  extra_space,
void *(*)(char *, void *)  callback,
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.

         Look first in MACHINE/VERSION subdirectory.   
         Some paths are tried with just the machine (ie. target)
         subdir.  This is used for finding as, ld, etc.   
         Now try the multiarch path.   
         Now try the base path.   
     Run through the paths again, this time without multilibs.
     Don't repeat any we have already seen.   

References add_to_obstack_info::check_dir, add_to_obstack_info::first_time, is_directory(), NULL, add_to_obstack_info::ob, and PATH_SEPARATOR.

Referenced by do_self_spec().

static unsigned HOST_WIDE_INT get_random_number ( )
static

Get a random number for -frandom-seed

Get some more or less random data.

static const char* getenv_spec_function ( int  ,
const char **   
)
static
static const char* getenv_spec_function ( )
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 environment variable is not defined, a fatal error is issued.

We have to escape every character of the environment variable so they are not interpreted as active spec characters. A particularly painful case is when we are reading a variable holding a windows path complete with \ separators.

References NULL.

static void give_switch ( int  ,
int   
)
static

Referenced by handle_spec_function().

static void give_switch ( )
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.

static const char* handle_braces ( const char *  )
static
static const char* handle_braces ( )
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.

     Scan one "atom" (S in the description above of %{}, possibly
     with '!', '.', '@', ',', or '*' modifiers).   
         Substitute the switch(es) indicated by the current atom.   
         Substitute some text if the current atom appears as a switch
         or suffix.   
             An empty term may appear as the last choice of an
             N-way choice set; it means "otherwise".   
             Don't bother testing this atom if we already have a
             match.   
                   a_matched is already set by handle_spec_function.   
             Found the body, that is, the text to substitute if the
             current disjunction matches.   
             If we have an N-way choice, reset state for the next
             disjunction.   

References find_a_file(), spec_function::name, and R_OK.

static const char* handle_spec_function ( const char *  ,
bool  
)
static
static const char* handle_spec_function ( )
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.

 Get the function name.   
     Only allow [A-Za-z0-9], -, and _ in function names.   
 Get the arguments.   
     (  
 (  
 p now points to just past the end of the spec function expression.   

References check_live_switch(), do_spec_1(), give_switch(), n_switches, and NULL.

static const char* if_exists_else_spec_function ( int  ,
const char **   
)
static
static const char* if_exists_else_spec_function ( )
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.

Must have exactly two arguments.

static const char* if_exists_spec_function ( int  ,
const char **   
)
static
static const char* if_exists_spec_function ( )
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).

Must have only one argument.

static const char* include_spec_function ( int  ,
const char **   
)
static
static const char* include_spec_function ( )
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.

static void init_spec ( )
static

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

Referenced by display_help().

static bool input_spec_matches ( )
static

Subroutine of handle_braces. Returns true if the current input file's spec name matches the atom bracketed by ATOM and END_ATOM.

static bool input_suffix_matches ( const char *  ,
const char *   
)
inlinestatic
static bool input_suffix_matches ( )
inlinestatic

Inline subroutine of handle_braces. Returns true if the current input suffix matches the atom bracketed by ATOM and END_ATOM.

References n_switches.

static void insert_wrapper ( const char *  )
static
static void insert_wrapper ( )
static

Parse the WRAPPER string which is a comma separated list of the command line and insert them into the beginning of argbuf.

static int is_directory ( const char *  ,
bool   
)
static

Referenced by for_each_path().

static int is_directory ( )
static

Determine whether a directory exists. If LINKER, return 0 for certain fixed names not needed by the linker.

Ensure the string ends with "/.". The resulting path will be a directory even if the given path is a symbolic link.

 Exclude directories that the linker is known to search.   

References link_spec, obstack, and set_spec().

static char* load_specs ( const char *  )
static
static char* load_specs ( )
static

Load specs from a file name named FILENAME, replacing occurrences of various different types of line-endings,
,
and just , with a single
.

Open and stat the file.

 Read contents of file into BUFFER.   

References fatal_error(), fnotice(), spec_list::name, spec_list::name_len, spec_list::next, and sl.

static struct compiler* lookup_compiler ( const char *  ,
size_t  ,
const char *   
)
staticread
static struct compiler* lookup_compiler ( )
staticread

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.

 If this was specified by the user to be a linker input, indicate that.   
 Otherwise, look for the language, if one is spec'd.   
 Look for a suffix.   
             See if the suffix matches the end of NAME.   
       A non-alias entry: return it.   
     An alias entry maps a suffix to a language.
     Search for the language; pass 0 for NAME and LENGTH
     to avoid infinite recursion if language not found.   
static struct spec_function* lookup_spec_function ( const char *  )
staticread
static struct spec_function* lookup_spec_function ( )
staticread

Look up a spec function.

int main ( int  ,
char **   
)
int main ( )
 Determine if any expansions were made.   
 Register the language-independent parameters.   
 Unlock the stdio streams.   
 Parsing and gimplification sometimes need quite large stack.
 Increase stack size limits if possible.   
 Allocate the argument vector.   
 Build multilib_select, et. al from the separate lines that make up each
 multilib selection.   
 Make a table of what switches there are (switches, n_switches).
 Make a table of specified input files (infiles, n_infiles).
 Decode switches that are handled locally.   
 Initialize the vector of specs to just the default.
 This means one element containing 0s, as a terminator.   
 Read specs from a file if there is one.   
 Read the specs file unless it is a default one.   
 We need to check standard_exec_prefix/just_machine_suffix/specs
 for any override of as, ld and libraries.   
 Process any configure-time defaults specified for the command line
 options, via OPTION_DEFAULT_SPECS.   
 Process DRIVER_SELF_SPECS, adding any new options to the end
 of the command line.   
 If not cross-compiling, look for executables in the standard
 places.   
 Process sysroot_suffix_spec.   
 Process sysroot_hdrs_suffix_spec.   
 Look for startfiles in the standard places.   
 We should eventually get rid of all these and stick to
 startfile_prefix_spec exclusively.   
     If standard_startfile_prefix is relative, base it on
     standard_exec_prefix.  This lets us move the installed tree
     as a unit.  If GCC_EXEC_PREFIX is defined, base
     standard_startfile_prefix on that as well.

     If the prefix is relative, only search it for native compilers;
     otherwise we will search a directory containing host libraries.   
     Sysrooted prefixes are relocated because target_system_root is
     also relocated by gcc_exec_prefix.   
 Process any user specified specs in the order given on the command
 line.   
 Process any user self specs.   
     Avoid crash when computing %j in this early.   
 If we have a GCC_EXEC_PREFIX envvar, modify it for cpp's sake.   
 Now we have the specs.
 Set the `valid' bits for switches that match anything in any spec.   
 Now that we have the switches and the specs, set
 the subdirectory based on the options.   
 Set up to remember the pathname of gcc and any options
 needed for collect.  We use argv[0] instead of progname because
 we need the complete pathname.   
 Set up to remember the pathname of the lto wrapper.  
 Reject switches that no pass was interested in.   
 Obey some of the options.   
       The error status indicates that only one set of fixed
       headers should be built.   
     We do not exit here.  Instead we have created a fake input file
     called 'help-dummy' which needs to be compiled, and we pass this
     on the various sub-processes, along with the &ndash;help switch.
     Ensure their output appears after ours.   
     We do not exit here. We use the same mechanism of &ndash;help to print
     the version of the sub-processes.  
     compiler_version is truncated at the first space when initialized
     from version string, so truncate version_string at the first space
     before comparing.   
 Make a place to record the compiler output file names
 that correspond to the input files.   
 Record which files were specified explicitly as link input.   
         Since there is no compiler for this input file, assume it is a
         linker file.   
     Tell do_spec what to substitute for %i.   
     Use the same thing in %o, unless cp->spec says otherwise.   
     Figure out which compiler from the file's suffix.   
         Ok, we found an applicable compiler.  Run its spec.   
     If this file's name does not contain a recognized suffix,
     record it as explicit linker input.   
     Clear the delete-on-failure queue, deleting the files in it
     if this compilation failed.   
     If this compilation succeeded, don't delete those files later.   
 Reset the input file name to the first compile/object file name, for use
 with %b in LINK_SPEC. We use the first input file that we can find
 a compiler to compile it instead of using infiles.language since for
 languages other than C we use aliases that we then lookup later.   
     Make sure INPUT_FILE_NUMBER points to first available open
     slot.   
 Determine if there are any linker input files.   
 Run ld to link all the compiler output files.   
         We'll use ld if we can't find collect2.   
     Rebuild the COMPILER_PATH and LIBRARY_PATH environment variables
     for collect.   
 If options said don't run linker,
 complain about input files to be given to the linker.   
 Delete some or all of the temporary files we made.   

References print_multilib_info().

static void mark_matching_switches ( const char *  ,
const char *  ,
int   
)
inlinestatic
static void mark_matching_switches ( )
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 CONST_CAST, do_spec_1(), and NULL.

static const char* pass_through_libs_spec_func ( int  ,
const char **   
)
static
const char* pass_through_libs_spec_func ( )

%: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.

 Shlemiel the painter's algorithm.  Innately horrible, but at least
 we know that there will never be more than a handful of strings to
 concat, and it's only once per run, so it's not worth optimising.   
     Anything that isn't an option is a full path to an output
     file; pass it through if it ends in '.a'.  Among options,
     pass only -l.   
         Handle both joined and non-joined -l options.  If for any
         reason there's a trailing -l with no joined or following
         arg just discard it.   
static void perror_with_name ( const char *  )
static
static void perror_with_name ( )
static
void pfatal_with_name ( )

References NULL.

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.

static void print_multilib_info ( )
static

Print out the multiple library subdirectory selection information. This prints out a series of lines. Each line looks like SUBDIRECTORY;, 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.

     Ignore newlines.   
     Get the initial path.   
     When &ndash;disable-multilib was used but target defines
     MULTILIB_OSDIRNAMES, entries starting with .: (and not starting
     with .:: for multiarch configurations) are there just to find
     multilib_os_dir, so skip them from output.   
     Check for matches with the multilib_exclusions. We don't bother
     with the '!' in either list. If any of the exclusion rules match
     all of its options with the select rule, we skip it.   
           Ignore newlines.   
           Check the arguments.   
         If this is a duplicate, skip it.   
     If this directory requires any default arguments, we can skip
     it.  We will already have printed a directory identical to
     this one which does not require that default argument.   
         If there are extra options, print them now.   

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

Referenced by main().

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.

 Locate the closing } or ;, honoring nested braces.
 Trim trailing whitespace.   
     Copy the substitution body to permanent storage and execute it.
     If have_subst is false, this is a simple matter of running the
     body through do_spec_1...   
         ... but if have_subst is true, we have to process the
         body once for each matching switch, with %* set to the
         variant part of the switch.   
               Pass any arguments this switch has.   
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'.

 Figure compiler version from version string.   
 Handle any -no-canonical-prefixes flag early, to assign the function
 that builds relative prefixes.  This function creates default search
 paths that are needed later in normal option handling.   
 Set up the default search paths.  If there is no GCC_EXEC_PREFIX,
 see if we can create it from the pathname specified in
 decoded_options[0].arg.   
 FIXME: make_relative_prefix doesn't yet work for VMS.   
     make_relative_prefix requires a program name, but
     GCC_EXEC_PREFIX is typically a directory name with a trailing
     / (which is ignored by make_relative_prefix), so append a
     program name.   
     The path is unrelocated, so fallback to the original setting.   
 From this point onward, gcc_exec_prefix is non-null if the toolchain
 is relocated. The toolchain was either relocated using GCC_EXEC_PREFIX
 or an automatically created GCC_EXEC_PREFIX from
 decoded_options[0].arg.   
 Do language-specific adjustment/addition of flags.   
 COMPILER_PATH and LIBRARY_PATH have values
 that are lists of directory names with colons.   
 Use LPATH like LIBRARY_PATH (for the CMU build program).   
 Process the options and store input files and switches in their
 vectors.   
         For LTO static archive support we handle input file
         specifications that are composed of a filename and
         an offset like FNAME@OFFSET.   
             Only accept non-stdin and existing FNAME parts, otherwise
             try with the full name.   
 If -save-temps=obj and -o name, create the prefix to use for %b.
 Otherwise just make -save-temps=obj the same as -save-temps=cwd.   
     -save-temps overrides -pipe, so that temp files are produced  
 Set up the search paths.  We add directories that we expect to
 contain GNU Toolchain components before directories specified by
 the machine description so that we will find GNU components (like
 the GNU assembler) before those of the host system.   
 If we don't know where the toolchain has been installed, use the
 configured-in locations.   
 Look for tools relative to the location from which the driver is
 running, or, if that is not available, the configured prefix.   
 More prefixes are enabled in main, after we read the specs file
 and determine whether this is cross-compilation or not.   
 Synthesize -fcompare-debug flag from the GCC_COMPARE_DEBUG
 environment variable.   
 Ensure we only invoke each subprocess once.   
     Create a dummy input file, so that we can pass
     the help option on to the various sub-processes.   

References F_OK.

static void process_marked_switches ( )
inlinestatic

Inline subroutine of handle_braces. Process all the currently marked switches through give_switch, and clear the marks.

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.

static void read_specs ( const char *  ,
bool  ,
bool   
)
static
static void read_specs ( )
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.

 Scan BUFFER for specs, putting them in the vector.   
     Advance P in BUFFER to the next nonblank nocomment line.   
     Is this a special command that starts with '%'?  
     Don't allow this for the main specs file, since it would
     encourage people to overwrite it.   
         Skip '\n'.   
             Get original name.   
             Get new spec name.   
     Find the colon that should end the suffix.   
     The colon shouldn't be missing.   
     Skip back over trailing whitespace.   
     Copy the suffix to a string.   
     Find the next line.   
     Find next blank line or end of string.   
     Specs end at the blank line and do not include the newline.   
     Delete backslash-newline sequences from the spec.   
         Add this pair to the vector.   
void record_temp_file ( )

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 prefix_list::os_multilib, prefix_list::prefix, and prefix_list::require_machine_suffix.

Referenced by set_spec().

static const char* remove_outfile_spec_function ( int  ,
const char **   
)
static
static const char* remove_outfile_spec_function ( )
static

remove-outfile built-in spec function.

This looks for the first argument in the outfiles array's name and removes it.

Must have exactly one argument.

static const char* replace_extension_spec_func ( int  ,
const char **   
)
static
const char* replace_extension_spec_func ( )

%:replace-extension spec function. Replaces the extension of the first argument with the second argument.

static const char* replace_outfile_spec_function ( int  ,
const char **   
)
static
static const char* replace_outfile_spec_function ( )
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.

Must have exactly two arguments.

static const char* sanitize_spec_function ( int  ,
const char **   
)
static
static const char* sanitize_spec_function ( )
static

sanitize built-in spec function.

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

static char* save_string ( const char *  ,
int   
)
static

Referenced by do_spec_1().

static char* save_string ( )
static
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 add_assembler_option().

static void set_collect_gcc_options ( )
static

Store switches not filtered out by %<S in spec in COLLECT_GCC_OPTIONS and place that in the environment.

Build COLLECT_GCC_OPTIONS to have all of the options specified to the compiler.

     Ignore elided switches.   
void set_input ( )

Set up the various global variables to indicate that we're processing the input file named FILENAME.

Find a suffix starting with the last period, and set basename_length to exclude that suffix.

 If a spec for 'g', 'u', or 'U' is seen with -save-temps then
 we will need to do a stat on the gcc_input_filename.  The
 INPUT_STAT_SET signals that the stat is needed.   
static void set_multilib_dir ( )
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.

     Ignore newlines.   
     Check the arguments.   
 Append multilib reuse rules if any.  With those rules, we can reuse
 one multilib for certain different options sets.   
     Ignore newlines.   
     Get the initial path.   
     Check the arguments.   
         If this is a default argument, we can just ignore it.
         This is true even if this_arg begins with '!'.  Beginning
         with '!' does not mean that this argument is necessarily
         inappropriate for this library: it merely means that
         there is a more specific library which uses this
         argument.  If this argument is a default, we need not
         consider that more specific library.   

References FALSE.

static void set_option_handlers ( )
static

Put the driver's standard set of option handlers in *HANDLERS.

References cl_decoded_option::arg, F_OK, and offset.

static void set_spec ( const char *  ,
const char *  ,
bool   
)
static

Referenced by is_directory().

static void set_spec ( )
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.

 If this is the first call, initialize the statically allocated specs.   
 See if the spec already exists.   
     Not found - make it.   
 Free the old spec.   

References record_temp_file().

static char* skip_whitespace ( char *  )
static
static char* skip_whitespace ( )
static

A fully-blank line is a delimiter in the SPEC file and shouldn't be considered whitespace.

static void* spec_path ( )
static

Must not damage the original path.

Referenced by do_self_spec().

static void store_arg ( const char *  ,
int  ,
int   
)
static
static void store_arg ( )
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.

If the temporary file we should delete is specified as part of a joined argument extract the filename.

static bool switch_matches ( const char *  ,
const char *  ,
int   
)
inlinestatic
static bool switch_matches ( )
static

Subroutine of handle_braces. Returns true if a switch matching the atom bracketed by ATOM and END_ATOM appeared on the command line.

Check if a switch with separated form matching the atom. We check -D and -U switches.

static int used_arg ( const char *  ,
int   
)
static
static int used_arg ( )
static

Check whether a particular argument was used. The first time we canonicalize the switches to keep only the ones we care about.

     Break multilib_matches into the component strings of string
     and replacement string.   
     Now build a list of the replacement string for switches that we care
     about.  Make sure we allocate at least one entry.  This prevents
     xmalloc from calling fatal, and prevents us from re-executing this
     block of code.   
     Add MULTILIB_DEFAULTS switches too, as long as they were not present
     on the command line nor any options mutually incompatible with
     them.   
static void validate_all_switches ( void  )
static

Look through the linked list of specs read from the specs file.

static const char* validate_switches ( const char *  ,
bool   
)
static
static const char* validate_switches ( )
static

Look at the switch-name that comes after START and mark as valid all supplied switches that match it.

Mark all matching switches as valid.

References CONST_CAST, and NULL.

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

We have a switch spec.

static const char* version_compare_spec_function ( int  ,
const char **   
)
static
static const char* version_compare_spec_function ( )
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.

static void xputenv ( const char *  )
static
static void xputenv ( )
static

Add or change the value of an environment variable, outputting the change to standard error if in verbose mode.


Variable Documentation

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.

struct temp_file* always_delete_queue
static

Queue of files to delete on success or failure of compilation.

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).

vec<const_char_p> argbuf
static

Vector of pointers to arguments in the current line of specifications.

const char* asm_debug = ASM_DEBUG_SPEC
static
const char* asm_final_spec = ASM_FINAL_SPEC
static
const char* asm_options = "%a %Y %{c:%W{o*}%{!o*:-o %w%b%O}}%{!c:-o %d%w%u%O}"
static
const char* asm_spec = ASM_SPEC
static
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.

bool at_file_supplied
static
int basename_length
static
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} %{!dumpbase:-dumpbase %B} %{d*} %{m*} %{aux-info*}\
%{fcompare-debug-second:%:compare-debug-auxbase-opt(%b)} \
%{!fcompare-debug-second:%{c|S:%{o*:-auxbase-strip %*}%{!o*:-auxbase %b}}}%{!c:%{!S:-auxbase %b}} \
%{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 %b.s}}}\
%{fsyntax-only:-o %j} %{-param*}\
%{coverage:-fprofile-arcs -ftest-coverage}"

NB: This is shared amongst all front-ends, except for Ada.

const char* cc1_spec = CC1_SPEC
static
const char* cc1plus_spec = CC1PLUS_SPEC
static
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.

bool combine_inputs
static

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

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_files().

const char* compare_debug_opt

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

int compare_debug_second

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

const char* compiler_version
static

The compiler version.

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.

const char* cpp_debug_options = "%{d*}"
static

This contains cpp options which are not passed when the preprocessor output will be used by another program.

const char* cpp_options
static
Initial value:
"%(cpp_unique_options) %1 %{m*} %{std*&ansi&trigraphs} %{W*&pedantic*} %{w}\
%{f*} %{g*:%{!g0:%{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 remove_duplicates().

const char* cpp_spec = CPP_SPEC
static
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*}\
%{!E:%{!M:%{!MM:%{!MT:%{!MQ:%{MD|MMD:%{o*:-MQ %*}}}}}}}\
%{remap} %{g3|ggdb3|gstabs3|gcoff3|gxcoff3|gvms3:-dD}\
%{!iplugindir*:%{fplugin*:%:find-plugindir()}}\
%{H} %C %{D*&U*&A*} %{i*} %Z %i\
%{E|M|MM:%W{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.

const char* cross_compile = "0"
static

Nonzero if cross-compiling. When -b is used, the value comes from the `specs' file.

const char* debug_auxbase_opt
static
char* debug_check_temp_file[2]
static
struct compiler default_compilers[]
static

The default list of file name suffixes and their compilation specs.

int delete_this_arg
static

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

const char dir_separator_str[] = { DIR_SEPARATOR, 0 }
static
const char* const driver_self_specs[]
static
Initial value:
{
"%{fdump-final-insns:-fdump-final-insns=.} %<fdump-final-insns",
}
const char* endfile_spec = ENDFILE_SPEC
static
struct path_prefix exec_prefixes = { 0, 0, "exec" }
static

List of prefixes to try when looking for executables.

int execution_count
static

Number of commands executed so far.

struct temp_file* failure_delete_queue
static

Queue of files to delete on failure of compilation.

const char* gcc_exec_prefix
static

Adjusted value of GCC_EXEC_PREFIX envvar.

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.

const char* gcc_libexec_prefix
static

Adjusted value of standard_libexec_prefix.

int greatest_status = 1
static

Greatest exit code of sub-processes that has been encountered up to now.

int have_c = 0
static

Were the options -c, -S or -E passed.

int have_o = 0
static

Was the option -o passed.

int have_o_argbuf_index = 0
static

Position in the argbuf vector containing the name of the output file (the value associated with the "-o" flag).

struct path_prefix include_prefixes = { 0, 0, "include" }
static

List of prefixes to try when looking for include files.

struct infile* infiles
static

Also a vector of input files specified.

const char* input_basename
static
struct compiler* input_file_compiler
static

The compiler used to process the current input file.

int input_file_number
static
size_t input_filename_length
int input_from_pipe
static

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

struct stat input_stat
static

Referenced by do_specs_vec().

int input_stat_set
static
const char* input_suffix
static
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 }\
}"
int is_cpp_driver

Flag set by cppspec.c to 1.

Referenced by display_help().

const char* just_machine_suffix = 0
static

Suffix to attach to directories searched for commands. This is just `MACHINE/'.

Referenced by delete_temp_files().

int last_language_n_infiles
static
const char* lib_spec = LIB_SPEC
static
const char* libgcc_spec = LIBGCC_SPEC
static
const char* link_command_spec = LINK_COMMAND_SPEC
static

Referenced by display_help().

const char* link_gcc_c_sequence_spec = LINK_GCC_C_SEQUENCE_SPEC
static
const char* link_gomp_spec = ""
static
const char* link_libgcc_spec = LINK_LIBGCC_SPEC
static
const char* link_spec = LINK_SPEC
static

Referenced by is_directory().

const char* link_ssp_spec = LINK_SSP_SPEC
static
const char* linker_name_spec = LINKER_NAME
static
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.

const char* linker_plugin_file_spec = ""
static
const char* lto_gcc_spec = ""
static
const char* lto_wrapper_spec = ""
static
const char* machine_suffix = 0
static

Suffix to attach to directories searched for commands. This looks like `MACHINE/VERSION/'.

Referenced by delete_temp_files().

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.

const char* md_startfile_prefix = MD_STARTFILE_PREFIX
static
const char* md_startfile_prefix_1 = MD_STARTFILE_PREFIX_1
static
struct mdswitchstr* mdswitches
static
const char* multiarch_dir
static

Subdirectory to use for locating libraries in multiarch conventions. Set by set_multilib_dir based on the compilation options.

const char* multilib_defaults
static
const char* const multilib_defaults_raw[] = MULTILIB_DEFAULTS
static
const char* multilib_dir
static

Subdirectory to use for locating libraries. Set by set_multilib_dir based on the compilation options.

const char* multilib_exclusions
static
const char* multilib_matches
static
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.

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.

const char* multilib_reuse
static
const char* multilib_select
static
int n_compilers
static

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

const int n_default_compilers = ARRAY_SIZE (default_compilers) - 1
static

Number of elements in default_compilers, not counting the terminator.

int n_infiles
int n_infiles_alloc
static
int n_mdswitches
static
int n_switches
static
int n_switches_alloc
static

Referenced by compare_files().

int n_switches_alloc_debug_check[2]
static
int n_switches_debug_check[2]
static
struct obstack obstack
static

This is the obstack which we use to allocate many strings.

Referenced by do_spec_1(), get_attr_order(), is_directory(), lambda_matrix_row_exchange(), pp_last_position_in_text(), and pretty_printer::pretty_printer().

struct default_spec option_default_specs[] = { OPTION_DEFAULT_SPECS }
static
const char** outfiles

And a vector of corresponding output files is made up later.

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.

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 display_help().

int print_subprocess_help
static

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

Referenced by display_help().

int print_version
static

Flag saying to print the version of gcc and its sub-processes.

Referenced by display_help(), and main().

int processing_spec_function
static
FILE* report_times_to_file = NULL

Whether we should report subprocess execution times to a file.

enum save_temps save_temps_flag
static

Referenced by compare_files().

size_t save_temps_length = 0
static
char* save_temps_prefix = 0
static

Output file to use to get the object directory for -save-temps=obj

const char* self_spec = ""
static
int signal_count
static

Number of commands that exited with a signal.

const char* spec_lang = 0
static
const char* spec_machine = DEFAULT_TARGET_MACHINE
static

The target machine.

Referenced by display_help().

const char* const spec_version = DEFAULT_TARGET_VERSION
static

The target version.

Referenced by display_help().

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

List of dynamically allocates specs that have been defined so far.

const char* const standard_bindir_prefix = STANDARD_BINDIR_PREFIX
static
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.

const char* const standard_libexec_prefix = STANDARD_LIBEXEC_PREFIX
static
const char* const standard_startfile_prefix = STANDARD_STARTFILE_PREFIX
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* startfile_prefix_spec = STARTFILE_PREFIX_SPEC
static
struct path_prefix startfile_prefixes = { 0, 0, "startfile" }
static

List of prefixes to try when looking for startup (crt0) files.

const char* startfile_spec = STARTFILE_SPEC
static
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 },
{ "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 },
{ "compare-debug-auxbase-opt", compare_debug_auxbase_opt_spec_function },
{ "pass-through-libs", pass_through_libs_spec_func },
{ "replace-extension", replace_extension_spec_func },
{ 0, 0 }
}

List of static spec functions.

struct spec_list static_specs[]
static

List of statically defined specs.

const char* suffix_subst
static

Nonnull means substitute this for any suffix when outputting a switches arguments.

int suffixed_basename_length
static
struct switchstr* switches
static

Referenced by compare_files().

struct switchstr* switches_debug_check[2]
static
const char* sysroot_hdrs_suffix_spec = SYSROOT_HEADERS_SUFFIX_SPEC
static
const char* sysroot_spec = SYSROOT_SPEC
static
const char* sysroot_suffix_spec = SYSROOT_SUFFIX_SPEC
static
const char* target_sysroot_hdrs_suffix = 0
static

Nonzero means append this string to target_system_root for headers.

const char* target_sysroot_suffix = 0
static

Nonzero means append this string to target_system_root.

const char* target_system_root = 0
static

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

int target_system_root_changed
static

Nonzero means pass the updated target_system_root to the compiler.

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.

int temp_filename_length
static

Length of the prefix.

struct temp_name * temp_names
static
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.

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.

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.

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.

const char* trad_capable_cpp = "cc1 -E %{traditional|traditional-cpp:-traditional-cpp}"
static

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.

struct user_specs* user_specs_head
static
struct user_specs * user_specs_tail
static
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.