bug-binutils
[Top][All Lists]
Advanced

[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: Wed, 29 May 2024 09:28:00 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=31761

--- Comment #7 from Nick Clifton <nickc at redhat dot com> ---
(In reply to Peter Damianov from comment #5)
> Just to be completely clear, the command is incorrect, but the way ld reacts
> to the mistake is the problem. In this case, the "file.c" will be deleted,
> the user has potentially lost a file, and day ruined. I think refusing to
> delete output here is the correct and preferable thing to do.

It may seem callous, but if you are using command line tools to build programs
then I would argue that a certain level of competence is expected, and that
loosing a source file to a silly mistake is actually a useful lesson.

But maybe a compromise solution can be reached here.  As Alan pointed out,
setting the output file name to the name of an existing source file is going to
cause problems regardless of whether the link succeeds or fails.  So maybe the
correct thing to do is to have the "-o <file>" option fail if the output name
matches the name of an existing file *and* that name matches a pattern of known
source files (eg *.[cChosS] *.cpp) ?

What do you think ?

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]