make/autoconf/flags-ldflags.m4
author ihse
Mon, 04 Nov 2019 11:15:45 +0100
changeset 58909 66f7d2494d4e
parent 54790 b77bf7f216f4
child 58665 30a5049a36bb
child 59286 a2441ac23eeb
permissions -rw-r--r--
8233383: Various minor fixes Reviewed-by: erikj
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
49120
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
     1
#
54790
b77bf7f216f4 8223307: enable the Stack Execution Disable flag for JDK binaries on AIX
mbaesken
parents: 52351
diff changeset
     2
# Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
49120
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
51814
43668e3cae4d 8210920: Native C++ tests are not using CXXFLAGS
ihse
parents: 51805
diff changeset
    54
  LDFLAGS_TESTEXE="${TARGET_LDFLAGS_JDK_LIBPATH}"
49120
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    55
  AC_SUBST(LDFLAGS_TESTEXE)
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    56
])
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    57
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
# CPU independent LDFLAGS setup, used for both target and build toolchain.
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    61
AC_DEFUN([FLAGS_SETUP_LDFLAGS_HELPER],
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    62
[
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    63
  # Setup basic LDFLAGS
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    64
  if test "x$TOOLCHAIN_TYPE" = xgcc; then
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    65
    # If this is a --hash-style=gnu system, use --hash-style=both, why?
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    66
    # We have previously set HAS_GNU_HASH if this is the case
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    67
    if test -n "$HAS_GNU_HASH"; then
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    68
      BASIC_LDFLAGS="-Wl,--hash-style=both"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    69
      LIBJSIG_HASHSTYLE_LDFLAGS="-Wl,--hash-style=both"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    70
    fi
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    71
49199
986249df86ce 8199403: Require binutils 2.18 or newer
ihse
parents: 49120
diff changeset
    72
    # Add -z defs, to forbid undefined symbols in object files.
49120
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    73
    BASIC_LDFLAGS="$BASIC_LDFLAGS -Wl,-z,defs"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    74
51805
eb2adb0a9b09 8209817: stack is executable when building with Clang on Linux
martin
parents: 50733
diff changeset
    75
    BASIC_LDFLAGS_JVM_ONLY="-Wl,-O1 -Wl,-z,relro"
49120
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    76
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    77
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    78
  elif test "x$TOOLCHAIN_TYPE" = xclang; then
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    79
    BASIC_LDFLAGS_JVM_ONLY="-mno-omit-leaf-frame-pointer -mstack-alignment=16 \
50733
a1d7444076e4 8205197: Never default to using libc++ on Linux
martin
parents: 50550
diff changeset
    80
        -fPIC"
49120
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" = xsolstudio; then
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    83
    BASIC_LDFLAGS="-Wl,-z,defs"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    84
    BASIC_LDFLAGS_ONLYCXX="-norunpath"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    85
    BASIC_LDFLAGS_ONLYCXX_JDK_ONLY="-xnolib"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    86
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    87
    BASIC_LDFLAGS_JDK_ONLY="-ztext"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    88
    BASIC_LDFLAGS_JVM_ONLY="-library=%none -mt -z noversion"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    89
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    90
  elif test "x$TOOLCHAIN_TYPE" = xxlc; then
54790
b77bf7f216f4 8223307: enable the Stack Execution Disable flag for JDK binaries on AIX
mbaesken
parents: 52351
diff changeset
    91
    BASIC_LDFLAGS="-b64 -brtl -bnorwexec -bnolibpath -bexpall -bernotok -btextpsize:64K \
49120
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    92
        -bdatapsize:64K -bstackpsize:64K"
50550
41ff671ed8cf 8204935: [aix] TOC overflow in libjvm.so (release build)
stuefe
parents: 49523
diff changeset
    93
    # 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
    94
    BASIC_LDFLAGS_JVM_ONLY="-Wl,-lC_r -bbigtoc"
49120
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    95
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    96
  elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    97
    BASIC_LDFLAGS="-nologo -opt:ref"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
    98
    BASIC_LDFLAGS_JDK_ONLY="-incremental:no"
49425
e9cb414f94eb 8198652: Stop linking with -base:0x8000000 on Windows
erikj
parents: 49199
diff changeset
    99
    BASIC_LDFLAGS_JVM_ONLY="-opt:icf,8 -subsystem:windows"
49120
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   100
  fi
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   101
51805
eb2adb0a9b09 8209817: stack is executable when building with Clang on Linux
martin
parents: 50733
diff changeset
   102
  if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang; then
eb2adb0a9b09 8209817: stack is executable when building with Clang on Linux
martin
parents: 50733
diff changeset
   103
    if test -n "$HAS_NOEXECSTACK"; then
eb2adb0a9b09 8209817: stack is executable when building with Clang on Linux
martin
parents: 50733
diff changeset
   104
      BASIC_LDFLAGS="$BASIC_LDFLAGS -Wl,-z,noexecstack"
eb2adb0a9b09 8209817: stack is executable when building with Clang on Linux
martin
parents: 50733
diff changeset
   105
    fi
eb2adb0a9b09 8209817: stack is executable when building with Clang on Linux
martin
parents: 50733
diff changeset
   106
  fi
eb2adb0a9b09 8209817: stack is executable when building with Clang on Linux
martin
parents: 50733
diff changeset
   107
49120
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   108
  # Setup OS-dependent LDFLAGS
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   109
  if test "x$TOOLCHAIN_TYPE" = xclang || test "x$TOOLCHAIN_TYPE" = xgcc; then
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   110
    if test "x$OPENJDK_TARGET_OS" = xmacosx; then
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   111
      # Assume clang or gcc.
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   112
      # FIXME: We should really generalize SET_SHARED_LIBRARY_ORIGIN instead.
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   113
      OS_LDFLAGS_JVM_ONLY="-Wl,-rpath,@loader_path/. -Wl,-rpath,@loader_path/.."
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   114
      OS_LDFLAGS_JDK_ONLY="-mmacosx-version-min=$MACOSX_VERSION_MIN"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   115
    fi
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   116
  fi
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   117
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   118
  # Setup debug level-dependent LDFLAGS
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   119
  if test "x$TOOLCHAIN_TYPE" = xgcc; then
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   120
    if test "x$OPENJDK_TARGET_OS" = xlinux; then
49199
986249df86ce 8199403: Require binutils 2.18 or newer
ihse
parents: 49120
diff changeset
   121
      if test x$DEBUG_LEVEL = xrelease; then
986249df86ce 8199403: Require binutils 2.18 or newer
ihse
parents: 49120
diff changeset
   122
        DEBUGLEVEL_LDFLAGS_JDK_ONLY="$DEBUGLEVEL_LDFLAGS_JDK_ONLY -Wl,-O1"
986249df86ce 8199403: Require binutils 2.18 or newer
ihse
parents: 49120
diff changeset
   123
      else
986249df86ce 8199403: Require binutils 2.18 or newer
ihse
parents: 49120
diff changeset
   124
        # mark relocations read only on (fast/slow) debug builds
986249df86ce 8199403: Require binutils 2.18 or newer
ihse
parents: 49120
diff changeset
   125
        DEBUGLEVEL_LDFLAGS_JDK_ONLY="-Wl,-z,relro"
986249df86ce 8199403: Require binutils 2.18 or newer
ihse
parents: 49120
diff changeset
   126
      fi
986249df86ce 8199403: Require binutils 2.18 or newer
ihse
parents: 49120
diff changeset
   127
      if test x$DEBUG_LEVEL = xslowdebug; then
986249df86ce 8199403: Require binutils 2.18 or newer
ihse
parents: 49120
diff changeset
   128
        # do relocations at load
986249df86ce 8199403: Require binutils 2.18 or newer
ihse
parents: 49120
diff changeset
   129
        DEBUGLEVEL_LDFLAGS="-Wl,-z,now"
986249df86ce 8199403: Require binutils 2.18 or newer
ihse
parents: 49120
diff changeset
   130
      fi
49120
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   131
    fi
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   132
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   133
  elif test "x$TOOLCHAIN_TYPE" = xxlc; then
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   134
    # We need '-qminimaltoc' or '-qpic=large -bbigtoc' if the TOC overflows.
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   135
    # Hotspot now overflows its 64K TOC (currently only for debug),
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   136
    # so we build with '-qpic=large -bbigtoc'.
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   137
    if test "x$DEBUG_LEVEL" != xrelease; then
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   138
      DEBUGLEVEL_LDFLAGS_JVM_ONLY="$DEBUGLEVEL_LDFLAGS_JVM_ONLY -bbigtoc"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   139
    fi
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   140
  fi
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   141
51839
ab54a4d61d7f 8210988: Improved handling of compiler warnings in the build
ihse
parents: 51814
diff changeset
   142
  # Setup warning flags
ab54a4d61d7f 8210988: Improved handling of compiler warnings in the build
ihse
parents: 51814
diff changeset
   143
  if test "x$TOOLCHAIN_TYPE" = xsolstudio; then
ab54a4d61d7f 8210988: Improved handling of compiler warnings in the build
ihse
parents: 51814
diff changeset
   144
    LDFLAGS_WARNINGS_ARE_ERRORS="-Wl,-z,fatal-warnings"
ab54a4d61d7f 8210988: Improved handling of compiler warnings in the build
ihse
parents: 51814
diff changeset
   145
  else
ab54a4d61d7f 8210988: Improved handling of compiler warnings in the build
ihse
parents: 51814
diff changeset
   146
    LDFLAGS_WARNINGS_ARE_ERRORS=""
ab54a4d61d7f 8210988: Improved handling of compiler warnings in the build
ihse
parents: 51814
diff changeset
   147
  fi
ab54a4d61d7f 8210988: Improved handling of compiler warnings in the build
ihse
parents: 51814
diff changeset
   148
  AC_SUBST(LDFLAGS_WARNINGS_ARE_ERRORS)
ab54a4d61d7f 8210988: Improved handling of compiler warnings in the build
ihse
parents: 51814
diff changeset
   149
49120
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   150
  # Setup LDFLAGS for linking executables
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   151
  if test "x$TOOLCHAIN_TYPE" = xgcc; then
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   152
    EXECUTABLE_LDFLAGS="$EXECUTABLE_LDFLAGS -Wl,--allow-shlib-undefined"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   153
  fi
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   154
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   155
  # Export some intermediate variables for compatibility
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   156
  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
   157
  AC_SUBST(LDFLAGS_CXX_JDK)
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   158
  AC_SUBST(LIBJSIG_HASHSTYLE_LDFLAGS)
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   159
  AC_SUBST(LIBJSIG_NOEXECSTACK_LDFLAGS)
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   160
])
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   161
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   162
################################################################################
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   163
# $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
   164
#      conditionals against.
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   165
# $2 - Optional prefix for each variable defined.
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   166
AC_DEFUN([FLAGS_SETUP_LDFLAGS_CPU_DEP],
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   167
[
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   168
  # Setup CPU-dependent basic LDFLAGS. These can differ between the target and
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   169
  # build toolchain.
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   170
  if test "x$TOOLCHAIN_TYPE" = xgcc; then
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   171
    if test "x${OPENJDK_$1_CPU}" = xx86; then
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   172
      $1_CPU_LDFLAGS_JVM_ONLY="-march=i586"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   173
    elif test "x$OPENJDK_$1_CPU" = xarm; then
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   174
      $1_CPU_LDFLAGS_JVM_ONLY="${$1_CPU_LDFLAGS_JVM_ONLY} -fsigned-char"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   175
      $1_CPU_LDFLAGS="$ARM_ARCH_TYPE_FLAGS $ARM_FLOAT_TYPE_FLAGS"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   176
    fi
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   177
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   178
  elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   179
    if test "x${OPENJDK_$1_CPU}" = "xsparcv9"; then
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   180
      $1_CPU_LDFLAGS_JVM_ONLY="-xarch=sparc"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   181
    fi
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   182
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   183
  elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   184
    if test "x${OPENJDK_$1_CPU}" = "xx86"; then
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   185
      $1_CPU_LDFLAGS="-safeseh"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   186
      # NOTE: Old build added -machine. Probably not needed.
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   187
      $1_CPU_LDFLAGS_JVM_ONLY="-machine:I386"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   188
      $1_CPU_EXECUTABLE_LDFLAGS="-stack:327680"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   189
    else
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   190
      $1_CPU_LDFLAGS_JVM_ONLY="-machine:AMD64"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   191
      $1_CPU_EXECUTABLE_LDFLAGS="-stack:1048576"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   192
    fi
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   193
  fi
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   194
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   195
  # JVM_VARIANT_PATH depends on if this is build or target...
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   196
  if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   197
    $1_LDFLAGS_JDK_LIBPATH="-libpath:${OUTPUTDIR}/support/modules_libs/java.base"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   198
  else
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   199
    $1_LDFLAGS_JDK_LIBPATH="-L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base \
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   200
        -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base/${$1_JVM_VARIANT_PATH}"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   201
  fi
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   202
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   203
  # Export variables according to old definitions, prefix with $2 if present.
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   204
  LDFLAGS_JDK_COMMON="$BASIC_LDFLAGS $BASIC_LDFLAGS_JDK_ONLY \
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   205
      $OS_LDFLAGS_JDK_ONLY $DEBUGLEVEL_LDFLAGS_JDK_ONLY ${$2EXTRA_LDFLAGS}"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   206
  $2LDFLAGS_JDKLIB="$LDFLAGS_JDK_COMMON $BASIC_LDFLAGS_JDK_LIB_ONLY \
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   207
      ${$1_LDFLAGS_JDK_LIBPATH} $SHARED_LIBRARY_FLAGS"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   208
  $2LDFLAGS_JDKEXE="$LDFLAGS_JDK_COMMON $EXECUTABLE_LDFLAGS \
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   209
      ${$1_CPU_EXECUTABLE_LDFLAGS}"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   210
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   211
  $2JVM_LDFLAGS="$BASIC_LDFLAGS $BASIC_LDFLAGS_JVM_ONLY $OS_LDFLAGS_JVM_ONLY \
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   212
      $DEBUGLEVEL_LDFLAGS $DEBUGLEVEL_LDFLAGS_JVM_ONLY $BASIC_LDFLAGS_ONLYCXX \
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   213
      ${$1_CPU_LDFLAGS} ${$1_CPU_LDFLAGS_JVM_ONLY} ${$2EXTRA_LDFLAGS}"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   214
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   215
  AC_SUBST($2LDFLAGS_JDKLIB)
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   216
  AC_SUBST($2LDFLAGS_JDKEXE)
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   217
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   218
  AC_SUBST($2JVM_LDFLAGS)
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   219
])