Hi. I think using /dev/null for both input and output is useful, but the assembler emits this warning: $ gcc -c -x assembler /dev/null -o /dev/null Assembler messages: Fatal error: The input '/dev/null' and output '/dev/null' files are the same This is especially useful to check whether a particular flag is supported or not. $ gcc -Wa,<some-assembler-flag> -c -x assembler /dev/null -o /dev/null or $ as <some-assembler-flag> /dev/null -o /dev/null Then, check the exit code. This technique is widely used in the Linux kernel build system. However, with the current binutils, this always exits with 1 with the 'files are the same' warning. We could work around it by using /dev/zero as a data sink, but this looks a bit strange. $ gcc -Wa,<some-assembler-flag> -c -x assembler /dev/null -o /dev/zero This was reported here https://patchwork.kernel.org/patch/11347227/ I think device files should be excluded from the same-file check.
Created attachment 12333 [details] Proposed patch Hi Masahiro, Would a patch like this work for you ? Cheers Nick
Looks good to me.
Hi Nick, Worked for me. Tested-by: Masahiro Yamada <masahiroy@kernel.org>
The master branch has been updated by Nick Clifton <nickc@sourceware.org>: 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.
Patch applied.