struct pex_obj *
collect_execute (const char *prog, char **argv, const char *outname,
- const char *errname, int flags, bool use_atfile)
+ const char *errname, int flags, bool use_atfile,
+ const char *atsuffix)
{
struct pex_obj *pex;
const char *errmsg;
/* Note: we assume argv contains at least one element; this is
checked above. */
- response_file = make_temp_file ("");
+ if (!save_temps || !atsuffix)
+ response_file = make_temp_file ("");
+ else
+ response_file = concat (dumppfx, atsuffix, NULL);
f = fopen (response_file, "w");
}
void
-fork_execute (const char *prog, char **argv, bool use_atfile)
+fork_execute (const char *prog, char **argv, bool use_atfile,
+ const char *atsuffix)
{
struct pex_obj *pex;
pex = collect_execute (prog, argv, NULL, NULL,
- PEX_LAST | PEX_SEARCH, use_atfile);
+ PEX_LAST | PEX_SEARCH, use_atfile, atsuffix);
do_wait (prog, pex);
}
extern struct pex_obj *collect_execute (const char *, char **,
const char *, const char *,
- int, bool);
+ int, bool, const char *);
extern int collect_wait (const char *, struct pex_obj *);
extern void do_wait (const char *, struct pex_obj *);
-extern void fork_execute (const char *, char **, bool);
+extern void fork_execute (const char *, char **, bool, const char *);
extern void utils_cleanup (bool);
/* Run the LTO back end. */
pex = collect_execute (prog, lto_c_argv, NULL, NULL, PEX_SEARCH,
- at_file_supplied);
+ at_file_supplied, NULL);
{
int c;
FILE *stream;
/* Run the linker again, this time replacing the object files
optimized by the LTO with the temporary file generated by the LTO. */
- fork_execute ("ld", out_lto_ld_argv, HAVE_GNU_LD && at_file_supplied);
+ fork_execute ("ld", out_lto_ld_argv, HAVE_GNU_LD && at_file_supplied,
+ NULL);
/* We assume that temp files were created, and therefore we need to take
that into account (maybe run dsymutil). */
post_ld_pass (/*temp_file*/true);
{
/* Our caller is relying on us to do the link
even though there is no LTO back end work to be done. */
- fork_execute ("ld", lto_ld_argv, HAVE_GNU_LD && at_file_supplied);
+ fork_execute ("ld", lto_ld_argv, HAVE_GNU_LD && at_file_supplied, NULL);
/* No LTO objects were found, so no new temp file. */
post_ld_pass (/*temp_file*/false);
}
const char *prog = "ld";
pex = collect_execute (prog, ld_argv, NULL, NULL,
PEX_LAST | PEX_SEARCH,
- HAVE_GNU_LD && at_file_supplied);
+ HAVE_GNU_LD && at_file_supplied, NULL);
int ret = collect_wait (prog, pex);
if (ret)
{
strip_argv[0] = strip_file_name;
strip_argv[1] = output_file;
strip_argv[2] = (char *) 0;
- fork_execute ("strip", real_strip_argv, false);
+ fork_execute ("strip", real_strip_argv, false, NULL);
}
#ifdef COLLECT_EXPORT_LIST
/* Assemble the constructor and destructor tables.
Link the tables in with the rest of the program. */
- fork_execute ("gcc", c_argv, at_file_supplied);
+ fork_execute ("gcc", c_argv, at_file_supplied, NULL);
#ifdef COLLECT_EXPORT_LIST
/* On AIX we must call link because of possible templates resolution. */
do_link (ld2_argv);
maybe_run_lto_and_relink (ld2_argv, object_lst, object, true);
else
{
- fork_execute ("ld", ld2_argv, HAVE_GNU_LD && at_file_supplied);
+ fork_execute ("ld", ld2_argv, HAVE_GNU_LD && at_file_supplied, NULL);
post_ld_pass (/*temp_file*/false);
}
argv[2] = (char *) 0;
pex = collect_execute (dsymutil, real_argv, NULL, NULL,
- PEX_LAST | PEX_SEARCH, false);
+ PEX_LAST | PEX_SEARCH, false, NULL);
do_wait (dsymutil, pex);
}
obstack_ptr_grow (&argv_obstack, NULL);
const char **new_argv = XOBFINISH (&argv_obstack, const char **);
- fork_execute (new_argv[0], CONST_CAST (char **, new_argv), true);
+ fork_execute (new_argv[0], CONST_CAST (char **, new_argv), true,
+ ".gccnative_args");
obstack_free (&argv_obstack, NULL);
}
unsetenv ("LIBRARY_PATH");
/* Run the compiler pass. */
- fork_execute (cc_argv[0], CONST_CAST (char **, cc_argv), true);
+ fork_execute (cc_argv[0], CONST_CAST (char **, cc_argv), true, ".gcc_args");
obstack_free (&cc_argv_obstack, NULL);
in = fopen (gcn_s1_name, "r");
fclose (out);
/* Run the assemble/link pass. */
- fork_execute (ld_argv[0], CONST_CAST (char **, ld_argv), true);
+ fork_execute (ld_argv[0], CONST_CAST (char **, ld_argv), true, ".ld_args");
obstack_free (&ld_argv_obstack, NULL);
in = fopen (gcn_o_name, "r");
unsetenv ("LIBRARY_PATH");
unsetenv ("LD_RUN_PATH");
- fork_execute (argv[0], argv, false);
+ fork_execute (argv[0], argv, false, NULL);
obstack_free (argv_obstack, NULL);
/* Restore environment variables. */
obstack_ptr_grow (&argv_obstack, NULL);
char **argv = XOBFINISH (&argv_obstack, char **);
- fork_execute (argv[0], argv, false);
+ fork_execute (argv[0], argv, false, NULL);
obstack_free (&argv_obstack, NULL);
return obj_filename;
obstack_ptr_grow (&argv_obstack, rename_section_opt);
obstack_ptr_grow (&argv_obstack, NULL);
char **new_argv = XOBFINISH (&argv_obstack, char **);
- fork_execute (new_argv[0], new_argv, false);
+ fork_execute (new_argv[0], new_argv, false, NULL);
obstack_free (&argv_obstack, NULL);
/* Objcopy has created symbols, containing the input file name with
obstack_ptr_grow (&argv_obstack, opt_for_objcopy[2]);
obstack_ptr_grow (&argv_obstack, NULL);
new_argv = XOBFINISH (&argv_obstack, char **);
- fork_execute (new_argv[0], new_argv, false);
+ fork_execute (new_argv[0], new_argv, false, NULL);
obstack_free (&argv_obstack, NULL);
return target_so_filename;
obstack_ptr_grow (&argv_obstack, out_obj_filename);
obstack_ptr_grow (&argv_obstack, NULL);
char **new_argv = XOBFINISH (&argv_obstack, char **);
- fork_execute (new_argv[0], new_argv, false);
+ fork_execute (new_argv[0], new_argv, false, NULL);
obstack_free (&argv_obstack, NULL);
/* Run objcopy on the resultant object file to localize generated symbols
obstack_ptr_grow (&argv_obstack, out_obj_filename);
obstack_ptr_grow (&argv_obstack, NULL);
new_argv = XOBFINISH (&argv_obstack, char **);
- fork_execute (new_argv[0], new_argv, false);
+ fork_execute (new_argv[0], new_argv, false, NULL);
obstack_free (&argv_obstack, NULL);
return 0;
obstack_ptr_grow (&argv_obstack, NULL);
const char **new_argv = XOBFINISH (&argv_obstack, const char **);
- fork_execute (new_argv[0], CONST_CAST (char **, new_argv), true);
+ fork_execute (new_argv[0], CONST_CAST (char **, new_argv), true,
+ ".gccnative_args");
obstack_free (&argv_obstack, NULL);
}
unsetenv ("COMPILER_PATH");
unsetenv ("LIBRARY_PATH");
- fork_execute (new_argv[0], CONST_CAST (char **, new_argv), true);
+ fork_execute (new_argv[0], CONST_CAST (char **, new_argv), true,
+ ".gcc_args");
obstack_free (&argv_obstack, NULL);
xputenv (concat ("GCC_EXEC_PREFIX=", execpath, NULL));
obstack_ptr_grow (&argv_obstack, NULL);
argv = XOBFINISH (&argv_obstack, char **);
- fork_execute (argv[0], argv, true);
+ fork_execute (argv[0], argv, true, "offload_args");
obstack_free (&argv_obstack, NULL);
free_array_of_ptrs ((void **) paths, n_paths);
new_argv = XOBFINISH (&argv_obstack, const char **);
argv_ptr = &new_argv[new_head_argc];
- fork_execute (new_argv[0], CONST_CAST (char **, new_argv), true);
+ fork_execute (new_argv[0], CONST_CAST (char **, new_argv), true,
+ "ltrans_args");
/* Copy the early generated debug info from the objects to temporary
files and append those to the partial link commandline. */
}
else
{
+ char argsuffix[sizeof (DUMPBASE_SUFFIX) + 1];
+ if (save_temps)
+ snprintf (dumpbase, sizeof (DUMPBASE_SUFFIX),
+ "ltrans%u.ltrans_args", i);
fork_execute (new_argv[0], CONST_CAST (char **, new_argv),
- true);
+ true, save_temps ? argsuffix : NULL);
maybe_unlink (input_name);
}
new_argv = XOBFINISH (&argv_obstack, const char **);
pex = collect_execute (new_argv[0], CONST_CAST (char **, new_argv),
- NULL, NULL, PEX_SEARCH, false);
+ NULL, NULL, PEX_SEARCH, false, NULL);
do_wait (new_argv[0], pex);
freeargv (make_argv);
maybe_unlink (makefile);