From 7287cf184e3aef6e55da717c7acc86cf02500e79 Mon Sep 17 00:00:00 2001 From: Tobias Burnus Date: Tue, 13 Oct 2020 15:19:51 +0200 Subject: [PATCH] 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. --- gcc/lto-wrapper.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) 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); -- 2.30.2