https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90369
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |ASSIGNED Last reconfirmed| |2019-05-07 Assignee|unassigned at gcc dot gnu.org |rguenth at gcc dot gnu.org Ever confirmed|0 |1 --- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> --- Replicating on x86_64-linux native yields (assuming empty.ld is an empty file): g++ -o f.elf -T empty.ld -Wl,--gc-sections -O2 -save-temps obj.a /usr/bin/ld: f.elf: not enough room for program headers, try linking with -N /usr/bin/ld: final link failed: bad value /usr/bin/ld: error: could not unlink output file collect2: error: ld returned 1 exit status not sure if it really makes sense to link using an empty linker script? Btw, the removal error is probably from our debug copying magic: 31920 unlink("/tmp/ccXvUkmS") = 0 31920 unlink("f.elf.ltrans0.ltrans.o") = 0 31920 unlink("obj.a.debug.temp.o") = 0 31920 unlink("obj.a.debug.temp.o") = -1 ENOENT (No such file or directory) 31920 write(2, "/usr/bin/ld", 11) = 11 31920 write(2, ": error: could not unlink output"..., 38) = 38 which eventually ends up re-using the same temporary file multiple times for each archieve member. Going to fix that.