https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89249

--- Comment #4 from Liviu Ionescu <ilg at livius dot net> ---
I added a printf() in pex_win32_exec_child() to see why the lto invocation
fails, and here is the result:


>>>>> pex_win32_exec_child (executable='c:/users/ilg/desktop/8.2.1     
>>>>> 1.4-20190213-0923/bin/../libexec/gcc/arm-none-eabi/8.2.1/collect2.exe') 
>>>>> <<<<<
>>>>> pex_win32_exec_child (executable='c:/users/ilg/desktop/8.2.1     
>>>>> 1.4-20190213-0923/bin/../lib/gcc/arm-none-eabi/8.2.1/../../../../arm-none-eabi/bin/ld.exe')
>>>>>  <<<<<
>>>>> pex_win32_exec_child (executable='c:/users/ilg/desktop/8.2.1     
>>>>> 1.4-20190213-0923/bin/../lib/gcc/arm-none-eabi/8.2.1/../../../../arm-none-eabi/bin/nm.exe')
>>>>>  <<<<<
>>>>> pex_win32_exec_child (executable='c:/users/ilg/desktop/8.2.1     
>>>>> 1.4-20190213-0923/bin/../lib/gcc/arm-none-eabi/8.2.1/../../../../arm-none-eabi/bin/nm.exe')
>>>>>  <<<<<
>>>>> pex_win32_exec_child (executable='c:/users/ilg/desktop/8.2.1     
>>>>> 1.4-20190213-0923/bin/../lib/gcc/arm-none-eabi/8.2.1/../../../../arm-none-eabi/bin/nm.exe')
>>>>>  <<<<<
>>>>> pex_win32_exec_child (executable='c:/users/ilg/desktop/8.2.1     
>>>>> 1.4-20190213-0923/bin/../lib/gcc/arm-none-eabi/8.2.1/../../../../arm-none-eabi/bin/nm.exe')
>>>>>  <<<<<
>>>>> pex_win32_exec_child (executable='c:/users/ilg/desktop/8.2.1     
>>>>> 1.4-20190213-0923/bin/../lib/gcc/arm-none-eabi/8.2.1/../../../../arm-none-eabi/bin/nm.exe')
>>>>>  <<<<<
>>>>> pex_win32_exec_child (executable='c:/users/ilg/desktop/8.2.1     
>>>>> 1.4-20190213-0923/bin/../lib/gcc/arm-none-eabi/8.2.1/../../../../arm-none-eabi/bin/nm.exe')
>>>>>  <<<<<
>>>>> pex_win32_exec_child (executable='c:/users/ilg/desktop/8.2.1\ \ \ \ \ 
>>>>> 1.4-20190213-0923/bin/../libexec/gcc/arm-none-eabi/8.2.1/lto-wrapper.exe')
>>>>>  <<<<<
collect2.exe: fatal error: CreateProcess: No such file or directory
compilation terminated.

C:\Users\ilg\tmp\lto>



it looks like the win32 api is not happy with the escaped spaces in the
lto-wrapper path.


I conditionally removed the white space conversion in gcc.c (around line 7741)
and the problem was fixed:


#if defined (__MINGW32__)
      // Win32 fails to CreateProcess if spaces are escaped.
      lto_wrapper_spec = lto_wrapper_file;
#else
      lto_wrapper_file = convert_white_space (lto_wrapper_file);
#endif


I did the same for the second reference to convert_white_space(), while
processing the linker_plugin_file_spec, but I do not have a clear reason why
this is needed, since aparently the name of the temporary files used for the
specs file is generate by win32 in the 8.3 format, and has no spaces.


I tried to remove the conversion entirely, but then ld fails to load the
plugin:


/home/ilg/Desktop/8.2.1       
1.4-20190213-1020/bin/../lib/gcc/arm-none-eabi/8.2.1/../../../../arm-none-eabi/bin/ld:
/home/ilg/Desktop/8.2.1: error loading plugin: /home/ilg/Desktop/8.2.1: cannot
open shared object file: No such file or directory
collect2: error: ld returned 1 exit status
ilg@ilg-ud18lts64-gme:~/tmp/lto$ 



I'll apply a patch to build my distribution, but I think a more elaborate
solution is needed.


Although not related to this issue, another curious thing was the sequence of 6
calls to nm shown by the trace. Are they expected?

Reply via email to