AnsweredAssumed Answered

Can't Build with Link-time Optimizer Enabled

Question asked by Peter Barbara on Aug 21, 2017
Latest reply on Sep 25, 2017 by Alexander Fedotov

Enabling the link-time optimizer (-flto) option in the build settings causes my builds to fail in the following way:


Invoking: Standard S32DS C++ Linker
powerpc-eabivle-g++ -o "link_opt_Z7_0.elf" "@link_opt_Z7_0.args"   
powerpc-eabivle-g++.exe: error: nosys.specs: No such file or directory
lto-wrapper: c:\NXP\S32DS_Power_v1.2\Cross_Tools\powerpc-eabivle-4_9\bin\powerpc-eabivle-g++.exe returned 1 exit status
c:/nxp/s32ds_power_v1.2/cross_tools/powerpc-eabivle-4_9/bin/../lib/gcc/powerpc-eabivle/4.9.4/../../../../powerpc-eabivle/bin/real-ld.exe: error: lto-wrapper failed
collect2.exe: error: ld returned 1 exit status
make: *** [link_opt_Z7_0.elf] Error 1

It appears that the linker cannot find the nosys.specs file when this option is enabled.  It doesn't have a problem when it is disabled.


If I am missing any other set-up I should also be doing in conjunction with enabling this option, does anyone have any tips or pointers for me?


This can be reproduced with a new S32DS project (I am using S32DS for PowerPC V1.2)

  1. Start a new project
  2. I selected the MPC5777C core (it probably doesn't matter)
    1. C++ for the language
    2. NewLib for the library
  3. In the build settings of S32DS , enable the link-time optimizer (-flto) option.  I did this for both C and C++ settings
  4. Compile