RFR: JDK-8148929: Suboptimal code generated when setting sysroot include with Solaris Studio
david.holmes at oracle.com
Wed Feb 3 12:59:06 UTC 2016
On 3/02/2016 10:48 PM, Erik Joelsson wrote:
> 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.
We have no way of knowing whether that will mess with the compilers use
of other header files. We seem to be on very thin ice here. We know it
fixes this one problem, but we don't know what else it may do!
> Bug: https://bugs.openjdk.java.net/browse/JDK-8148929
> 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
> + # 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 \
More information about the build-dev