https://sourceware.org/bugzilla/show_bug.cgi?id=31761
Nick Clifton <nickc at redhat dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |nickc at redhat dot com --- Comment #3 from Nick Clifton <nickc at redhat dot com> --- Hi Peter, Can I check your testcase please ? > gcc -o file.c -lm You appear to be creating an output file called "file.c", is that right ? You also do not appear to have an input file. I am assuming that the test shpould have been something like this: gcc -o foo file.c -lm And then the problem is that "foo" is overwritten. I would argue that the linker's behaviour is correct (and that lld and mold are wrong). The reason being that if the output file is not deleted then it is harder for a user or script to detect that a problem has occurred. Consider a scenario like this: <user modifies their program> <user builds their program, but does not examine all the output messages> <user runs the built program - it works> If the link step fails, but does not delete the output file, then the user, not realizing that something went wrong, will run the old executable, see that it works and think that their change is correct. Cheers Nick -- You are receiving this mail because: You are on the CC list for the bug.