diff mbox

Fix native Windows x86 bootstrap failure with self test

Message ID VI1PR0801MB20312992BF74F3F5DABC9612FFA20@VI1PR0801MB2031.eurprd08.prod.outlook.com
State New
Headers show

Commit Message

Tamar Christina Nov. 4, 2016, 1:22 p.m. UTC
Hi all,

The GCC self-test added in r237144 breaks the
native Windows x86 builds (e.g. mingw-w64).
This fixes (PR78196) by explicitly adding /dev/null as
the output file to the GCC self test.

The test essentially does `-xc -S -c /dev/null -fself-test`

`/dev/null` is then converted into the Windows null device `nul`
by the MSYS shell, which is correct. But then the driver adds a
filename to the name, trying to write the output to `nul.s`.
`nul` is a reserved filename on Windows. As such it's invalid
to create this file and the call always fails using CreateFile.

Checked with x86_64-w64-mingw32 and build gets passed self tests
but dies at unrelated libstdc++ and libvtv errors.

Ok for trunk?

Thanks,
Tamar

gcc/

2016-11-03  Tamar Christina  <tamar.christina@arm.com>

	PR driver/78196
	* Makefile.in (SELFTEST_FLAGS): Added -o /dev/null.

Comments

JonY Nov. 5, 2016, 12:47 a.m. UTC | #1
On 11/4/2016 21:22, Tamar Christina wrote:
> Hi all,

> 

> The GCC self-test added in r237144 breaks the

> native Windows x86 builds (e.g. mingw-w64).

> This fixes (PR78196) by explicitly adding /dev/null as

> the output file to the GCC self test.

> 

> The test essentially does `-xc -S -c /dev/null -fself-test`

> 

> `/dev/null` is then converted into the Windows null device `nul`

> by the MSYS shell, which is correct. But then the driver adds a

> filename to the name, trying to write the output to `nul.s`.

> `nul` is a reserved filename on Windows. As such it's invalid

> to create this file and the call always fails using CreateFile.

> 

> Checked with x86_64-w64-mingw32 and build gets passed self tests

> but dies at unrelated libstdc++ and libvtv errors.

> 

> Ok for trunk?

> 


Patch is good, go ahead.
diff mbox

Patch

diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 622d038f6fb50c35ff48bc84a69967071aa17e90..7ecd1e4e726e4cb31b1c9fe22dcb777e71468fb2 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -1879,7 +1879,10 @@  rest.cross: specs
 # Specify a dummy input file to placate the driver.
 # Specify -nostdinc to work around missing WIND_BASE environment variable
 # required for *-wrs-vxworks-* targets.
-SELFTEST_FLAGS = -nostdinc -x c /dev/null -S -fself-test
+# Specify -o /dev/null so the output of -S is discarded. More importantly
+# It does not try to create a file with the name "null.s" on POSIX and
+# "nul.s" on Windows. Because on Windows "nul" is a reserved file name.
+SELFTEST_FLAGS = -nostdinc -x c /dev/null -S -fself-test -o /dev/null
 
 # Run the selftests during the build once we have a driver and a cc1,
 # so that self-test failures are caught as early as possible.