make/autoconf/flags-ldflags.m4
author eosterlund
Fri, 08 Jun 2018 11:30:10 +0200
changeset 50470 f3aac763a315
parent 49523 69c6eb97297f
child 50550 41ff671ed8cf
child 56726 3a9b7a1f9197
permissions -rw-r--r--
8204504: Fix for 8198285 breaks slowdebug builds Reviewed-by: rkennke, mgronlun
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"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    97
    BASIC_LDFLAGS_JVM_ONLY="-Wl,-lC_r"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    98
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    99
  elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   100
    BASIC_LDFLAGS="-nologo -opt:ref"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   101
    BASIC_LDFLAGS_JDK_ONLY="-incremental:no"
49425
e9cb414f94eb 8198652: Stop linking with -base:0x8000000 on Windows
erikj
parents: 49199
diff changeset
   102
    BASIC_LDFLAGS_JVM_ONLY="-opt:icf,8 -subsystem:windows"
49120
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   103
  fi
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   104
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   105
  # Setup OS-dependent LDFLAGS
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   106
  if test "x$TOOLCHAIN_TYPE" = xclang || test "x$TOOLCHAIN_TYPE" = xgcc; then
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   107
    if test "x$OPENJDK_TARGET_OS" = xmacosx; then
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   108
      # Assume clang or gcc.
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   109
      # FIXME: We should really generalize SET_SHARED_LIBRARY_ORIGIN instead.
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   110
      OS_LDFLAGS_JVM_ONLY="-Wl,-rpath,@loader_path/. -Wl,-rpath,@loader_path/.."
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   111
      OS_LDFLAGS_JDK_ONLY="-mmacosx-version-min=$MACOSX_VERSION_MIN"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   112
    fi
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
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   115
  # Setup debug level-dependent LDFLAGS
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   116
  if test "x$TOOLCHAIN_TYPE" = xgcc; then
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   117
    if test "x$OPENJDK_TARGET_OS" = xlinux; then
49199
986249df86ce 8199403: Require binutils 2.18 or newer
ihse
parents: 49120
diff changeset
   118
      if test x$DEBUG_LEVEL = xrelease; then
986249df86ce 8199403: Require binutils 2.18 or newer
ihse
parents: 49120
diff changeset
   119
        DEBUGLEVEL_LDFLAGS_JDK_ONLY="$DEBUGLEVEL_LDFLAGS_JDK_ONLY -Wl,-O1"
986249df86ce 8199403: Require binutils 2.18 or newer
ihse
parents: 49120
diff changeset
   120
      else
986249df86ce 8199403: Require binutils 2.18 or newer
ihse
parents: 49120
diff changeset
   121
        # mark relocations read only on (fast/slow) debug builds
986249df86ce 8199403: Require binutils 2.18 or newer
ihse
parents: 49120
diff changeset
   122
        DEBUGLEVEL_LDFLAGS_JDK_ONLY="-Wl,-z,relro"
986249df86ce 8199403: Require binutils 2.18 or newer
ihse
parents: 49120
diff changeset
   123
      fi
986249df86ce 8199403: Require binutils 2.18 or newer
ihse
parents: 49120
diff changeset
   124
      if test x$DEBUG_LEVEL = xslowdebug; then
986249df86ce 8199403: Require binutils 2.18 or newer
ihse
parents: 49120
diff changeset
   125
        # do relocations at load
986249df86ce 8199403: Require binutils 2.18 or newer
ihse
parents: 49120
diff changeset
   126
        DEBUGLEVEL_LDFLAGS="-Wl,-z,now"
986249df86ce 8199403: Require binutils 2.18 or newer
ihse
parents: 49120
diff changeset
   127
      fi
49120
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   128
    fi
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   129
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   130
  elif test "x$TOOLCHAIN_TYPE" = xxlc; then
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   131
    # We need '-qminimaltoc' or '-qpic=large -bbigtoc' if the TOC overflows.
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   132
    # Hotspot now overflows its 64K TOC (currently only for debug),
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   133
    # so we build with '-qpic=large -bbigtoc'.
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   134
    if test "x$DEBUG_LEVEL" != xrelease; then
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   135
      DEBUGLEVEL_LDFLAGS_JVM_ONLY="$DEBUGLEVEL_LDFLAGS_JVM_ONLY -bbigtoc"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   136
    fi
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
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   139
  # Setup LDFLAGS for linking executables
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   140
  if test "x$TOOLCHAIN_TYPE" = xgcc; then
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   141
    EXECUTABLE_LDFLAGS="$EXECUTABLE_LDFLAGS -Wl,--allow-shlib-undefined"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   142
  fi
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   143
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   144
  # Export some intermediate variables for compatibility
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   145
  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
   146
  AC_SUBST(LDFLAGS_CXX_JDK)
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   147
  AC_SUBST(LIBJSIG_HASHSTYLE_LDFLAGS)
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   148
  AC_SUBST(LIBJSIG_NOEXECSTACK_LDFLAGS)
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   149
])
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
# $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
   153
#      conditionals against.
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   154
# $2 - Optional prefix for each variable defined.
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   155
AC_DEFUN([FLAGS_SETUP_LDFLAGS_CPU_DEP],
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   156
[
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   157
  # Setup CPU-dependent basic LDFLAGS. These can differ between the target and
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   158
  # build toolchain.
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   159
  if test "x$TOOLCHAIN_TYPE" = xgcc; then
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   160
    if test "x${OPENJDK_$1_CPU}" = xx86; then
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   161
      $1_CPU_LDFLAGS_JVM_ONLY="-march=i586"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   162
    elif test "x$OPENJDK_$1_CPU" = xarm; then
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   163
      $1_CPU_LDFLAGS_JVM_ONLY="${$1_CPU_LDFLAGS_JVM_ONLY} -fsigned-char"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   164
      $1_CPU_LDFLAGS="$ARM_ARCH_TYPE_FLAGS $ARM_FLOAT_TYPE_FLAGS"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   165
    elif test "x$FLAGS_CPU" = xaarch64; then
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   166
      if test "x$HOTSPOT_TARGET_CPU_PORT" = xarm64; then
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   167
        $1_CPU_LDFLAGS_JVM_ONLY="${$1_CPU_LDFLAGS_JVM_ONLY} -fsigned-char"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   168
      fi
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
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   171
  elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   172
    if test "x${OPENJDK_$1_CPU}" = "xsparcv9"; then
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   173
      $1_CPU_LDFLAGS_JVM_ONLY="-xarch=sparc"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   174
    fi
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   175
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   176
  elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   177
    if test "x${OPENJDK_$1_CPU}" = "xx86"; then
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   178
      $1_CPU_LDFLAGS="-safeseh"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   179
      # NOTE: Old build added -machine. Probably not needed.
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   180
      $1_CPU_LDFLAGS_JVM_ONLY="-machine:I386"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   181
      $1_CPU_EXECUTABLE_LDFLAGS="-stack:327680"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   182
    else
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   183
      $1_CPU_LDFLAGS_JVM_ONLY="-machine:AMD64"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   184
      $1_CPU_EXECUTABLE_LDFLAGS="-stack:1048576"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   185
    fi
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
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   188
  # JVM_VARIANT_PATH depends on if this is build or target...
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   189
  if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   190
    $1_LDFLAGS_JDK_LIBPATH="-libpath:${OUTPUTDIR}/support/modules_libs/java.base"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   191
  else
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   192
    $1_LDFLAGS_JDK_LIBPATH="-L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base \
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   193
        -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base/${$1_JVM_VARIANT_PATH}"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   194
  fi
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   195
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   196
  # Export variables according to old definitions, prefix with $2 if present.
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   197
  LDFLAGS_JDK_COMMON="$BASIC_LDFLAGS $BASIC_LDFLAGS_JDK_ONLY \
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   198
      $OS_LDFLAGS_JDK_ONLY $DEBUGLEVEL_LDFLAGS_JDK_ONLY ${$2EXTRA_LDFLAGS}"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   199
  $2LDFLAGS_JDKLIB="$LDFLAGS_JDK_COMMON $BASIC_LDFLAGS_JDK_LIB_ONLY \
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   200
      ${$1_LDFLAGS_JDK_LIBPATH} $SHARED_LIBRARY_FLAGS"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   201
  $2LDFLAGS_JDKEXE="$LDFLAGS_JDK_COMMON $EXECUTABLE_LDFLAGS \
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   202
      ${$1_CPU_EXECUTABLE_LDFLAGS}"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   203
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   204
  $2JVM_LDFLAGS="$BASIC_LDFLAGS $BASIC_LDFLAGS_JVM_ONLY $OS_LDFLAGS_JVM_ONLY \
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   205
      $DEBUGLEVEL_LDFLAGS $DEBUGLEVEL_LDFLAGS_JVM_ONLY $BASIC_LDFLAGS_ONLYCXX \
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   206
      ${$1_CPU_LDFLAGS} ${$1_CPU_LDFLAGS_JVM_ONLY} ${$2EXTRA_LDFLAGS}"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   207
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   208
  AC_SUBST($2LDFLAGS_JDKLIB)
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   209
  AC_SUBST($2LDFLAGS_JDKEXE)
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   210
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   211
  AC_SUBST($2JVM_LDFLAGS)
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   212
])