[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug ld/31761] Linker deletes output file even if linking fails
From: |
nickc at redhat dot com |
Subject: |
[Bug ld/31761] Linker deletes output file even if linking fails |
Date: |
Tue, 28 May 2024 16:07:26 +0000 |
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.
- [Bug ld/31761] New: Linker deletes output file even if linking fails, peter0x44 at disroot dot org, 2024/05/20
- [Bug ld/31761] Linker deletes output file even if linking fails, peter0x44 at disroot dot org, 2024/05/20
- [Bug ld/31761] Linker deletes output file even if linking fails, address@hidden, 2024/05/20
- [Bug ld/31761] Linker deletes output file even if linking fails, peter0x44 at disroot dot org, 2024/05/20
- [Bug ld/31761] Linker deletes output file even if linking fails,
nickc at redhat dot com <=
- [Bug ld/31761] Linker deletes output file even if linking fails, peter0x44 at disroot dot org, 2024/05/28
- [Bug ld/31761] Linker deletes output file even if linking fails, peter0x44 at disroot dot org, 2024/05/28
- [Bug ld/31761] Linker deletes output file even if linking fails, sam at gentoo dot org, 2024/05/28
- [Bug ld/31761] Linker deletes output file even if linking fails, amodra at gmail dot com, 2024/05/29
- [Bug ld/31761] Linker deletes output file even if linking fails, nickc at redhat dot com, 2024/05/29
- [Bug ld/31761] Linker deletes output file even if linking fails, peter0x44 at disroot dot org, 2024/05/29