make/autoconf/flags-ldflags.m4
author dchuyko
Tue, 19 Jun 2018 18:18:46 +0300
changeset 50642 fff48b02d4a6
parent 50550 41ff671ed8cf
child 50733 a1d7444076e4
permissions -rw-r--r--
8198719: MethodHandleHelper.linkToStatic should drop MH arg Reviewed-by: vlivanov, dlong
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
49120
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
     1
#
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
     2
# Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
     3
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
     4
#
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
     5
# This code is free software; you can redistribute it and/or modify it
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
     6
# under the terms of the GNU General Public License version 2 only, as
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
     7
# published by the Free Software Foundation.  Oracle designates this
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
     8
# particular file as subject to the "Classpath" exception as provided
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
     9
# by Oracle in the LICENSE file that accompanied this code.
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    10
#
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    11
# This code is distributed in the hope that it will be useful, but WITHOUT
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    13
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    14
# version 2 for more details (a copy is included in the LICENSE file that
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    15
# accompanied this code).
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    16
#
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    17
# You should have received a copy of the GNU General Public License version
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    18
# 2 along with this work; if not, write to the Free Software Foundation,
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    19
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    20
#
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    21
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    22
# or visit www.oracle.com if you need additional information or have any
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    23
# questions.
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    24
#
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    25
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    26
################################################################################
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    27
#
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    28
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    29
AC_DEFUN([FLAGS_SETUP_LDFLAGS],
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    30
[
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    31
  FLAGS_SETUP_LDFLAGS_HELPER
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    32
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    33
  # Setup the target toolchain
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    34
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    35
  # On some platforms (mac) the linker warns about non existing -L dirs.
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    36
  # For any of the variants server, client or minimal, the dir matches the
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    37
  # variant name. The "main" variant should be used for linking. For the
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    38
  # rest, the dir is just server.
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    39
  if HOTSPOT_CHECK_JVM_VARIANT(server) || HOTSPOT_CHECK_JVM_VARIANT(client) \
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    40
      || HOTSPOT_CHECK_JVM_VARIANT(minimal); then
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    41
    TARGET_JVM_VARIANT_PATH=$JVM_VARIANT_MAIN
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    42
  else
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    43
    TARGET_JVM_VARIANT_PATH=server
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    44
  fi
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    45
  FLAGS_SETUP_LDFLAGS_CPU_DEP([TARGET])
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    46
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    47
  # Setup the build toolchain
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    48
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    49
  # When building a buildjdk, it's always only the server variant
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    50
  BUILD_JVM_VARIANT_PATH=server
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    51
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    52
  FLAGS_SETUP_LDFLAGS_CPU_DEP([BUILD], [OPENJDK_BUILD_])
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    53
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    54
  LDFLAGS_TESTLIB="$LDFLAGS_JDKLIB"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    55
  LDFLAGS_TESTEXE="$LDFLAGS_JDKEXE ${TARGET_LDFLAGS_JDK_LIBPATH}"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    56
  AC_SUBST(LDFLAGS_TESTLIB)
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    57
  AC_SUBST(LDFLAGS_TESTEXE)
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    58
])
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    59
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    60
################################################################################
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    61
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    62
# CPU independent LDFLAGS setup, used for both target and build toolchain.
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    63
AC_DEFUN([FLAGS_SETUP_LDFLAGS_HELPER],
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    64
[
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    65
  # Setup basic LDFLAGS
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    66
  if test "x$TOOLCHAIN_TYPE" = xgcc; then
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    67
    # If this is a --hash-style=gnu system, use --hash-style=both, why?
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    68
    # We have previously set HAS_GNU_HASH if this is the case
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    69
    if test -n "$HAS_GNU_HASH"; then
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    70
      BASIC_LDFLAGS="-Wl,--hash-style=both"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    71
      LIBJSIG_HASHSTYLE_LDFLAGS="-Wl,--hash-style=both"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    72
    fi
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    73
49199
986249df86ce 8199403: Require binutils 2.18 or newer
ihse
parents: 49120
diff changeset
    74
    # Add -z defs, to forbid undefined symbols in object files.
49120
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    75
    BASIC_LDFLAGS="$BASIC_LDFLAGS -Wl,-z,defs"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    76
49199
986249df86ce 8199403: Require binutils 2.18 or newer
ihse
parents: 49120
diff changeset
    77
    BASIC_LDFLAGS_JVM_ONLY="-Wl,-z,noexecstack -Wl,-O1 -Wl,-z,relro"
49120
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    78
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    79
    BASIC_LDFLAGS_JDK_LIB_ONLY="-Wl,-z,noexecstack"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    80
    LIBJSIG_NOEXECSTACK_LDFLAGS="-Wl,-z,noexecstack"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    81
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    82
  elif test "x$TOOLCHAIN_TYPE" = xclang; then
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    83
    BASIC_LDFLAGS_JVM_ONLY="-mno-omit-leaf-frame-pointer -mstack-alignment=16 \
49523
69c6eb97297f 8196724: Change macosx deployment target to 10.9
erikj
parents: 49425
diff changeset
    84
        -stdlib=libc++ -fPIC"
49120
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    85
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    86
  elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    87
    BASIC_LDFLAGS="-Wl,-z,defs"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    88
    BASIC_LDFLAGS_ONLYCXX="-norunpath"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    89
    BASIC_LDFLAGS_ONLYCXX_JDK_ONLY="-xnolib"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    90
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    91
    BASIC_LDFLAGS_JDK_ONLY="-ztext"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    92
    BASIC_LDFLAGS_JVM_ONLY="-library=%none -mt -z noversion"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    93
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    94
  elif test "x$TOOLCHAIN_TYPE" = xxlc; then
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    95
    BASIC_LDFLAGS="-b64 -brtl -bnolibpath -bexpall -bernotok -btextpsize:64K \
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    96
        -bdatapsize:64K -bstackpsize:64K"
50550
41ff671ed8cf 8204935: [aix] TOC overflow in libjvm.so (release build)
stuefe
parents: 49523
diff changeset
    97
    # libjvm.so has gotten too large for normal TOC size; compile with qpic=large and link with bigtoc
41ff671ed8cf 8204935: [aix] TOC overflow in libjvm.so (release build)
stuefe
parents: 49523
diff changeset
    98
    BASIC_LDFLAGS_JVM_ONLY="-Wl,-lC_r -bbigtoc"
49120
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    99
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   100
  elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   101
    BASIC_LDFLAGS="-nologo -opt:ref"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   102
    BASIC_LDFLAGS_JDK_ONLY="-incremental:no"
49425
e9cb414f94eb 8198652: Stop linking with -base:0x8000000 on Windows
erikj
parents: 49199
diff changeset
   103
    BASIC_LDFLAGS_JVM_ONLY="-opt:icf,8 -subsystem:windows"
49120
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   104
  fi
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   105
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   106
  # Setup OS-dependent LDFLAGS
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   107
  if test "x$TOOLCHAIN_TYPE" = xclang || test "x$TOOLCHAIN_TYPE" = xgcc; then
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   108
    if test "x$OPENJDK_TARGET_OS" = xmacosx; then
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   109
      # Assume clang or gcc.
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   110
      # FIXME: We should really generalize SET_SHARED_LIBRARY_ORIGIN instead.
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   111
      OS_LDFLAGS_JVM_ONLY="-Wl,-rpath,@loader_path/. -Wl,-rpath,@loader_path/.."
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   112
      OS_LDFLAGS_JDK_ONLY="-mmacosx-version-min=$MACOSX_VERSION_MIN"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   113
    fi
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   114
  fi
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   115
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   116
  # Setup debug level-dependent LDFLAGS
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   117
  if test "x$TOOLCHAIN_TYPE" = xgcc; then
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   118
    if test "x$OPENJDK_TARGET_OS" = xlinux; then
49199
986249df86ce 8199403: Require binutils 2.18 or newer
ihse
parents: 49120
diff changeset
   119
      if test x$DEBUG_LEVEL = xrelease; then
986249df86ce 8199403: Require binutils 2.18 or newer
ihse
parents: 49120
diff changeset
   120
        DEBUGLEVEL_LDFLAGS_JDK_ONLY="$DEBUGLEVEL_LDFLAGS_JDK_ONLY -Wl,-O1"
986249df86ce 8199403: Require binutils 2.18 or newer
ihse
parents: 49120
diff changeset
   121
      else
986249df86ce 8199403: Require binutils 2.18 or newer
ihse
parents: 49120
diff changeset
   122
        # mark relocations read only on (fast/slow) debug builds
986249df86ce 8199403: Require binutils 2.18 or newer
ihse
parents: 49120
diff changeset
   123
        DEBUGLEVEL_LDFLAGS_JDK_ONLY="-Wl,-z,relro"
986249df86ce 8199403: Require binutils 2.18 or newer
ihse
parents: 49120
diff changeset
   124
      fi
986249df86ce 8199403: Require binutils 2.18 or newer
ihse
parents: 49120
diff changeset
   125
      if test x$DEBUG_LEVEL = xslowdebug; then
986249df86ce 8199403: Require binutils 2.18 or newer
ihse
parents: 49120
diff changeset
   126
        # do relocations at load
986249df86ce 8199403: Require binutils 2.18 or newer
ihse
parents: 49120
diff changeset
   127
        DEBUGLEVEL_LDFLAGS="-Wl,-z,now"
986249df86ce 8199403: Require binutils 2.18 or newer
ihse
parents: 49120
diff changeset
   128
      fi
49120
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   129
    fi
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   130
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   131
  elif test "x$TOOLCHAIN_TYPE" = xxlc; then
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   132
    # We need '-qminimaltoc' or '-qpic=large -bbigtoc' if the TOC overflows.
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   133
    # Hotspot now overflows its 64K TOC (currently only for debug),
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   134
    # so we build with '-qpic=large -bbigtoc'.
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   135
    if test "x$DEBUG_LEVEL" != xrelease; then
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   136
      DEBUGLEVEL_LDFLAGS_JVM_ONLY="$DEBUGLEVEL_LDFLAGS_JVM_ONLY -bbigtoc"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   137
    fi
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   138
  fi
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   139
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   140
  # Setup LDFLAGS for linking executables
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   141
  if test "x$TOOLCHAIN_TYPE" = xgcc; then
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   142
    EXECUTABLE_LDFLAGS="$EXECUTABLE_LDFLAGS -Wl,--allow-shlib-undefined"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   143
  fi
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   144
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   145
  # Export some intermediate variables for compatibility
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   146
  LDFLAGS_CXX_JDK="$BASIC_LDFLAGS_ONLYCXX $BASIC_LDFLAGS_ONLYCXX_JDK_ONLY $DEBUGLEVEL_LDFLAGS_JDK_ONLY"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   147
  AC_SUBST(LDFLAGS_CXX_JDK)
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   148
  AC_SUBST(LIBJSIG_HASHSTYLE_LDFLAGS)
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   149
  AC_SUBST(LIBJSIG_NOEXECSTACK_LDFLAGS)
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   150
])
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   151
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   152
################################################################################
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   153
# $1 - Either BUILD or TARGET to pick the correct OS/CPU variables to check
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   154
#      conditionals against.
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   155
# $2 - Optional prefix for each variable defined.
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   156
AC_DEFUN([FLAGS_SETUP_LDFLAGS_CPU_DEP],
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   157
[
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   158
  # Setup CPU-dependent basic LDFLAGS. These can differ between the target and
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   159
  # build toolchain.
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   160
  if test "x$TOOLCHAIN_TYPE" = xgcc; then
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   161
    if test "x${OPENJDK_$1_CPU}" = xx86; then
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   162
      $1_CPU_LDFLAGS_JVM_ONLY="-march=i586"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   163
    elif test "x$OPENJDK_$1_CPU" = xarm; then
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   164
      $1_CPU_LDFLAGS_JVM_ONLY="${$1_CPU_LDFLAGS_JVM_ONLY} -fsigned-char"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   165
      $1_CPU_LDFLAGS="$ARM_ARCH_TYPE_FLAGS $ARM_FLOAT_TYPE_FLAGS"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   166
    elif test "x$FLAGS_CPU" = xaarch64; then
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   167
      if test "x$HOTSPOT_TARGET_CPU_PORT" = xarm64; then
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   168
        $1_CPU_LDFLAGS_JVM_ONLY="${$1_CPU_LDFLAGS_JVM_ONLY} -fsigned-char"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   169
      fi
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   170
    fi
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   171
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   172
  elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   173
    if test "x${OPENJDK_$1_CPU}" = "xsparcv9"; then
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   174
      $1_CPU_LDFLAGS_JVM_ONLY="-xarch=sparc"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   175
    fi
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   176
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   177
  elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   178
    if test "x${OPENJDK_$1_CPU}" = "xx86"; then
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   179
      $1_CPU_LDFLAGS="-safeseh"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   180
      # NOTE: Old build added -machine. Probably not needed.
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   181
      $1_CPU_LDFLAGS_JVM_ONLY="-machine:I386"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   182
      $1_CPU_EXECUTABLE_LDFLAGS="-stack:327680"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   183
    else
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   184
      $1_CPU_LDFLAGS_JVM_ONLY="-machine:AMD64"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   185
      $1_CPU_EXECUTABLE_LDFLAGS="-stack:1048576"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   186
    fi
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   187
  fi
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   188
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   189
  # JVM_VARIANT_PATH depends on if this is build or target...
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   190
  if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   191
    $1_LDFLAGS_JDK_LIBPATH="-libpath:${OUTPUTDIR}/support/modules_libs/java.base"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   192
  else
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   193
    $1_LDFLAGS_JDK_LIBPATH="-L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base \
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   194
        -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base/${$1_JVM_VARIANT_PATH}"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   195
  fi
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   196
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   197
  # Export variables according to old definitions, prefix with $2 if present.
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   198
  LDFLAGS_JDK_COMMON="$BASIC_LDFLAGS $BASIC_LDFLAGS_JDK_ONLY \
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   199
      $OS_LDFLAGS_JDK_ONLY $DEBUGLEVEL_LDFLAGS_JDK_ONLY ${$2EXTRA_LDFLAGS}"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   200
  $2LDFLAGS_JDKLIB="$LDFLAGS_JDK_COMMON $BASIC_LDFLAGS_JDK_LIB_ONLY \
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   201
      ${$1_LDFLAGS_JDK_LIBPATH} $SHARED_LIBRARY_FLAGS"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   202
  $2LDFLAGS_JDKEXE="$LDFLAGS_JDK_COMMON $EXECUTABLE_LDFLAGS \
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   203
      ${$1_CPU_EXECUTABLE_LDFLAGS}"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   204
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   205
  $2JVM_LDFLAGS="$BASIC_LDFLAGS $BASIC_LDFLAGS_JVM_ONLY $OS_LDFLAGS_JVM_ONLY \
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   206
      $DEBUGLEVEL_LDFLAGS $DEBUGLEVEL_LDFLAGS_JVM_ONLY $BASIC_LDFLAGS_ONLYCXX \
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   207
      ${$1_CPU_LDFLAGS} ${$1_CPU_LDFLAGS_JVM_ONLY} ${$2EXTRA_LDFLAGS}"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   208
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   209
  AC_SUBST($2LDFLAGS_JDKLIB)
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   210
  AC_SUBST($2LDFLAGS_JDKEXE)
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   211
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   212
  AC_SUBST($2JVM_LDFLAGS)
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   213
])