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

            Bug ID: 90369
           Summary: error: could not unlink output file
           Product: gcc
           Version: 9.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: lto
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hoganmeier at gmail dot com
                CC: marxin at gcc dot gnu.org
  Target Milestone: ---

Tested this ARM toolchain:
http://www.freddiechopin.info/en/download/category/11-bleeding-edge-toolchain
In a very specific case I get the aforementioned error: could not unlink output
file

yield.cpp:
void yield() {}

main.cpp:
void yield();
int main() { yield(); }

arm-none-eabi-g++ -o obj/main.cpp.o -c -flto -g -nostdlib -O2  main.cpp
arm-none-eabi-g++ -o obj/yield.cpp.o -c -flto -g -nostdlib -O2  yield.cpp
arm-none-eabi-gcc-ar rc obj/libFrameworkArduino.a obj/main.cpp.o
obj/yield.cpp.o
arm-none-eabi-g++ -o obj/firmware.elf -T empty.ld -Wl,--gc-sections -O2
-save-temps obj/libFrameworkArduino.a

arm-none-eabi/bin/ld.exe: error: could not unlink output file

If you remove any of the -g or -save-temps flags, or merge the code into 1
file, or use the object files directly it works.

Reply via email to