4. If the argument takes an argument, e.g., `--baz argument1',
modify either DEFAULT_SWITCH_TAKES_ARG or
- DEFAULT_WORD_SWITCH_TAKES_ARG in this file. Omit the first `-'
+ DEFAULT_WORD_SWITCH_TAKES_ARG in gcc.h. Omit the first `-'
from `--baz'.
5. Document the option in this file's display_help(). If the
#include "gcc.h"
#include "flags.h"
-#ifdef HAVE_SYS_RESOURCE_H
-#include <sys/resource.h>
-#endif
-#if defined (HAVE_DECL_GETRUSAGE) && !HAVE_DECL_GETRUSAGE
-extern int getrusage (int, struct rusage *);
-#endif
-
/* By default there is no special suffix for target executables. */
/* FIXME: when autoconf is fixed, remove the host check - dj */
#if defined(TARGET_EXECUTABLE_SUFFIX) && defined(HOST_EXECUTABLE_SUFFIX)
static struct obstack collect_obstack;
-/* These structs are used to collect resource usage information for
- subprocesses. */
-#ifdef HAVE_GETRUSAGE
-static struct rusage rus, prus;
-#endif
-
/* Forward declaration for prototypes. */
struct path_prefix;
struct prefix_list;
static void set_multilib_dir (void);
static void print_multilib_info (void);
static void perror_with_name (const char *);
-static void pfatal_pexecute (const char *, const char *) ATTRIBUTE_NORETURN;
static void notice (const char *, ...) ATTRIBUTE_PRINTF_1;
static void display_help (void);
static void add_preprocessor_option (const char *, int);
%l process LINK_SPEC as a spec.
%L process LIB_SPEC as a spec.
%G process LIBGCC_SPEC as a spec.
- %M output multilib_dir with directory separators replaced with "_";
- if multilib_dir is not set or is ".", output "".
+ %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.
#ifndef LIBGCC_SPEC
#if defined(REAL_LIBGCC_SPEC)
#define LIBGCC_SPEC REAL_LIBGCC_SPEC
-#elif defined(LINK_LIBGCC_SPECIAL) || defined(LINK_LIBGCC_SPECIAL_1)
+#elif defined(LINK_LIBGCC_SPECIAL_1)
/* Have gcc do the search for libgcc.a. */
#define LIBGCC_SPEC "libgcc.a%s"
#else
%(linker) %l " LINK_PIE_SPEC "%X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} %{r}\
%{s} %{t} %{u*} %{x} %{z} %{Z} %{!A:%{!nostdlib:%{!nostartfiles:%S}}}\
%{static:} %{L*} %(mfwrap) %(link_libgcc) %o %(mflib)\
- %{fprofile-arcs|fprofile-generate:-lgcov}\
+ %{fprofile-arcs|fprofile-generate|coverage:-lgcov}\
%{!nostdlib:%{!nodefaultlibs:%(link_gcc_c_sequence)}}\
%{!A:%{!nostdlib:%{!nostartfiles:%E}}} %{T*} }}}}}}"
#endif
#ifndef LINK_LIBGCC_SPEC
-# ifdef LINK_LIBGCC_SPECIAL
-/* Don't generate -L options for startfile prefix list. */
-# define LINK_LIBGCC_SPEC ""
-# else
-/* Do generate them. */
-# define LINK_LIBGCC_SPEC "%D"
-# endif
+/* Generate -L options for startfile prefix list. */
+# define LINK_LIBGCC_SPEC "%D"
#endif
#ifndef STARTFILE_PREFIX_SPEC
# define STARTFILE_PREFIX_SPEC ""
#endif
+#ifndef SYSROOT_SPEC
+# define SYSROOT_SPEC "--sysroot=%R"
+#endif
+
#ifndef SYSROOT_SUFFIX_SPEC
# define SYSROOT_SUFFIX_SPEC ""
#endif
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;
%{MMD:-MMD %{!o:%b.d}%{o*:%.d%*}}\
%{M} %{MM} %{MF*} %{MG} %{MP} %{MQ*} %{MT*}\
%{!E:%{!M:%{!MM:%{MD|MMD:%{o*:-MQ %*}}}}}\
- %{trigraphs} %{remap} %{g3:-dD} %{H} %C %{D*&U*&A*} %{i*} %Z %i\
+ %{remap} %{g3:-dD} %{H} %C %{D*&U*&A*} %{i*} %Z %i\
%{fmudflap:-D_MUDFLAP -include mf-runtime.h}\
%{fmudflapth:-D_MUDFLAP -D_MUDFLAPTH -include mf-runtime.h}\
%{E|M|MM:%W{o*}}";
options used to set target flags. Those special target flags settings may
in turn cause preprocessor symbols to be defined specially. */
static const char *cpp_options =
-"%(cpp_unique_options) %1 %{m*} %{std*&ansi} %{W*&pedantic*} %{w} %{f*}\
- %{g*:%{!g0:%{!fno-working-directory:-fworking-directory}}} %{O*} %{undef}\
- %{save-temps:-fpch-preprocess}";
+"%(cpp_unique_options) %1 %{m*} %{std*&ansi&trigraphs} %{W*&pedantic*} %{w}\
+ %{f*} %{g*:%{!g0:%{!fno-working-directory:-fworking-directory}}} %{O*}\
+ %{undef} %{save-temps:-fpch-preprocess}";
/* This contains cpp options which are not passed when the preprocessor
output will be used by another program. */
"%{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\
%1 %{!Q:-quiet} -dumpbase %B %{d*} %{m*} %{a*}\
%{c|S:%{o*:-auxbase-strip %*}%{!o*:-auxbase %b}}%{!c:%{!S:-auxbase %b}}\
- %{g*} %{O*} %{W*&pedantic*} %{w} %{std*&ansi}\
+ %{g*} %{O*} %{W*&pedantic*} %{w} %{std*&ansi&trigraphs}\
%{v:-version} %{pg:-p} %{p} %{f*} %{undef}\
%{Qn:-fno-ident} %{--help:--help}\
%{--target-help:--target-help}\
%{!fsyntax-only:%{S:%W{o*}%{!o*:-o %b.s}}}\
%{fsyntax-only:-o %j} %{-param*}\
- %{fmudflap|fmudflapth:-fno-builtin -fno-merge-constants}";
+ %{fmudflap|fmudflapth:-fno-builtin -fno-merge-constants}\
+ %{coverage:-fprofile-arcs -ftest-coverage}";
static const char *asm_options =
"%a %Y %{c:%W{o*}%{!o*:-o %w%b%O}}%{!c:-o %d%w%u%O}";
cc1 %(cpp_unique_options) %(cc1_options)}}\
%{!fsyntax-only:%(invoke_as)}}}}}}", 0, 1, 1},
{"-",
- "%{!E:%e-E required when input is from standard input}\
+ "%{!E:%e-E or -x required when input is from standard input}\
%(trad_capable_cpp) %(cpp_options) %(cpp_debug_options)", 0, 0, 0},
{".h", "@c-header", 0, 0, 0},
{"@c-header",
{"--for-assembler", "-Wa", "a"},
{"--for-linker", "-Xlinker", "a"},
{"--force-link", "-u", "a"},
+ {"--coverage", "-coverage", 0},
{"--imacros", "-imacros", "a"},
{"--include", "-include", "a"},
{"--include-barrier", "-I-", 0},
INIT_STATIC_SPEC ("md_startfile_prefix", &md_startfile_prefix),
INIT_STATIC_SPEC ("md_startfile_prefix_1", &md_startfile_prefix_1),
INIT_STATIC_SPEC ("startfile_prefix_spec", &startfile_prefix_spec),
+ INIT_STATIC_SPEC ("sysroot_spec", &sysroot_spec),
INIT_STATIC_SPEC ("sysroot_suffix_spec", &sysroot_suffix_spec),
INIT_STATIC_SPEC ("sysroot_hdrs_suffix_spec", &sysroot_hdrs_suffix_spec),
};
if (in_sep && *p == '-' && strncmp (p, "-lgcc", 5) == 0)
{
init_gcc_specs (&obstack,
-#ifdef NO_SHARED_LIBGCC_MULTILIB
"-lgcc_s"
-#else
- "-lgcc_s%M"
-#endif
#ifdef USE_LIBUNWIND_EXCEPTIONS
" -lunwind"
#endif
/* Ug. We don't know shared library extensions. Hope that
systems that use this form don't do shared libraries. */
init_gcc_specs (&obstack,
-#ifdef NO_SHARED_LIBGCC_MULTILIB
- "-lgcc_s"
-#else
- "-lgcc_s%M"
-#endif
- ,
+ "-lgcc_s",
"libgcc.a%s",
"libgcc_eh.a%s"
#ifdef USE_LIBUNWIND_EXCEPTIONS
}
obstack_1grow (&obstack, '\0');
- libgcc_spec = obstack_finish (&obstack);
+ libgcc_spec = XOBFINISH (&obstack, const char *);
}
#endif
#ifdef USE_AS_TRADITIONAL_FORMAT
static const char tf[] = "--traditional-format ";
obstack_grow (&obstack, tf, sizeof(tf) - 1);
obstack_grow0 (&obstack, asm_spec, strlen (asm_spec));
- asm_spec = obstack_finish (&obstack);
+ asm_spec = XOBFINISH (&obstack, const char *);
}
#endif
#ifdef LINK_EH_SPEC
/* Prepend LINK_EH_SPEC to whatever link_spec we had before. */
obstack_grow (&obstack, LINK_EH_SPEC, sizeof(LINK_EH_SPEC) - 1);
obstack_grow0 (&obstack, link_spec, strlen (link_spec));
- link_spec = obstack_finish (&obstack);
+ link_spec = XOBFINISH (&obstack, const char *);
#endif
specs = sl;
}
obstack_1grow (&collect_obstack, '\0');
- return obstack_finish (&collect_obstack);
+ return XOBFINISH (&collect_obstack, char *);
}
/* Rebuild the COMPILER_PATH and LIBRARY_PATH environment variables
int i;
int n_commands; /* # of command. */
char *string;
+ struct pex_obj *pex;
struct command
{
const char *prog; /* program name. */
const char **argv; /* vector of args. */
- int pid; /* pid of process for this command. */
};
struct command *commands; /* each command buffer with above info. */
/* Run each piped subprocess. */
+ pex = pex_init (PEX_USE_PIPES | (report_times ? PEX_RECORD_TIMES : 0),
+ programname, temp_filename);
+ if (pex == NULL)
+ pfatal_with_name (_("pex_init failed"));
+
for (i = 0; i < n_commands; i++)
{
- char *errmsg_fmt, *errmsg_arg;
+ const char *errmsg;
+ int err;
const char *string = commands[i].argv[0];
- /* For some bizarre reason, the second argument of execvp() is
- char *const *, not const char *const *. */
- commands[i].pid = pexecute (string, (char *const *) commands[i].argv,
- programname, temp_filename,
- &errmsg_fmt, &errmsg_arg,
- ((i == 0 ? PEXECUTE_FIRST : 0)
- | (i + 1 == n_commands ? PEXECUTE_LAST : 0)
- | (string == commands[i].prog
- ? PEXECUTE_SEARCH : 0)
- | (verbose_flag ? PEXECUTE_VERBOSE : 0)));
-
- if (commands[i].pid == -1)
- pfatal_pexecute (errmsg_fmt, errmsg_arg);
+ errmsg = pex_run (pex,
+ ((i + 1 == n_commands ? PEX_LAST : 0)
+ | (string == commands[i].prog ? PEX_SEARCH : 0)),
+ string, (char * const *) commands[i].argv,
+ NULL, NULL, &err);
+ if (errmsg != NULL)
+ {
+ if (err == 0)
+ fatal (errmsg);
+ else
+ {
+ errno = err;
+ pfatal_with_name (errmsg);
+ }
+ }
if (string != commands[i].prog)
free ((void *) string);
execution_count++;
- /* Wait for all the subprocesses to finish.
- We don't care what order they finish in;
- we know that N_COMMANDS waits will get them all.
- Ignore subprocesses that we don't know about,
- since they can be spawned by the process that exec'ed us. */
+ /* Wait for all the subprocesses to finish. */
{
+ int *statuses;
+ struct pex_time *times = NULL;
int ret_code = 0;
-#ifdef HAVE_GETRUSAGE
- struct timeval d;
- double ut = 0.0, st = 0.0;
-#endif
- for (i = 0; i < n_commands;)
+ statuses = alloca (n_commands * sizeof (int));
+ if (!pex_get_status (pex, n_commands, statuses))
+ pfatal_with_name (_("failed to get exit status"));
+
+ if (report_times)
{
- int j;
- int status;
- int pid;
+ times = alloca (n_commands * sizeof (struct pex_time));
+ if (!pex_get_times (pex, n_commands, times))
+ pfatal_with_name (_("failed to get process times"));
+ }
- pid = pwait (commands[i].pid, &status, 0);
- gcc_assert (pid >= 0);
+ pex_free (pex);
-#ifdef HAVE_GETRUSAGE
- if (report_times)
- {
- /* getrusage returns the total resource usage of all children
- up to now. Copy the previous values into prus, get the
- current statistics, then take the difference. */
-
- prus = rus;
- getrusage (RUSAGE_CHILDREN, &rus);
- d.tv_sec = rus.ru_utime.tv_sec - prus.ru_utime.tv_sec;
- d.tv_usec = rus.ru_utime.tv_usec - prus.ru_utime.tv_usec;
- ut = (double) d.tv_sec + (double) d.tv_usec / 1.0e6;
-
- d.tv_sec = rus.ru_stime.tv_sec - prus.ru_stime.tv_sec;
- d.tv_usec = rus.ru_stime.tv_usec - prus.ru_stime.tv_usec;
- st = (double) d.tv_sec + (double) d.tv_usec / 1.0e6;
- }
-#endif
+ for (i = 0; i < n_commands; ++i)
+ {
+ int status = statuses[i];
- for (j = 0; j < n_commands; j++)
- if (commands[j].pid == pid)
- {
- i++;
- if (WIFSIGNALED (status))
- {
+ if (WIFSIGNALED (status))
+ {
#ifdef SIGPIPE
- /* SIGPIPE is a special case. It happens in -pipe mode
- when the compiler dies before the preprocessor is
- done, or the assembler dies before the compiler is
- done. There's generally been an error already, and
- this is just fallout. So don't generate another error
- unless we would otherwise have succeeded. */
- if (WTERMSIG (status) == SIGPIPE
- && (signal_count || greatest_status >= MIN_FATAL_STATUS))
- ;
- else
+ /* SIGPIPE is a special case. It happens in -pipe mode
+ when the compiler dies before the preprocessor is done,
+ or the assembler dies before the compiler is done.
+ There's generally been an error already, and this is
+ just fallout. So don't generate another error unless
+ we would otherwise have succeeded. */
+ if (WTERMSIG (status) == SIGPIPE
+ && (signal_count || greatest_status >= MIN_FATAL_STATUS))
+ ;
+ else
#endif
- fatal ("\
+ fatal ("\
Internal error: %s (program %s)\n\
Please submit a full bug report.\n\
See %s for instructions.",
- strsignal (WTERMSIG (status)), commands[j].prog,
- bug_report_url);
- signal_count++;
- ret_code = -1;
- }
- else if (WIFEXITED (status)
- && WEXITSTATUS (status) >= MIN_FATAL_STATUS)
- {
- if (WEXITSTATUS (status) > greatest_status)
- greatest_status = WEXITSTATUS (status);
- ret_code = -1;
- }
-#ifdef HAVE_GETRUSAGE
- if (report_times && ut + st != 0)
- notice ("# %s %.2f %.2f\n", commands[j].prog, ut, st);
-#endif
- break;
- }
+ strsignal (WTERMSIG (status)), commands[i].prog,
+ bug_report_url);
+ signal_count++;
+ ret_code = -1;
+ }
+ else if (WIFEXITED (status)
+ && WEXITSTATUS (status) >= MIN_FATAL_STATUS)
+ {
+ if (WEXITSTATUS (status) > greatest_status)
+ greatest_status = WEXITSTATUS (status);
+ ret_code = -1;
+ }
+
+ if (report_times)
+ {
+ struct pex_time *pt = ×[i];
+ double ut, st;
+
+ ut = ((double) pt->user_seconds
+ + (double) pt->user_microseconds / 1.0e6);
+ st = ((double) pt->system_seconds
+ + (double) pt->system_microseconds / 1.0e6);
+
+ if (ut + st != 0)
+ notice ("# %s %.2f %.2f\n", commands[i].prog, ut, st);
+ }
}
+
return ret_code;
}
}
{
obstack_grow (&obstack, name, len - 2);
obstack_grow0 (&obstack, TARGET_OBJECT_SUFFIX, strlen (TARGET_OBJECT_SUFFIX));
- name = obstack_finish (&obstack);
+ name = XOBFINISH (&obstack, const char *);
}
#endif
obstack_grow (&obstack, name, len);
obstack_grow0 (&obstack, TARGET_EXECUTABLE_SUFFIX,
strlen (TARGET_EXECUTABLE_SUFFIX));
- name = obstack_finish (&obstack);
+ name = XOBFINISH (&obstack, const char *);
#endif
return name;
}
}
- if ((save_temps_flag || report_times) && use_pipes)
+ if (save_temps_flag && use_pipes)
{
/* -save-temps overrides -pipe, so that temp files are produced */
if (save_temps_flag)
error ("warning: -pipe ignored because -save-temps specified");
- /* -time overrides -pipe because we can't get correct stats when
- multiple children are running at once. */
- else if (report_times)
- error ("warning: -pipe ignored because -time specified");
-
use_pipes = 0;
}
infiles[n_infiles].language = "*";
infiles[n_infiles++].name = argv[++i];
}
+ /* Xassembler and Xpreprocessor were already handled in the first argv
+ scan, so all we need to do here is ignore them and their argument. */
else if (strcmp (argv[i], "-Xassembler") == 0)
- {
- infiles[n_infiles].language = "*";
- infiles[n_infiles++].name = argv[++i];
- }
+ i++;
else if (strcmp (argv[i], "-Xpreprocessor") == 0)
- {
- infiles[n_infiles].language = "*";
- infiles[n_infiles++].name = argv[++i];
- }
+ i++;
else if (strcmp (argv[i], "-l") == 0)
{ /* POSIX allows separation of -l and the lib arg;
canonicalize by concatenating -l with its arg */
}
}
obstack_grow (&collect_obstack, "\0", 1);
- putenv (obstack_finish (&collect_obstack));
+ putenv (XOBFINISH (&collect_obstack, char *));
}
\f
/* Process a spec string, accumulating and running commands. */
if (arg_going)
{
obstack_1grow (&obstack, 0);
- string = obstack_finish (&obstack);
+ string = XOBFINISH (&obstack, const char *);
if (this_is_library_file)
string = find_file (string);
store_arg (string, delete_this_arg, this_is_output_file);
static size_t bufsize = 0;
static char *buffer;
int idx;
+ bool multilib_p = false;
/* Used on systems which record the specified -L dirs
and use them to search for dynamic linking. */
strcat (buffer, machine_suffix);
if (is_directory (buffer, dir_for_machine_suffix, 1))
{
+ multilib_p = true;
do_spec_1 (option, separate_options, NULL);
if (separate_options)
do_spec_1 (" ", 0, NULL);
{
if (is_directory (pl->prefix, dir_for_no_suffix, 1))
{
+ multilib_p = true;
do_spec_1 (option, separate_options, NULL);
if (separate_options)
do_spec_1 (" ", 0, NULL);
}
}
- if (only_subdir)
+ if (only_subdir || multilib_p)
return;
if (machine_suffix)
if (arg_going)
{
obstack_1grow (&obstack, 0);
- string = obstack_finish (&obstack);
+ string = XOBFINISH (&obstack, const char *);
if (this_is_library_file)
string = find_file (string);
store_arg (string, delete_this_arg, this_is_output_file);
if (arg_going)
{
obstack_1grow (&obstack, 0);
- string = obstack_finish (&obstack);
+ string = XOBFINISH (&obstack, const char *);
if (this_is_library_file)
string = find_file (string);
store_arg (string, delete_this_arg, this_is_output_file);
if (arg_going)
{
obstack_1grow (&obstack, 0);
- string = obstack_finish (&obstack);
+ string = XOBFINISH (&obstack, const char *);
if (this_is_library_file)
string = find_file (string);
store_arg (string, delete_this_arg, this_is_output_file);
if (arg_going)
{
obstack_1grow (&obstack, 0);
- string = obstack_finish (&obstack);
+ string = XOBFINISH (&obstack, const char *);
if (this_is_library_file)
string = find_file (string);
store_arg (string, delete_this_arg, this_is_output_file);
return value;
break;
- case 'M':
- if (multilib_dir && strcmp (multilib_dir, ".") != 0)
- {
- char *p;
- const char *q;
- size_t len;
-
- len = strlen (multilib_dir);
- obstack_blank (&obstack, len + 1);
- p = obstack_next_free (&obstack) - (len + 1);
-
- *p++ = '_';
- for (q = multilib_dir; *q ; ++q, ++p)
- *p = (IS_DIR_SEPARATOR (*q) ? '_' : *q);
- }
- break;
-
case 'R':
/* We assume there is a directory
separator at the end of this string. */
if (processing_spec_function && arg_going)
{
obstack_1grow (&obstack, 0);
- string = obstack_finish (&obstack);
+ string = XOBFINISH (&obstack, const char *);
if (this_is_library_file)
string = find_file (string);
store_arg (string, delete_this_arg, this_is_output_file);
static inline bool
input_suffix_matches (const char *atom, const char *end_atom)
{
+ /* We special case the semantics of {.s:...} and {.S:...} and their
+ negative variants. Instead of testing the input filename suffix,
+ we test whether the input source file is an assembler file or an
+ assembler-with-cpp file respectively. This allows us to correctly
+ handle the -x command line option. */
+
+ if (atom + 1 == end_atom
+ && input_file_compiler
+ && input_file_compiler->suffix)
+ {
+ if (*atom == 's')
+ return !strcmp (input_file_compiler->suffix, "@assembler");
+ if (*atom == 'S')
+ return !strcmp (input_file_compiler->suffix, "@assembler-with-cpp");
+ }
+
return (input_suffix
&& !strncmp (input_suffix, atom, end_atom - atom)
&& input_suffix[end_atom - atom] == '\0');
GCC_DRIVER_HOST_INITIALIZATION;
#endif
+ /* Unlock the stdio streams. */
+ unlock_std_streams ();
+
gcc_init_libintl ();
if (signal (SIGINT, SIG_IGN) != SIG_IGN)
obstack_grow (&multilib_obstack, p, strlen (p));
obstack_1grow (&multilib_obstack, 0);
- multilib_select = obstack_finish (&multilib_obstack);
+ multilib_select = XOBFINISH (&multilib_obstack, const char *);
q = multilib_matches_raw;
while ((p = *q++) != (char *) 0)
obstack_grow (&multilib_obstack, p, strlen (p));
obstack_1grow (&multilib_obstack, 0);
- multilib_matches = obstack_finish (&multilib_obstack);
+ multilib_matches = XOBFINISH (&multilib_obstack, const char *);
q = multilib_exclusions_raw;
while ((p = *q++) != (char *) 0)
obstack_grow (&multilib_obstack, p, strlen (p));
obstack_1grow (&multilib_obstack, 0);
- multilib_exclusions = obstack_finish (&multilib_obstack);
+ multilib_exclusions = XOBFINISH (&multilib_obstack, const char *);
need_space = FALSE;
for (i = 0; i < ARRAY_SIZE (multilib_defaults_raw); i++)
}
obstack_1grow (&multilib_obstack, 0);
- multilib_defaults = obstack_finish (&multilib_obstack);
+ multilib_defaults = XOBFINISH (&multilib_obstack, const char *);
}
/* Set up to remember the pathname of gcc and any options
obstack_init (&collect_obstack);
obstack_grow (&collect_obstack, "COLLECT_GCC=", sizeof ("COLLECT_GCC=") - 1);
obstack_grow (&collect_obstack, argv[0], strlen (argv[0]) + 1);
- putenv (obstack_finish (&collect_obstack));
+ putenv (XOBFINISH (&collect_obstack, char *));
#ifdef INIT_ENVIRONMENT
/* Set up any other necessary machine specific environment variables. */
target_sysroot_suffix = xstrdup (argbuf[argbuf_index -1]);
}
+#ifdef HAVE_LD_SYSROOT
+ /* Pass the --sysroot option to the linker, if it supports that. If
+ there is a sysroot_suffix_spec, it has already been processed by
+ this point, so target_system_root really is the system root we
+ should be using. */
+ if (target_system_root)
+ {
+ obstack_grow (&obstack, "%(sysroot_spec) ", strlen ("%(sysroot_spec) "));
+ obstack_grow0 (&obstack, link_spec, strlen (link_spec));
+ set_spec ("link", XOBFINISH (&obstack, const char *));
+ }
+#endif
+
/* Process sysroot_hdrs_suffix_spec. */
if (*sysroot_hdrs_suffix_spec != 0
&& do_spec_2 (sysroot_hdrs_suffix_spec) == 0)
startfile_prefix_spec exclusively. */
else if (*cross_compile == '0' || target_system_root)
{
- if (*md_exec_prefix)
- add_sysrooted_prefix (&startfile_prefixes, md_exec_prefix, "GCC",
- PREFIX_PRIORITY_LAST, 0, 1);
-
if (*md_startfile_prefix)
add_sysrooted_prefix (&startfile_prefixes, md_startfile_prefix,
"GCC", PREFIX_PRIORITY_LAST, 0, 1);
int n;
const char *thrmod;
+ notice ("Target: %s\n", spec_machine);
notice ("Configured with: %s\n", configuration_arguments);
#ifdef THREAD_MODEL_SPEC
obstack_init (&obstack);
do_spec_1 (THREAD_MODEL_SPEC, 0, thread_model);
obstack_1grow (&obstack, '\0');
- thrmod = obstack_finish (&obstack);
+ thrmod = XOBFINISH (&obstack, const char *);
#else
thrmod = thread_model;
#endif
error ("%s: %s", name, xstrerror (errno));
}
-static void
-pfatal_pexecute (const char *errmsg_fmt, const char *errmsg_arg)
-{
- if (errmsg_arg)
- {
- int save_errno = errno;
-
- /* Space for trailing '\0' is in %s. */
- char *msg = xmalloc (strlen (errmsg_fmt) + strlen (errmsg_arg));
- sprintf (msg, errmsg_fmt, errmsg_arg);
- errmsg_fmt = msg;
-
- errno = save_errno;
- }
-
- pfatal_with_name (errmsg_fmt);
-}
-
/* Output an error message and exit. */
void
/* Output an error message and exit. */
void
-fatal (const char *msgid, ...)
+fatal (const char *cmsgid, ...)
{
va_list ap;
- va_start (ap, msgid);
+ va_start (ap, cmsgid);
fprintf (stderr, "%s: ", programname);
- vfprintf (stderr, _(msgid), ap);
+ vfprintf (stderr, _(cmsgid), ap);
va_end (ap);
fprintf (stderr, "\n");
delete_temp_files ();
exit (1);
}
+/* The argument is actually c-format, not gcc-internal-format,
+ but because functions with identical names are used through
+ the rest of the compiler with gcc-internal-format, we just
+ need to hope all users of these functions use the common
+ subset between c-format and gcc-internal-format. */
+
void
-error (const char *msgid, ...)
+error (const char *gmsgid, ...)
{
va_list ap;
- va_start (ap, msgid);
+ va_start (ap, gmsgid);
fprintf (stderr, "%s: ", programname);
- vfprintf (stderr, _(msgid), ap);
+ vfprintf (stderr, _(gmsgid), ap);
va_end (ap);
fprintf (stderr, "\n");
}
static void
-notice (const char *msgid, ...)
+notice (const char *cmsgid, ...)
{
va_list ap;
- va_start (ap, msgid);
- vfprintf (stderr, _(msgid), ap);
+ va_start (ap, cmsgid);
+ vfprintf (stderr, _(cmsgid), ap);
va_end (ap);
}
\f
obstack_grow (&multilib_obstack, start, end - start);
obstack_1grow (&multilib_obstack, 0);
- mdswitches[i].str = obstack_finish (&multilib_obstack);
+ mdswitches[i].str = XOBFINISH (&multilib_obstack, const char *);
mdswitches[i++].len = end - start;
if (*end == '\0')