https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104895
--- Comment #2 from Christoph Müllner <christophm30 at gmail dot com> --- Further analysis shows that '-flto=1' works as well and '-flto=16' fails as well. This brings us right to the spot: Bad: [...] make -f /tmp/ccyzs8VX.mk -j16 all Using built-in specs. [...] Good: [...] gcc @/tmp/cclqDb0Y Using built-in specs. [...] Let's look deeper: $ mkdir tmpdir $ export TEMP=$(pwd)/tmpdir/ $ gcc -v -fPIC -flto=16 -shared -Wl,-soname,"lib'do it'.so" -o "lib'do it'.so" doit.o -save-temps $ cat tmpdir/ccM8aNK8.mk ./lib'do it'.so.ltrans0.ltrans.o: @gcc '-xlto' '-c' '-fno-openmp' '-fno-openacc' '-fcf-protection=none' '-mtune=generic' '-march=x86-64' '-fPIC' '-v' '-fPIC' '-shared' '-save-temps' '-mtune=generic' '-march=x86-64' '-dumpdir' 'lib'do it'.so.' '-dumpbase' './lib'do it'.so.ltrans0.ltrans' '-fltrans' '-o' './lib'do it'.so.ltrans0.ltrans.o' './lib'do it'.so.ltrans0.o' .PHONY: all all: \ ./lib'do it'.so.ltrans0.ltrans.o The invocation of GCC will be: gcc '-xlto' '-c' '-fno-openmp' '-fno-openacc' '-fcf-protection=none' '-mtune=generic' '-march=x86-64' '-fPIC' '-v' '-fPIC' '-save-temps' '-shared' '-mtune=generic' '-march=x86-64' '-dumpdir' 'libdon't do it.so.' '-dumpbase' './libdon't do it.so.ltrans0.ltrans' '-fltrans' '-o' './libdon't do it.so.ltrans0.ltrans.o' './libdon't do it.so.ltrans0.o' And here we see the issue! The options are each quoted with '-characters. But the filename itself contains these characters as well, which will terminate the string. The space between the '-characters will therefore be interpreted as a separator. One thing to mention is that GNU Make has limitations how to handle spaces: http://savannah.gnu.org/bugs/?712