RFR: JDK-8148929: Suboptimal code generated when setting sysroot include with Solaris Studio
Erik Joelsson
erik.joelsson at oracle.com
Wed Feb 3 12:48:00 UTC 2016
Hello,
Please review this small fix for building on Solaris using a
devkit/sysroot. The Solaris Studio compiler does special inlining and
intrinsics with system calls, like memcpy. The problem is that it only
seems to do this if it finds the definition of the system call in a
header file in the /usr/include directory. See bug description and
comments for details.
I have found a way to work around this. Internally, the compiler adds
the option -I-xbuiltin to mark the start of the system header includes
when calling a sub process. By adding this to our SYSROOT_CFLAGS, the
special inlining is re-enabled.
Bug: https://bugs.openjdk.java.net/browse/JDK-8148929
Patch:
diff --git a/common/autoconf/flags.m4 b/common/autoconf/flags.m4
--- a/common/autoconf/flags.m4
+++ b/common/autoconf/flags.m4
@@ -80,8 +80,9 @@
if test "x$OPENJDK_TARGET_OS" = xsolaris; then
# Solaris Studio does not have a concept of sysroot. Instead
we must
# make sure the default include and lib dirs are appended to each
- # compile and link command line.
- $1SYSROOT_CFLAGS="-I[$]$1SYSROOT/usr/include"
+ # compile and link command line. Must also add -I-xbuiltin to
enable
+ # inlining of system functions and intrinsics.
+ $1SYSROOT_CFLAGS="-I-xbuiltin -I[$]$1SYSROOT/usr/include"
$1SYSROOT_LDFLAGS="-L[$]$1SYSROOT/usr/lib$OPENJDK_TARGET_CPU_ISADIR \
-L[$]$1SYSROOT/lib$OPENJDK_TARGET_CPU_ISADIR \
-L[$]$1SYSROOT/usr/ccs/lib$OPENJDK_TARGET_CPU_ISADIR"
/Erik
More information about the build-dev
mailing list