make/autoconf/flags-ldflags.m4
author mbaesken
Wed, 27 Nov 2019 10:07:29 +0100
changeset 59287 c04fa10636fd
parent 59286 a2441ac23eeb
permissions -rw-r--r--
8234525: enable link-time section-gc for linux s390x to remove unused code Reviewed-by: erikj, mdoerr
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.
59286
a2441ac23eeb 8234809: set relro in linker flags when building with gcc
mbaesken
parents: 54790
diff changeset
    73
    # add relro (mark relocations read only) for all libs
a2441ac23eeb 8234809: set relro in linker flags when building with gcc
mbaesken
parents: 54790
diff changeset
    74
    BASIC_LDFLAGS="$BASIC_LDFLAGS -Wl,-z,defs -Wl,-z,relro"
59287
c04fa10636fd 8234525: enable link-time section-gc for linux s390x to remove unused code
mbaesken
parents: 59286
diff changeset
    75
    # s390x : remove unused code+data in link step
c04fa10636fd 8234525: enable link-time section-gc for linux s390x to remove unused code
mbaesken
parents: 59286
diff changeset
    76
    if test "x$OPENJDK_TARGET_CPU" = xs390x; then
c04fa10636fd 8234525: enable link-time section-gc for linux s390x to remove unused code
mbaesken
parents: 59286
diff changeset
    77
      BASIC_LDFLAGS="$BASIC_LDFLAGS -Wl,--gc-sections -Wl,--print-gc-sections"
c04fa10636fd 8234525: enable link-time section-gc for linux s390x to remove unused code
mbaesken
parents: 59286
diff changeset
    78
    fi
c04fa10636fd 8234525: enable link-time section-gc for linux s390x to remove unused code
mbaesken
parents: 59286
diff changeset
    79
59286
a2441ac23eeb 8234809: set relro in linker flags when building with gcc
mbaesken
parents: 54790
diff changeset
    80
    BASIC_LDFLAGS_JVM_ONLY="-Wl,-O1"
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" = 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 \
50733
a1d7444076e4 8205197: Never default to using libc++ on Linux
martin
parents: 50550
diff changeset
    84
        -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
54790
b77bf7f216f4 8223307: enable the Stack Execution Disable flag for JDK binaries on AIX
mbaesken
parents: 52351
diff changeset
    95
    BASIC_LDFLAGS="-b64 -brtl -bnorwexec -bnolibpath -bexpall -bernotok -btextpsize:64K \
49120
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
51805
eb2adb0a9b09 8209817: stack is executable when building with Clang on Linux
martin
parents: 50733
diff changeset
   106
  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
   107
    if test -n "$HAS_NOEXECSTACK"; then
eb2adb0a9b09 8209817: stack is executable when building with Clang on Linux
martin
parents: 50733
diff changeset
   108
      BASIC_LDFLAGS="$BASIC_LDFLAGS -Wl,-z,noexecstack"
eb2adb0a9b09 8209817: stack is executable when building with Clang on Linux
martin
parents: 50733
diff changeset
   109
    fi
eb2adb0a9b09 8209817: stack is executable when building with Clang on Linux
martin
parents: 50733
diff changeset
   110
  fi
eb2adb0a9b09 8209817: stack is executable when building with Clang on Linux
martin
parents: 50733
diff changeset
   111
49120
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   112
  # Setup OS-dependent LDFLAGS
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   113
  if test "x$TOOLCHAIN_TYPE" = xclang || test "x$TOOLCHAIN_TYPE" = xgcc; then
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   114
    if test "x$OPENJDK_TARGET_OS" = xmacosx; then
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   115
      # Assume clang or gcc.
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   116
      # FIXME: We should really generalize SET_SHARED_LIBRARY_ORIGIN instead.
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   117
      OS_LDFLAGS_JVM_ONLY="-Wl,-rpath,@loader_path/. -Wl,-rpath,@loader_path/.."
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   118
      OS_LDFLAGS_JDK_ONLY="-mmacosx-version-min=$MACOSX_VERSION_MIN"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   119
    fi
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   120
  fi
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   121
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   122
  # Setup debug level-dependent LDFLAGS
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   123
  if test "x$TOOLCHAIN_TYPE" = xgcc; then
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   124
    if test "x$OPENJDK_TARGET_OS" = xlinux; then
49199
986249df86ce 8199403: Require binutils 2.18 or newer
ihse
parents: 49120
diff changeset
   125
      if test x$DEBUG_LEVEL = xrelease; then
986249df86ce 8199403: Require binutils 2.18 or newer
ihse
parents: 49120
diff changeset
   126
        DEBUGLEVEL_LDFLAGS_JDK_ONLY="$DEBUGLEVEL_LDFLAGS_JDK_ONLY -Wl,-O1"
986249df86ce 8199403: Require binutils 2.18 or newer
ihse
parents: 49120
diff changeset
   127
      fi
986249df86ce 8199403: Require binutils 2.18 or newer
ihse
parents: 49120
diff changeset
   128
      if test x$DEBUG_LEVEL = xslowdebug; then
986249df86ce 8199403: Require binutils 2.18 or newer
ihse
parents: 49120
diff changeset
   129
        # do relocations at load
986249df86ce 8199403: Require binutils 2.18 or newer
ihse
parents: 49120
diff changeset
   130
        DEBUGLEVEL_LDFLAGS="-Wl,-z,now"
986249df86ce 8199403: Require binutils 2.18 or newer
ihse
parents: 49120
diff changeset
   131
      fi
49120
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   132
    fi
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   133
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   134
  elif test "x$TOOLCHAIN_TYPE" = xxlc; then
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   135
    # We need '-qminimaltoc' or '-qpic=large -bbigtoc' if the TOC overflows.
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   136
    # Hotspot now overflows its 64K TOC (currently only for debug),
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   137
    # so we build with '-qpic=large -bbigtoc'.
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   138
    if test "x$DEBUG_LEVEL" != xrelease; then
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   139
      DEBUGLEVEL_LDFLAGS_JVM_ONLY="$DEBUGLEVEL_LDFLAGS_JVM_ONLY -bbigtoc"
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
  fi
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   142
51839
ab54a4d61d7f 8210988: Improved handling of compiler warnings in the build
ihse
parents: 51814
diff changeset
   143
  # Setup warning flags
ab54a4d61d7f 8210988: Improved handling of compiler warnings in the build
ihse
parents: 51814
diff changeset
   144
  if test "x$TOOLCHAIN_TYPE" = xsolstudio; then
ab54a4d61d7f 8210988: Improved handling of compiler warnings in the build
ihse
parents: 51814
diff changeset
   145
    LDFLAGS_WARNINGS_ARE_ERRORS="-Wl,-z,fatal-warnings"
ab54a4d61d7f 8210988: Improved handling of compiler warnings in the build
ihse
parents: 51814
diff changeset
   146
  else
ab54a4d61d7f 8210988: Improved handling of compiler warnings in the build
ihse
parents: 51814
diff changeset
   147
    LDFLAGS_WARNINGS_ARE_ERRORS=""
ab54a4d61d7f 8210988: Improved handling of compiler warnings in the build
ihse
parents: 51814
diff changeset
   148
  fi
ab54a4d61d7f 8210988: Improved handling of compiler warnings in the build
ihse
parents: 51814
diff changeset
   149
  AC_SUBST(LDFLAGS_WARNINGS_ARE_ERRORS)
ab54a4d61d7f 8210988: Improved handling of compiler warnings in the build
ihse
parents: 51814
diff changeset
   150
49120
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   151
  # Setup LDFLAGS for linking executables
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   152
  if test "x$TOOLCHAIN_TYPE" = xgcc; then
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   153
    EXECUTABLE_LDFLAGS="$EXECUTABLE_LDFLAGS -Wl,--allow-shlib-undefined"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   154
  fi
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   155
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   156
  # Export some intermediate variables for compatibility
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   157
  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
   158
  AC_SUBST(LDFLAGS_CXX_JDK)
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   159
  AC_SUBST(LIBJSIG_HASHSTYLE_LDFLAGS)
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   160
  AC_SUBST(LIBJSIG_NOEXECSTACK_LDFLAGS)
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
################################################################################
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   164
# $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
   165
#      conditionals against.
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   166
# $2 - Optional prefix for each variable defined.
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   167
AC_DEFUN([FLAGS_SETUP_LDFLAGS_CPU_DEP],
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   168
[
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   169
  # Setup CPU-dependent basic LDFLAGS. These can differ between the target and
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   170
  # build toolchain.
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   171
  if test "x$TOOLCHAIN_TYPE" = xgcc; then
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   172
    if test "x${OPENJDK_$1_CPU}" = xx86; then
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   173
      $1_CPU_LDFLAGS_JVM_ONLY="-march=i586"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   174
    elif test "x$OPENJDK_$1_CPU" = xarm; then
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   175
      $1_CPU_LDFLAGS_JVM_ONLY="${$1_CPU_LDFLAGS_JVM_ONLY} -fsigned-char"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   176
      $1_CPU_LDFLAGS="$ARM_ARCH_TYPE_FLAGS $ARM_FLOAT_TYPE_FLAGS"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   177
    fi
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   178
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   179
  elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   180
    if test "x${OPENJDK_$1_CPU}" = "xsparcv9"; then
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   181
      $1_CPU_LDFLAGS_JVM_ONLY="-xarch=sparc"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   182
    fi
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   183
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   184
  elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   185
    if test "x${OPENJDK_$1_CPU}" = "xx86"; then
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   186
      $1_CPU_LDFLAGS="-safeseh"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   187
      # NOTE: Old build added -machine. Probably not needed.
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   188
      $1_CPU_LDFLAGS_JVM_ONLY="-machine:I386"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   189
      $1_CPU_EXECUTABLE_LDFLAGS="-stack:327680"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   190
    else
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   191
      $1_CPU_LDFLAGS_JVM_ONLY="-machine:AMD64"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   192
      $1_CPU_EXECUTABLE_LDFLAGS="-stack:1048576"
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
  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
  # JVM_VARIANT_PATH depends on if this is build or target...
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   197
  if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   198
    $1_LDFLAGS_JDK_LIBPATH="-libpath:${OUTPUTDIR}/support/modules_libs/java.base"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   199
  else
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   200
    $1_LDFLAGS_JDK_LIBPATH="-L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base \
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   201
        -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base/${$1_JVM_VARIANT_PATH}"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   202
  fi
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   203
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   204
  # Export variables according to old definitions, prefix with $2 if present.
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   205
  LDFLAGS_JDK_COMMON="$BASIC_LDFLAGS $BASIC_LDFLAGS_JDK_ONLY \
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   206
      $OS_LDFLAGS_JDK_ONLY $DEBUGLEVEL_LDFLAGS_JDK_ONLY ${$2EXTRA_LDFLAGS}"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   207
  $2LDFLAGS_JDKLIB="$LDFLAGS_JDK_COMMON $BASIC_LDFLAGS_JDK_LIB_ONLY \
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   208
      ${$1_LDFLAGS_JDK_LIBPATH} $SHARED_LIBRARY_FLAGS"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   209
  $2LDFLAGS_JDKEXE="$LDFLAGS_JDK_COMMON $EXECUTABLE_LDFLAGS \
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   210
      ${$1_CPU_EXECUTABLE_LDFLAGS}"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   211
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   212
  $2JVM_LDFLAGS="$BASIC_LDFLAGS $BASIC_LDFLAGS_JVM_ONLY $OS_LDFLAGS_JVM_ONLY \
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   213
      $DEBUGLEVEL_LDFLAGS $DEBUGLEVEL_LDFLAGS_JVM_ONLY $BASIC_LDFLAGS_ONLYCXX \
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   214
      ${$1_CPU_LDFLAGS} ${$1_CPU_LDFLAGS_JVM_ONLY} ${$2EXTRA_LDFLAGS}"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   215
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   216
  AC_SUBST($2LDFLAGS_JDKLIB)
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   217
  AC_SUBST($2LDFLAGS_JDKEXE)
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   218
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   219
  AC_SUBST($2JVM_LDFLAGS)
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents:
diff changeset
   220
])