Stop the assembler from complaining that the input and output files are the same...
authorNick Clifton <nickc@redhat.com>
Fri, 6 Mar 2020 10:44:12 +0000 (10:44 +0000)
committerNick Clifton <nickc@redhat.com>
Fri, 6 Mar 2020 10:44:12 +0000 (10:44 +0000)
PR 25572
* as.c (main): Allow matching input and outputs when they are
not regular files.

gas/ChangeLog
gas/as.c

index f81ec12b9daafef718e8d3dbc5b71c9c28c6952c..e2984b59c7f1cde0877d80f8dffd3c4d9624704d 100644 (file)
@@ -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
index d8d20cca76fd4f8b12f0a75c17a4f4a8da0013e7..51bb7210ec825a7bc63f1858d973f1ca8be6b167 100644 (file)
--- 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;
 
This page took 0.028718 seconds and 4 git commands to generate.