Sorting out LIBS. ihse-cflags-rewrite-branch
authorihse
Mon, 19 Feb 2018 11:37:43 +0100
branchihse-cflags-rewrite-branch
changeset 56147 fd62484132bc
parent 56146 d019a80c41c0
child 56148 2dc251b685a2
Sorting out LIBS.
make/autoconf/flags.m4
make/autoconf/lib-std.m4
make/autoconf/libraries.m4
--- a/make/autoconf/flags.m4	Mon Feb 19 11:08:33 2018 +0100
+++ b/make/autoconf/flags.m4	Mon Feb 19 11:37:43 2018 +0100
@@ -589,6 +589,7 @@
     BASIC_LDFLAGS_JVM_ONLY="-library=%none -mt -z noversion"
   elif test "x$TOOLCHAIN_TYPE" = xxlc; then
     BASIC_LDFLAGS="-b64 -brtl -bnolibpath -bexpall -bernotok -btextpsize:64K -bdatapsize:64K -bstackpsize:64K"
+    BASIC_LDFLAGS_JVM_ONLY="-Wl,-lC_r"
   elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
     BASIC_LDFLAGS="-nologo -opt:ref"
     BASIC_LDFLAGS_JDK_ONLY="-incremental:no"
@@ -689,9 +690,6 @@
   LIBRARY_LDFLAGS_JDK_ONLY="${SHARED_LIBRARY_FLAGS} ${LDFLAGS_NO_EXEC_STACK} $LDFLAGS_JDK_LIBPATH ${$2EXTRA_LDFLAGS_JDK} $BASIC_LDFLAGS_JDK_LIB_ONLY"
   $2LDFLAGS_JDKLIB="${LIBRARY_LDFLAGS_JDK_ONLY} "
 
-  # PER OS?
-    # LIBS: default libs
-
   ###############################################################################
   #
   # Now setup the CFLAGS and LDFLAGS for the JDK build.
@@ -958,39 +956,6 @@
   AC_SUBST($2CXXFLAGS_JDKEXE)
 
 
-  if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
-    $2JDKLIB_LIBS=""
-  else
-    $2JDKLIB_LIBS="-ljava -ljvm"
-    if test "x$TOOLCHAIN_TYPE" = xsolstudio; then
-      $2JDKLIB_LIBS="[$]$2JDKLIB_LIBS -lc"
-    fi
-  fi
-
-  # Set $2JVM_LIBS (per os)
-  if test "x$FLAGS_OS" = xlinux; then
-    $2JVM_LIBS="[$]$2JVM_LIBS -lm -ldl -lpthread"
-  elif test "x$FLAGS_OS" = xsolaris; then
-    # FIXME: This hard-coded path is not really proper.
-    if test "x$FLAGS_CPU" = xx86_64; then
-      $2SOLARIS_LIBM_LIBS="/usr/lib/amd64/libm.so.1"
-    elif test "x$FLAGS_CPU" = xsparcv9; then
-      $2SOLARIS_LIBM_LIBS="/usr/lib/sparcv9/libm.so.1"
-    fi
-    $2JVM_LIBS="[$]$2JVM_LIBS -lsocket -lsched -ldl $SOLARIS_LIBM_LIBS -lCrun \
-        -lthread -ldoor -lc -ldemangle -lnsl -lrt"
-  elif test "x$FLAGS_OS" = xmacosx; then
-    $2JVM_LIBS="[$]$2JVM_LIBS -lm"
-  elif test "x$FLAGS_OS" = xaix; then
-    $2JVM_LIBS="[$]$2JVM_LIBS -Wl,-lC_r -lm -ldl -lpthread"
-  elif test "x$FLAGS_OS" = xbsd; then
-    $2JVM_LIBS="[$]$2JVM_LIBS -lm"
-  elif test "x$FLAGS_OS" = xwindows; then
-    $2JVM_LIBS="[$]$2JVM_LIBS kernel32.lib user32.lib gdi32.lib winspool.lib \
-        comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib \
-        wsock32.lib winmm.lib version.lib psapi.lib"
-    fi
-
   # Set $2JVM_ASFLAGS
   if test "x$FLAGS_OS" = xlinux; then
     if test "x$FLAGS_CPU" = xx86; then
--- a/make/autoconf/lib-std.m4	Mon Feb 19 11:08:33 2018 +0100
+++ b/make/autoconf/lib-std.m4	Mon Feb 19 11:37:43 2018 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -81,6 +81,9 @@
   if test "x$TOOLCHAIN_TYPE" = xsolstudio && test "x$LIBCXX" = x; then
     LIBCXX="${SYSROOT}/usr/lib${OPENJDK_TARGET_CPU_ISADIR}/libCrun.so.1"
   fi
+  if test "x$TOOLCHAIN_TYPE" = xsolstudio; then
+    LIBCXX_JVM="-lCrun"
+  fi
 
   AC_SUBST(LIBCXX)
 
--- a/make/autoconf/libraries.m4	Mon Feb 19 11:08:33 2018 +0100
+++ b/make/autoconf/libraries.m4	Mon Feb 19 11:37:43 2018 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -101,6 +101,61 @@
   LIB_SETUP_BUNDLED_LIBS
   LIB_SETUP_MISC_LIBS
   LIB_SETUP_SOLARIS_STLPORT
+
+  if test "x$TOOLCHAIN_TYPE" = xsolstudio; then
+    ALWAYS_LIBS="-lc"
+  else
+    ALWAYS_LIBS=""
+  fi
+
+  BASIC_JDKLIB_LIBS=""
+  if test "x$TOOLCHAIN_TYPE" != xmicrosoft; then
+    BASIC_JDKLIB_LIBS="-ljava -ljvm"
+  fi
+  BASIC_JDKLIB_LIBS="$BASIC_JDKLIB_LIBS $ALWAYS_LIBS"
+
+  # Math library
+  if test "x$FLAGS_OS" != xsolaris; then
+    BASIC_JVM_LIBS="$LIBM"
+  else
+    # FIXME: This hard-coded path is not really proper.
+    if test "x$FLAGS_CPU" = xx86_64; then
+      BASIC_SOLARIS_LIBM_LIBS="/usr/lib/amd64/libm.so.1"
+    elif test "x$FLAGS_CPU" = xsparcv9; then
+      BASIC_SOLARIS_LIBM_LIBS="/usr/lib/sparcv9/libm.so.1"
+    fi
+    BASIC_JVM_LIBS="$BASIC_SOLARIS_LIBM_LIBS"
+  fi
+
+  # Dynamic loading library
+  if test "x$FLAGS_OS" = xlinux || test "x$FLAGS_OS" = xsolaris || test "x$FLAGS_OS" = xaix; then
+    BASIC_JVM_LIBS="$BASIC_JVM_LIBS $LIBDL"
+  fi
+
+  # Threading library
+  if test "x$FLAGS_OS" = xlinux || test "x$FLAGS_OS" = xaix; then
+    BASIC_JVM_LIBS="$BASIC_JVM_LIBS -lpthread"
+  elif test "x$FLAGS_OS" = xsolaris; then
+    BASIC_JVM_LIBS="$BASIC_JVM_LIBS -lthread"
+  fi
+
+  if test "x$FLAGS_OS" = xsolaris; then
+    BASIC_JVM_LIBS="$BASIC_JVM_LIBS -lsocket -lsched -ldoor -ldemangle -lnsl \
+        -lrt"
+    BASIC_JVM_LIBS="$BASIC_JVM_LIBS $LIBCXX_JVM"
+  fi
+
+  if test "x$FLAGS_OS" = xwindows; then
+    BASIC_JVM_LIBS="$BASIC_JVM_LIBS kernel32.lib user32.lib gdi32.lib winspool.lib \
+        comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib \
+        wsock32.lib winmm.lib version.lib psapi.lib"
+  fi
+  BASIC_JVM_LIBS="$BASIC_JVM_LIBS $ALWAYS_LIBS"
+
+  JDKLIB_LIBS="$BASIC_JDKLIB_LIBS"
+  JVM_LIBS="$BASIC_JVM_LIBS"
+  OPENJDK_BUILD_JDKLIB_LIBS="$BASIC_JDKLIB_LIBS"
+  OPENJDK_BUILD_JVM_LIBS="$BASIC_JVM_LIBS"
 ])
 
 ################################################################################