]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
lto: Always quote path to touch
authorTorbjörn SVENSSON <torbjorn.svensson@foss.st.com>
Fri, 21 Oct 2022 10:29:13 +0000 (12:29 +0200)
committerTorbjörn SVENSSON <torbjorn.svensson@foss.st.com>
Mon, 24 Oct 2022 08:20:34 +0000 (10:20 +0200)
When generating the makefile, make sure that the paths are quoted so
that a native Windows path works within Cygwin.

Without this patch, this error is reported by the DejaGNU test suite:

make: [T:\ccMf0kI3.mk:3: T:\ccGEvdDp.ltrans0.ltrans.o] Error 1 (ignored)

The generated makefile fragment without the patch:

T:\ccGEvdDp.ltrans0.ltrans.o:
  @T:\build\bin\arm-none-eabi-g++.exe '-xlto' ... '-o' 'T:\ccGEvdDp.ltrans0.ltrans.o' 'T:\ccGEvdDp.ltrans0.o'
  @-touch -r T:\ccGEvdDp.ltrans0.o T:\ccGEvdDp.ltrans0.o.tem > /dev/null 2>&1 && mv T:\ccGEvdDp.ltrans0.o.tem T:\ccGEvdDp.ltrans0.o
.PHONY: all
all: \
  T:\ccGEvdDp.ltrans0.ltrans.o

With the patch, the touch line would be replace with:

  @-touch -r "T:\ccGEvdDp.ltrans0.o" "T:\ccGEvdDp.ltrans0.o.tem" > /dev/null 2>&1 && mv "T:\ccGEvdDp.ltrans0.o.tem" "T:\ccGEvdDp.ltrans0.o"

gcc/ChangeLog:

* lto-wrapper.cc: Quote paths in makefile.

Co-Authored-By: Yvan ROUX <yvan.roux@foss.st.com>
Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
gcc/lto-wrapper.cc

index 9a764702ffc677e8cef71c0fd08fd43ca73c142f..b12bcc1ad273249f7f67dda122389cfea5d1e8df 100644 (file)
@@ -2010,8 +2010,8 @@ cont:
                 truncate them as soon as we have processed it.  This
                 reduces temporary disk-space usage.  */
              if (! save_temps)
-               fprintf (mstream, "\t@-touch -r %s %s.tem > /dev/null 2>&1 "
-                        "&& mv %s.tem %s\n",
+               fprintf (mstream, "\t@-touch -r \"%s\" \"%s.tem\" > /dev/null "
+                        "2>&1 && mv \"%s.tem\" \"%s\"\n",
                         input_name, input_name, input_name, input_name); 
            }
          else