diff mbox series

lto-wrapper: Honor -save-temps for ltrans' makefile

Message ID b9d6de27-dad9-4dd5-833a-f5bc429edbf3@baylibre.com
State New
Headers show
Series lto-wrapper: Honor -save-temps for ltrans' makefile | expand

Commit Message

Tobias Burnus Aug. 30, 2024, 5:04 p.m. UTC
Noticed that -save-tmp is ignored for parallel LTO. With this patch, the 
result is now:

make -f ./a.ltrans.mk -j2 all
[Leaving LTRANS ./a.ltrans.mk]

instead of

make -f /tmp/ccXgtcjJ.mk -j2 all
[Leaving LTRANS /tmp/ccXgtcjJ.mk]

OK for mainline?

Tobias

Comments

Richard Biener Sept. 2, 2024, 7:09 a.m. UTC | #1
On Fri, Aug 30, 2024 at 7:05 PM Tobias Burnus <tburnus@baylibre.com> wrote:
>
> Noticed that -save-tmp is ignored for parallel LTO. With this patch, the
> result is now:
>
> make -f ./a.ltrans.mk -j2 all
> [Leaving LTRANS ./a.ltrans.mk]
>
> instead of
>
> make -f /tmp/ccXgtcjJ.mk -j2 all
> [Leaving LTRANS /tmp/ccXgtcjJ.mk]
>
> OK for mainline?

OK.

Richard.

> Tobias
diff mbox series

Patch

lto-wrapper: Honor -save-temps for ltrans' makefile

gcc/ChangeLog:

	* lto-wrapper.cc (run_gcc): Honor -save-temps for
	makefile name.

diff --git a/gcc/lto-wrapper.cc b/gcc/lto-wrapper.cc
index 6bfc96590a5..c07765b37a2 100644
--- a/gcc/lto-wrapper.cc
+++ b/gcc/lto-wrapper.cc
@@ -1994,7 +1994,10 @@  cont:
 
       if (parallel)
 	{
-	  makefile = make_temp_file (".mk");
+	  if (save_temps)
+	    makefile = concat (dumppfx, "ltrans.mk", NULL);
+	  else
+	    makefile = make_temp_file (".mk");
 	  mstream = fopen (makefile, "w");
 	  qsort (ltrans_priorities, nr, sizeof (int) * 2, cmp_priority);
 	}