RFR: JDK-8200267 a.out created at top dir by Solaris build

Magnus Ihse Bursie magnus.ihse.bursie at oracle.com
Tue Apr 3 13:11:44 UTC 2018

There's an unwanted a.out in the top directory when building with Solaris.

This one was actually a bit tricky to hunt down. It is created by ld 
when extracting the version information, but only when the output of ld 
is piped to head. I'm guessing this has something to do with how Solaris 
handles pipes; perhaps head closes the pipe "forcefully" after it has 
recieved it's single line, causing ld to not being able to clean up the 
temporary a.out that it has created. The patch below solves the issue, 
at any rate.

Bug: https://bugs.openjdk.java.net/browse/JDK-8200267
Patch inline:
diff --git a/make/autoconf/toolchain.m4 b/make/autoconf/toolchain.m4
--- a/make/autoconf/toolchain.m4
+++ b/make/autoconf/toolchain.m4
@@ -597,8 +597,9 @@

      # solstudio cc requires us to have an existing file to pass as 
      # but it need not be a syntactically correct C file, so just use
-    # ourself. :)
-    LINKER_VERSION_STRING=`$LD -Wl,-V $TOPDIR/configure 2>&1 | $HEAD -n 
1 | $SED -e 's/ld: //'`
+    # ourself. :) The intermediate 'cat' is needed to stop ld from leaving
+    # a lingering a.out (!).
+    LINKER_VERSION_STRING=`$LD -Wl,-V $TOPDIR/configure 2>&1 | $CAT | 
$HEAD -n 1 | $SED -e 's/ld: //'`
      # Extract version number
          $SED -e 's/.* 
\([0-9][0-9]*\.[0-9][0-9]*\)-\([0-9][0-9]*\.[0-9][0-9]*\)/\1.\2/'` ]


More information about the build-dev mailing list