[binutils-gdb] Stop the assembler from complaining that the input and output files are the same, if neither of them
Nick Clifton
nickc@sourceware.org
Fri Mar 6 10:45:00 GMT 2020
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=3c968de5c7d1719b2f9b538f2f7f5f5922e5f311
commit 3c968de5c7d1719b2f9b538f2f7f5f5922e5f311
Author: Nick Clifton <nickc@redhat.com>
Date: Fri Mar 6 10:44:12 2020 +0000
Stop the assembler from complaining that the input and output files are the same, if neither of them are regular files.
PR 25572
* as.c (main): Allow matching input and outputs when they are
not regular files.
Diff:
---
gas/ChangeLog | 6 ++++++
gas/as.c | 8 +++++++-
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/gas/ChangeLog b/gas/ChangeLog
index f81ec12..e2984b5 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,9 @@
+2020-03-06 Nick Clifton <nickc@redhat.com>
+
+ PR 25572
+ * as.c (main): Allow matching input and outputs when they are
+ not regular files.
+
2020-03-06 Jan Beulich <jbeulich@suse.com>
* config/tc-i386.c (match_mem_size): Generalize broadcast special
diff --git a/gas/as.c b/gas/as.c
index d8d20cc..51bb721 100644
--- a/gas/as.c
+++ b/gas/as.c
@@ -1290,7 +1290,13 @@ main (int argc, char ** argv)
/* Different files may have the same inode number if they
reside on different devices, so check the st_dev field as
well. */
- && sib.st_dev == sob.st_dev)
+ && sib.st_dev == sob.st_dev
+ /* PR 25572: Only check regular files. Devices, sockets and so
+ on might actually work as both input and output. Plus there
+ is a use case for using /dev/null as both input and output
+ when checking for command line option support in a script:
+ as --foo /dev/null -o /dev/null; if $? then ... */
+ && S_ISREG (sib.st_mode))
{
const char *saved_out_file_name = out_file_name;
More information about the Binutils-cvs
mailing list