Message ID | ff6f102e-9742-cddd-b023-85a5774df352@codesourcery.com |
---|---|
State | New |
Headers | show |
Series | lto-wrapper: Use nontemp filename with -save-temps | expand |
On Tue, 13 Oct 2020, Tobias Burnus wrote: > There are still some @cc... files under /tmp, > but at lease another file is now at the proper place. > > This patch generates (for a.out and -save-temps) > the file a.crtoffloadtable.o. > > (I have not fully digested the LTO calls, but I think > this file is only created once and not by concurrent > lto-wrapper runs.) > > OK? OK. Richard. > Tobias > > PS: After this patch, there are still some @... files, > e.g. ccKqLnBY.ofldlist (generated by lto-plugin/lto-plugin.c) > and those generated by collect-utils.c's fork_execute, > invoked by config/nvptx/mkoffload.c, config/gcn/mkoffload.c, > and lto-wrapper.c (with use_atfile = true). > > ----------------- > Mentor Graphics (Deutschland) GmbH, Arnulfstra?e 201, 80634 M?nchen / Germany > Registergericht M?nchen HRB 106955, Gesch?ftsf?hrer: Thomas Heurung, Alexander > Walter >
On 10/13/20 2:56 PM, Richard Biener wrote: > On Tue, 13 Oct 2020, Tobias Burnus wrote: >> This patch generates (for a.out and -save-temps) >> the file a.crtoffloadtable.o. I missed a misused of concat in my patch :-( Committed as obvious. Tobias ----------------- Mentor Graphics (Deutschland) GmbH, Arnulfstraße 201, 80634 München / Germany Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Alexander Walter
lto-wrapper: Use nontemp filename with -save-temps gcc/ChangeLog: * lto-wrapper.c (find_crtoffloadtable): With -save-temps, use non-temp file name utilizing the dump prefix. (run_gcc): Update call. diff --git a/gcc/lto-wrapper.c b/gcc/lto-wrapper.c index 82cfa6bd67e..4d3cd7a56f2 100644 --- a/gcc/lto-wrapper.c +++ b/gcc/lto-wrapper.c @@ -1026,7 +1026,7 @@ copy_file (const char *dest, const char *src) the copy to the linker. */ static void -find_crtoffloadtable (void) +find_crtoffloadtable (int save_temps, const char *dumppfx) { char **paths = NULL; const char *library_path = getenv ("LIBRARY_PATH"); @@ -1039,7 +1039,11 @@ find_crtoffloadtable (void) if (access_check (paths[i], R_OK) == 0) { /* The linker will delete the filename we give it, so make a copy. */ - char *crtoffloadtable = make_temp_file (".crtoffloadtable.o"); + char *crtoffloadtable; + if (!save_temps) + crtoffloadtable = make_temp_file (".crtoffloadtable.o"); + else + crtoffloadtable = concat (dumppfx, "crtoffloadtable.o"); copy_file (crtoffloadtable, paths[i]); printf ("%s\n", crtoffloadtable); XDELETEVEC (crtoffloadtable); @@ -1698,7 +1702,7 @@ cont1: if (offload_names) { - find_crtoffloadtable (); + find_crtoffloadtable (save_temps, dumppfx); for (i = 0; offload_names[i]; i++) printf ("%s\n", offload_names[i]); free_array_of_ptrs ((void **) offload_names, i);