https://sourceware.org/bugzilla/show_bug.cgi?id=23153
Bug ID: 23153 Summary: gas: distinct input and output files are not properly detected on not-fully-emulated POSIX platforms Product: binutils Version: 2.31 (HEAD) Status: UNCONFIRMED Severity: critical Priority: P2 Component: gas Assignee: unassigned at sourceware dot org Reporter: pexu at sourceware dot mail.kapsi.fi Target Milestone: --- As of commit 67f846b59b32f3d704c601669409c2584383fea9 gas tries to use simple heuristics to determine if the given input and output files are distinct (at gas/as.c). The files are stat()'d and then the `st_ino' members compared. The logic is sound on 100% POSIX conforming platforms, however, the same cannot be said for e.g. MinGW. MinGW uses a zero `st_ino' for any (existing) file (based on a quick search this is by design, so not likely to change anytime soon). Thus, if all input and output files exist, gas will spit out "The input and output files must be distinct", which is not true. As a funny side-effect, even if the input and output file are determined as ``non-distinct'', something within the GCC chain still removes the output file. So, any even invocation will fail, while any odd invocation will succeed -- which is utterly confusing unless one takes a look at the source code and is aware of the POSIX internals at some level. Anyway, this commit effectively hinders any platform that does not supply an unique `st_ino' for a given file. Given that gas has been working just fine (and it ain't a filesystem utility), right out-of-the-box, for a long time without this, be it a native or a cross-compiling build, I see that this commit causes much, much more harm than good. (Cygwin is not affected by this, as it appears to emulate an unique `st_ino'.) -- You are receiving this mail because: You are on the CC list for the bug. _______________________________________________ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils