https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110710
Bug ID: 110710
Summary: LTO linker on Windows creates an invalid Makefile
Product: gcc
Version: 12.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: lto
Assignee: unassigned at gcc dot gnu.org
Reporter: cz.finn.cz at gmail dot com
CC: marxin at gcc dot gnu.org
Target Milestone: ---
In MS/Windows, when linking an executable file in a single thread (-flto=1),
the linker issues a warning:
lto-wrapper.exe: warning: using serial compilation of 2 LTRANS jobs
lto-wrapper.exe: note: see the '-flto' option documentation for more
information
When linking using -flto=auto, a temporary makefile is created in a %TEMP%
directory. This makefile contains something like this:
C:\Users\K.GOTT\AppData\Local\Temp\1\cc071ciG.ltrans0.ltrans.o:
@arm-none-eabi-gcc '-xlto' '-c' '-fno-openmp' '-fno-openacc'
'-fno-pie' '-fcf-protection=none' '-mcpu=cortex-r5' '-mfloat-abi=hard'
'-mfpu=vfpv3-d16' '-mbig-endian' '-mthumb' '-mthumb-interwork'
'-mlibarch=armv7-r+fp+idiv' '-march=armv7-r+fp+idiv' '-O2' '-mcpu=cortex-r5'
'-mfloat-abi=hard' '-mfpu=vfpv3-d16' '-mbig-endian' '-mthumb'
'-mthumb-interwork' '-g' '-nostartfiles' '-gdwarf-2' '-O2'
'-falign-functions=8' '-mbe32' '-L' 'build/release' '-mlibarch=armv7-r+fp+idiv'
'-march=armv7-r+fp+idiv' '-dumpdir'
'dist/release/CA002734_2QC_1.0.0_20230714.elf.' '-dumpbase'
'dist/release/CA002734_2QC_1.0.0_20230714.elf.ltrans0.ltrans' '-fltrans' '-o'
'C:\Users\K.GOTT\AppData\Local\Temp\1\cc071ciG.ltrans0.ltrans.o'
'C:\Users\K.GOTT\AppData\Local\Temp\1\cc071ciG.ltrans0.o'
@-touch -r C:\Users\K.GOTT\AppData\Local\Temp\1\cc071ciG.ltrans0.o
C:\Users\K.GOTT\AppData\Local\Temp\1\cc071ciG.ltrans0.o.tem > /dev/null 2>&1 &&
mv C:\Users\K.GOTT\AppData\Local\Temp\1\cc071ciG.ltrans0.o.tem
C:\Users\K.GOTT\AppData\Local\Temp\1\cc071ciG.ltrans0.o
C:\Users\K.GOTT\AppData\Local\Temp\1\cc071ciG.ltrans1.ltrans.o:
@arm-none-eabi-gcc '-xlto' '-c' '-fno-openmp' '-fno-openacc'
'-fno-pie' '-fcf-protection=none' '-mcpu=cortex-r5' '-mfloat-abi=hard'
'-mfpu=vfpv3-d16' '-mbig-endian' '-mthumb' '-mthumb-interwork'
'-mlibarch=armv7-r+fp+idiv' '-march=armv7-r+fp+idiv' '-O2' '-mcpu=cortex-r5'
'-mfloat-abi=hard' '-mfpu=vfpv3-d16' '-mbig-endian' '-mthumb'
'-mthumb-interwork' '-g' '-nostartfiles' '-gdwarf-2' '-O2'
'-falign-functions=8' '-mbe32' '-L' 'build/release' '-mlibarch=armv7-r+fp+idiv'
'-march=armv7-r+fp+idiv' '-dumpdir'
'dist/release/CA002734_2QC_1.0.0_20230714.elf.' '-dumpbase'
'dist/release/CA002734_2QC_1.0.0_20230714.elf.ltrans1.ltrans' '-fltrans' '-o'
'C:\Users\K.GOTT\AppData\Local\Temp\1\cc071ciG.ltrans1.ltrans.o'
'C:\Users\K.GOTT\AppData\Local\Temp\1\cc071ciG.ltrans1.o'
@-touch -r C:\Users\K.GOTT\AppData\Local\Temp\1\cc071ciG.ltrans1.o
C:\Users\K.GOTT\AppData\Local\Temp\1\cc071ciG.ltrans1.o.tem > /dev/null 2>&1 &&
mv C:\Users\K.GOTT\AppData\Local\Temp\1\cc071ciG.ltrans1.o.tem
C:\Users\K.GOTT\AppData\Local\Temp\1\cc071ciG.ltrans1.o
.PHONY: all
all: \
C:\Users\K.GOTT\AppData\Local\Temp\1\cc071ciG.ltrans0.ltrans.o \
C:\Users\K.GOTT\AppData\Local\Temp\1\cc071ciG.ltrans1.ltrans.o
This file contains constructions, which obviously cannot work in Windows SHELL,
such as redirection to /dev/null, using of tools/commands, which generally may
not be available (mv, touch). As a result, the make execution fails, and the
top-level make issues errors, such as
The system cannot find the file specified.
make[2]: [C:\Users\K.GOTT\AppData\Local\Temp\1\ccxCkgV8.mk:6:
C:\Users\K.GOTT\AppData\Local\Temp\1\cc071ciG.ltrans1.ltrans.o] Error 1
(ignored)
The system cannot find the file specified.
make[2]: [C:\Users\K.GOTT\AppData\Local\Temp\1\ccxCkgV8.mk:3:
C:\Users\K.GOTT\AppData\Local\Temp\1\cc071ciG.ltrans0.ltrans.o] Error 1
(ignored)