In version 2.5.1 of the A111 libraries for Cortex-M0 we started using LTO.

Unfortunately, GCC does not allow different versions of the GCC toolchain to utilize LTO:

make -j8 all
arm-none-eabi-gcc -o "my_example.elf" @"objects.list" -lacconeer -mcpu=cortex-m0plus -T"C:\Users\Me\STM32CubeIDE\workspace_1.4.0\my_example\STM32G071CBTX_FLASH.ld" --specs=nosys.specs -Wl,-Map="my_example.map" -Wl,--gc-sections -static -L"C:\Users\Me\STM32CubeIDE\workspace_1.4.0\my_example\rss\lib" --specs=nano.specs -mfloat-abi=soft -mthumb -Wl,--start-group -lc -lm -Wl,--end-group
lto1.exe: internal compiler error: bytecode stream: expected tag round_div_expr instead of reference_type
libbacktrace could not find executable to open
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://gcc.gnu.org/bugs/> for instructions.
lto-wrapper.exe: fatal error: arm-none-eabi-gcc returned 1 exit status
compilation terminated.
d:\program\stm32cubeide_1.4.0\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.4.0.202007081208\tools\arm-none-eabi\bin\ld.exe: error: lto-wrapper failed
collect2.exe: error: ld returned 1 exit status
make: *** [makefile:50: my_example.elf] Error 1
"make -j8 all" terminated with exit code 2. Build might be incomplete.
 
10:46:01 Build Failed. 2 errors, 0 warnings. (took 941ms)


Resolve by:
In STM32CubeIDE, LTO can be disabled by going into "Project -> Properties -> C/C++ Build -> Settings -> MCU GCC Linker -> Miscellaneous", then under "Other flags" add the flag "-fno-lto".

If you are using a makefile, then the flag "-fno-lto" simply needs to be added to LDFLAGS.