hotspot/make/linux/makefiles/gcc.make
author stefank
Wed, 12 Nov 2014 13:55:59 +0100
changeset 27677 b1997f2f1b56
parent 26172 7ab032af2835
child 29181 89beae49867c
permissions -rw-r--r--
8062808: Turn on the -Wreturn-type warning Reviewed-by: mgerdin, tschatzl, coleenp, jrose, kbarrett
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
#
19544
8f3ad1962aef 8022183: GCC 4.6 change sdefault setting for omit-frame-pointer which breaks hotspot stack walking
hseigel
parents: 18447
diff changeset
     2
# Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     3
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     4
#
489c9b5090e2 Initial load
duke
parents:
diff changeset
     5
# This code is free software; you can redistribute it and/or modify it
489c9b5090e2 Initial load
duke
parents:
diff changeset
     6
# under the terms of the GNU General Public License version 2 only, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
     7
# published by the Free Software Foundation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     8
#
489c9b5090e2 Initial load
duke
parents:
diff changeset
     9
# This code is distributed in the hope that it will be useful, but WITHOUT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    10
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    11
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
489c9b5090e2 Initial load
duke
parents:
diff changeset
    12
# version 2 for more details (a copy is included in the LICENSE file that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    13
# accompanied this code).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    14
#
489c9b5090e2 Initial load
duke
parents:
diff changeset
    15
# You should have received a copy of the GNU General Public License version
489c9b5090e2 Initial load
duke
parents:
diff changeset
    16
# 2 along with this work; if not, write to the Free Software Foundation,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    17
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    18
#
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 4013
diff changeset
    19
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 4013
diff changeset
    20
# or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 4013
diff changeset
    21
# questions.
24955
fbde9efb7b56 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23544
diff changeset
    22
#
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
#
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
489c9b5090e2 Initial load
duke
parents:
diff changeset
    25
#------------------------------------------------------------------------
11721
dcd1f62c9caf 7141242: build-infra merge: Rename CPP->CXX and LINK->LD
erikj
parents: 11205
diff changeset
    26
# CC, CXX & AS
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    27
11955
aeca8151886e 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 11721
diff changeset
    28
# If a SPEC is not set already, then use these defaults.
aeca8151886e 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 11721
diff changeset
    29
ifeq ($(SPEC),)
aeca8151886e 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 11721
diff changeset
    30
  # When cross-compiling the ALT_COMPILER_PATH points
aeca8151886e 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 11721
diff changeset
    31
  # to the cross-compilation toolset
aeca8151886e 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 11721
diff changeset
    32
  ifdef CROSS_COMPILE_ARCH
aeca8151886e 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 11721
diff changeset
    33
    CXX = $(ALT_COMPILER_PATH)/g++
aeca8151886e 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 11721
diff changeset
    34
    CC  = $(ALT_COMPILER_PATH)/gcc
aeca8151886e 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 11721
diff changeset
    35
    HOSTCXX = g++
aeca8151886e 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 11721
diff changeset
    36
    HOSTCC  = gcc
aeca8151886e 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 11721
diff changeset
    37
    STRIP = $(ALT_COMPILER_PATH)/strip
aeca8151886e 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 11721
diff changeset
    38
  else
17880
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
    39
    ifeq ($(USE_CLANG), true)
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
    40
      CXX = clang++
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
    41
      CC  = clang
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
    42
    else
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
    43
      CXX = g++
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
    44
      CC  = gcc
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
    45
    endif
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
    46
11955
aeca8151886e 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 11721
diff changeset
    47
    HOSTCXX = $(CXX)
aeca8151886e 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 11721
diff changeset
    48
    HOSTCC  = $(CC)
aeca8151886e 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 11721
diff changeset
    49
    STRIP = strip
aeca8151886e 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 11721
diff changeset
    50
  endif
aeca8151886e 7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents: 11721
diff changeset
    51
  AS  = $(CC) -c
6176
4d9030fe341f 6953477: Increase portability and flexibility of building Hotspot
bobv
parents: 5547
diff changeset
    52
endif
4d9030fe341f 6953477: Increase portability and flexibility of building Hotspot
bobv
parents: 5547
diff changeset
    53
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
17880
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
    55
ifeq ($(USE_CLANG), true)
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
    56
  CC_VER_MAJOR := $(shell $(CC) -v 2>&1 | grep version | sed "s/.*version \([0-9]*\.[0-9]*\).*/\1/" | cut -d'.' -f1)
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
    57
  CC_VER_MINOR := $(shell $(CC) -v 2>&1 | grep version | sed "s/.*version \([0-9]*\.[0-9]*\).*/\1/" | cut -d'.' -f2)
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
    58
else
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
    59
  # -dumpversion in gcc-2.91 shows "egcs-2.91.66". In later version, it only
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
    60
  # prints the numbers (e.g. "2.95", "3.2.1")
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
    61
  CC_VER_MAJOR := $(shell $(CC) -dumpversion | sed 's/egcs-//' | cut -d'.' -f1)
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
    62
  CC_VER_MINOR := $(shell $(CC) -dumpversion | sed 's/egcs-//' | cut -d'.' -f2)
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
    63
endif
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
    64
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
    65
ifeq ($(USE_CLANG), true)
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
    66
  # Clang has precompiled headers support by default, but the user can switch
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
    67
  # it off by using 'USE_PRECOMPILED_HEADER=0'.
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
    68
  ifdef LP64
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
    69
    ifeq ($(USE_PRECOMPILED_HEADER),)
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
    70
      USE_PRECOMPILED_HEADER=1
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
    71
    endif
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
    72
  else
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
    73
    # We don't support precompiled headers on 32-bit builds because there some files are
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
    74
    # compiled with -fPIC while others are compiled without (see 'NONPIC_OBJ_FILES' rules.make)
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
    75
    # Clang produces an error if the PCH file was compiled with other options than the actual compilation unit.
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
    76
    USE_PRECOMPILED_HEADER=0
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
    77
  endif
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
    78
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
    79
  ifeq ($(USE_PRECOMPILED_HEADER),1)
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
    80
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
    81
    ifndef LP64
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
    82
      $(error " Precompiled Headers only supported on 64-bit platforms!")
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
    83
    endif
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
    84
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
    85
    PRECOMPILED_HEADER_DIR=.
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
    86
    PRECOMPILED_HEADER_SRC=$(GAMMADIR)/src/share/vm/precompiled/precompiled.hpp
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
    87
    PRECOMPILED_HEADER=$(PRECOMPILED_HEADER_DIR)/precompiled.hpp.pch
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
17880
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
    89
    PCH_FLAG = -include precompiled.hpp
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
    90
    PCH_FLAG/DEFAULT = $(PCH_FLAG)
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
    91
    PCH_FLAG/NO_PCH = -DNO_PCH
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
    92
    PCH_FLAG/BY_FILE = $(PCH_FLAG/$@)$(PCH_FLAG/DEFAULT$(PCH_FLAG/$@))
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
    93
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
    94
    VM_PCH_FLAG/LIBJVM = $(PCH_FLAG/BY_FILE)
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
    95
    VM_PCH_FLAG/AOUT =
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
    96
    VM_PCH_FLAG = $(VM_PCH_FLAG/$(LINK_INTO))
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
    97
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
    98
    # We only use precompiled headers for the JVM build
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
    99
    CFLAGS += $(VM_PCH_FLAG)
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
   100
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
   101
    # There are some files which don't like precompiled headers
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
   102
    # The following files are build with 'OPT_CFLAGS/NOOPT' (-O0) in the opt build.
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
   103
    # But Clang doesn't support a precompiled header which was compiled with -O3
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
   104
    # to be used in a compilation unit which uses '-O0'. We could also prepare an
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
   105
    # extra '-O0' PCH file for the opt build and use it here, but it's probably
24955
fbde9efb7b56 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23544
diff changeset
   106
    # not worth the effort as long as only two files need this special handling.
17880
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
   107
    PCH_FLAG/loopTransform.o = $(PCH_FLAG/NO_PCH)
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
   108
    PCH_FLAG/sharedRuntimeTrig.o = $(PCH_FLAG/NO_PCH)
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
   109
    PCH_FLAG/sharedRuntimeTrans.o = $(PCH_FLAG/NO_PCH)
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
   110
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
   111
  endif
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
   112
else # ($(USE_CLANG), true)
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
   113
  # check for precompiled headers support
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
   114
  ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 3 \) \| \( \( $(CC_VER_MAJOR) = 3 \) \& \( $(CC_VER_MINOR) \>= 4 \) \))" "0"
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
   115
    # Allow the user to turn off precompiled headers from the command line.
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
   116
    ifneq ($(USE_PRECOMPILED_HEADER),0)
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
   117
      PRECOMPILED_HEADER_DIR=.
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
   118
      PRECOMPILED_HEADER_SRC=$(GAMMADIR)/src/share/vm/precompiled/precompiled.hpp
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
   119
      PRECOMPILED_HEADER=$(PRECOMPILED_HEADER_DIR)/precompiled.hpp.gch
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
   120
    endif
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
   121
  endif
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
endif
17880
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
   123
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
   124
# -DDONT_USE_PRECOMPILED_HEADER will exclude all includes in precompiled.hpp.
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
   125
ifeq ($(USE_PRECOMPILED_HEADER),0)
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
   126
  CFLAGS += -DDONT_USE_PRECOMPILED_HEADER
7408
c04a5c989f26 7003125: precompiled.hpp is included when precompiled headers are not used
stefank
parents: 7397
diff changeset
   127
endif
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
#------------------------------------------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
# Compiler flags
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
# position-independent code
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
PICFLAG = -fPIC
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
VM_PICFLAG/LIBJVM = $(PICFLAG)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
VM_PICFLAG/AOUT   =
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
VM_PICFLAG        = $(VM_PICFLAG/$(LINK_INTO))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
12156
fb31de03f649 7141246: build-infra merge: Introduce new JVM_VARIANT* to control which kind of jvm gets built
erikj
parents: 11955
diff changeset
   140
ifeq ($(JVM_VARIANT_ZERO), true)
4013
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents: 2787
diff changeset
   141
CFLAGS += $(LIBFFI_CFLAGS)
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents: 2787
diff changeset
   142
endif
12156
fb31de03f649 7141246: build-infra merge: Introduce new JVM_VARIANT* to control which kind of jvm gets built
erikj
parents: 11955
diff changeset
   143
ifeq ($(JVM_VARIANT_ZEROSHARK), true)
fb31de03f649 7141246: build-infra merge: Introduce new JVM_VARIANT* to control which kind of jvm gets built
erikj
parents: 11955
diff changeset
   144
CFLAGS += $(LIBFFI_CFLAGS)
6187
4fa7845f7c14 6976186: integrate Shark HotSpot changes
twisti
parents: 6176
diff changeset
   145
CFLAGS += $(LLVM_CFLAGS)
4fa7845f7c14 6976186: integrate Shark HotSpot changes
twisti
parents: 6176
diff changeset
   146
endif
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
CFLAGS += $(VM_PICFLAG)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
CFLAGS += -fno-rtti
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
CFLAGS += -fno-exceptions
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
CFLAGS += -D_REENTRANT
17880
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
   151
ifeq ($(USE_CLANG),)
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
   152
  CFLAGS += -fcheck-new
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
   153
  # version 4 and above support fvisibility=hidden (matches jni_x86.h file)
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
   154
  # except 4.1.2 gives pointless warnings that can't be disabled (afaik)
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
   155
  ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 3 \) \))" "0"
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
   156
    CFLAGS += -fvisibility=hidden
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
   157
  endif
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
   158
else
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
   159
  CFLAGS += -fvisibility=hidden
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
   160
endif
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
   161
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
   162
ifeq ($(USE_CLANG), true)
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
   163
  # Before Clang 3.1, we had to pass the stack alignment specification directly to llvm with the help of '-mllvm'
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
   164
  # Starting with version 3.1, Clang understands the '-mstack-alignment' (and rejects '-mllvm -stack-alignment')
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
   165
  ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 3 \) \| \( \( $(CC_VER_MAJOR) = 3 \) \& \( $(CC_VER_MINOR) \>= 1 \) \))" "0"
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
   166
    STACK_ALIGNMENT_OPT = -mno-omit-leaf-frame-pointer -mstack-alignment=16
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
   167
  else
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
   168
    STACK_ALIGNMENT_OPT = -mno-omit-leaf-frame-pointer -mllvm -stack-alignment=16
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
   169
  endif
8106
19106a0203fb 6588413: Use -fvisibility=hidden for gcc compiles
coleenp
parents: 7445
diff changeset
   170
endif
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
489c9b5090e2 Initial load
duke
parents:
diff changeset
   172
ARCHFLAG = $(ARCHFLAG/$(BUILDARCH))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   173
ARCHFLAG/i486    = -m32 -march=i586
17880
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
   174
ARCHFLAG/amd64   = -m64 $(STACK_ALIGNMENT_OPT)
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   175
ARCHFLAG/ia64    =
489c9b5090e2 Initial load
duke
parents:
diff changeset
   176
ARCHFLAG/sparc   = -m32 -mcpu=v9
489c9b5090e2 Initial load
duke
parents:
diff changeset
   177
ARCHFLAG/sparcv9 = -m64 -mcpu=v9
6176
4d9030fe341f 6953477: Increase portability and flexibility of building Hotspot
bobv
parents: 5547
diff changeset
   178
ARCHFLAG/arm     =  -fsigned-char
4013
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents: 2787
diff changeset
   179
ARCHFLAG/zero    = $(ZERO_ARCHFLAG)
6176
4d9030fe341f 6953477: Increase portability and flexibility of building Hotspot
bobv
parents: 5547
diff changeset
   180
ifndef E500V2
4d9030fe341f 6953477: Increase portability and flexibility of building Hotspot
bobv
parents: 5547
diff changeset
   181
ARCHFLAG/ppc     =  -mcpu=powerpc
4d9030fe341f 6953477: Increase portability and flexibility of building Hotspot
bobv
parents: 5547
diff changeset
   182
endif
22818
34cd99df9940 8019922: PPC64 (part 8): Implement Linux/PPC64 support in HotSpot makefiles
simonis
parents: 18447
diff changeset
   183
ARCHFLAG/ppc64   =  -m64
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   184
489c9b5090e2 Initial load
duke
parents:
diff changeset
   185
CFLAGS     += $(ARCHFLAG)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   186
AOUT_FLAGS += $(ARCHFLAG)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   187
LFLAGS     += $(ARCHFLAG)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   188
ASFLAGS    += $(ARCHFLAG)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   189
6176
4d9030fe341f 6953477: Increase portability and flexibility of building Hotspot
bobv
parents: 5547
diff changeset
   190
ifdef E500V2
4d9030fe341f 6953477: Increase portability and flexibility of building Hotspot
bobv
parents: 5547
diff changeset
   191
CFLAGS += -DE500V2
4d9030fe341f 6953477: Increase portability and flexibility of building Hotspot
bobv
parents: 5547
diff changeset
   192
endif
4d9030fe341f 6953477: Increase portability and flexibility of building Hotspot
bobv
parents: 5547
diff changeset
   193
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   194
# Use C++ Interpreter
489c9b5090e2 Initial load
duke
parents:
diff changeset
   195
ifdef CC_INTERP
489c9b5090e2 Initial load
duke
parents:
diff changeset
   196
  CFLAGS += -DCC_INTERP
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   198
489c9b5090e2 Initial load
duke
parents:
diff changeset
   199
# Keep temporary files (.ii, .s)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   200
ifdef NEED_ASM
489c9b5090e2 Initial load
duke
parents:
diff changeset
   201
  CFLAGS += -save-temps
489c9b5090e2 Initial load
duke
parents:
diff changeset
   202
else
489c9b5090e2 Initial load
duke
parents:
diff changeset
   203
  CFLAGS += -pipe
489c9b5090e2 Initial load
duke
parents:
diff changeset
   204
endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   205
489c9b5090e2 Initial load
duke
parents:
diff changeset
   206
# Compiler warnings are treated as errors
489c9b5090e2 Initial load
duke
parents:
diff changeset
   207
WARNINGS_ARE_ERRORS = -Werror
775
d9c9b9cd55fb 6718830: Hotspot fails to build with gcc 4.3
xlu
parents: 744
diff changeset
   208
17880
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
   209
ifeq ($(USE_CLANG), true)
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
   210
  # However we need to clean the code up before we can unrestrictedly enable this option with Clang
20295
a5dd1b071c32 8025613: clang: remove -Wno-unused-value
twisti
parents: 19544
diff changeset
   211
  WARNINGS_ARE_ERRORS += -Wno-logical-op-parentheses -Wno-parentheses-equality -Wno-parentheses
17880
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
   212
  WARNINGS_ARE_ERRORS += -Wno-switch -Wno-tautological-constant-out-of-range-compare -Wno-tautological-compare
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
   213
  WARNINGS_ARE_ERRORS += -Wno-delete-non-virtual-dtor -Wno-deprecated -Wno-format -Wno-dynamic-class-memaccess
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
   214
  WARNINGS_ARE_ERRORS += -Wno-return-type -Wno-empty-body
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
   215
endif
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
   216
27677
b1997f2f1b56 8062808: Turn on the -Wreturn-type warning
stefank
parents: 26172
diff changeset
   217
WARNING_FLAGS = -Wpointer-arith -Wsign-compare -Wundef -Wunused-function -Wunused-value -Wformat=2 -Wreturn-type
16670
4af09aff4237 8003310: Enable -Wunused-function when compiling with gcc
mikael
parents: 15938
diff changeset
   218
17880
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
   219
ifeq ($(USE_CLANG),)
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
   220
  # Since GCC 4.3, -Wconversion has changed its meanings to warn these implicit
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
   221
  # conversions which might affect the values. Only enable it in earlier versions.
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
   222
  ifeq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 3 \) \))" "0"
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
   223
    WARNING_FLAGS += -Wconversion
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
   224
  endif
775
d9c9b9cd55fb 6718830: Hotspot fails to build with gcc 4.3
xlu
parents: 744
diff changeset
   225
endif
d9c9b9cd55fb 6718830: Hotspot fails to build with gcc 4.3
xlu
parents: 744
diff changeset
   226
15938
fb5f9016ddbc 8008474: Add -Wundef to warning flags.
jprovino
parents: 14815
diff changeset
   227
CFLAGS_WARN/DEFAULT = $(WARNINGS_ARE_ERRORS) $(WARNING_FLAGS)
24955
fbde9efb7b56 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23544
diff changeset
   228
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   229
# Special cases
24955
fbde9efb7b56 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23544
diff changeset
   230
CFLAGS_WARN/BYFILE = $(CFLAGS_WARN/$@)$(CFLAGS_WARN/DEFAULT$(CFLAGS_WARN/$@))
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   231
24955
fbde9efb7b56 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23544
diff changeset
   232
# optimization control flags (Used by fastdebug and release variants)
fbde9efb7b56 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23544
diff changeset
   233
OPT_CFLAGS/NOOPT=-O0
25498
52d596882831 8047734: Backout use of -Og
mduigou
parents: 24955
diff changeset
   234
OPT_CFLAGS/DEBUG=-O0
13975
2f7431485cfa 7189254: Change makefiles for more flexibility to override defaults
jprovino
parents: 13473
diff changeset
   235
OPT_CFLAGS/SIZE=-Os
2f7431485cfa 7189254: Change makefiles for more flexibility to override defaults
jprovino
parents: 13473
diff changeset
   236
OPT_CFLAGS/SPEED=-O3
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   237
24955
fbde9efb7b56 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23544
diff changeset
   238
OPT_CFLAGS_DEFAULT ?= SPEED
fbde9efb7b56 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23544
diff changeset
   239
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   240
# Hotspot uses very unstrict aliasing turn this optimization off
13975
2f7431485cfa 7189254: Change makefiles for more flexibility to override defaults
jprovino
parents: 13473
diff changeset
   241
# This option is added to CFLAGS rather than OPT_CFLAGS
2f7431485cfa 7189254: Change makefiles for more flexibility to override defaults
jprovino
parents: 13473
diff changeset
   242
# so that OPT_CFLAGS overrides get this option too.
24955
fbde9efb7b56 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23544
diff changeset
   243
CFLAGS += -fno-strict-aliasing
13975
2f7431485cfa 7189254: Change makefiles for more flexibility to override defaults
jprovino
parents: 13473
diff changeset
   244
2f7431485cfa 7189254: Change makefiles for more flexibility to override defaults
jprovino
parents: 13473
diff changeset
   245
ifdef OPT_CFLAGS
2f7431485cfa 7189254: Change makefiles for more flexibility to override defaults
jprovino
parents: 13473
diff changeset
   246
  ifneq ("$(origin OPT_CFLAGS)", "command line")
2f7431485cfa 7189254: Change makefiles for more flexibility to override defaults
jprovino
parents: 13473
diff changeset
   247
    $(error " Use OPT_EXTRAS instead of OPT_CFLAGS to add extra flags to OPT_CFLAGS.")
2f7431485cfa 7189254: Change makefiles for more flexibility to override defaults
jprovino
parents: 13473
diff changeset
   248
  endif
2f7431485cfa 7189254: Change makefiles for more flexibility to override defaults
jprovino
parents: 13473
diff changeset
   249
endif
2f7431485cfa 7189254: Change makefiles for more flexibility to override defaults
jprovino
parents: 13473
diff changeset
   250
2f7431485cfa 7189254: Change makefiles for more flexibility to override defaults
jprovino
parents: 13473
diff changeset
   251
OPT_CFLAGS = $(OPT_CFLAGS/$(OPT_CFLAGS_DEFAULT)) $(OPT_EXTRAS)
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   252
24955
fbde9efb7b56 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23544
diff changeset
   253
# The gcc compiler segv's on ia64 when compiling bytecodeInterpreter.cpp
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   254
# if we use expensive-optimizations
489c9b5090e2 Initial load
duke
parents:
diff changeset
   255
ifeq ($(BUILDARCH), ia64)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   256
OPT_CFLAGS += -fno-expensive-optimizations
489c9b5090e2 Initial load
duke
parents:
diff changeset
   257
endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   258
17880
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
   259
# Work around some compiler bugs.
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
   260
ifeq ($(USE_CLANG), true)
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
   261
  ifeq ($(shell expr $(CC_VER_MAJOR) = 4 \& $(CC_VER_MINOR) = 2), 1)
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
   262
    OPT_CFLAGS/loopTransform.o += $(OPT_CFLAGS/NOOPT)
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
   263
  endif
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
   264
else
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
   265
  # 6835796. Problem in GCC 4.3.0 with mulnode.o optimized compilation.
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
   266
  ifeq ($(shell expr $(CC_VER_MAJOR) = 4 \& $(CC_VER_MINOR) = 3), 1)
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
   267
    OPT_CFLAGS/mulnode.o += $(OPT_CFLAGS/NOOPT)
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
   268
  endif
2734
a15982b3cd69 6835796: Fedora 9 linux_i586-fastdebug-c2-runThese_Xcomp times out
kvn
parents: 2105
diff changeset
   269
endif
a15982b3cd69 6835796: Fedora 9 linux_i586-fastdebug-c2-runThese_Xcomp times out
kvn
parents: 2105
diff changeset
   270
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6187
diff changeset
   271
# Flags for generating make dependency flags.
17880
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
   272
DEPFLAGS = -MMD -MP -MF $(DEP_DIR)/$(@:%=%.d)
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
   273
ifeq ($(USE_CLANG),)
24955
fbde9efb7b56 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23544
diff changeset
   274
  ifneq ($(CC_VER_MAJOR), 2)
17880
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
   275
    DEPFLAGS += -fpch-deps
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
   276
  endif
7408
c04a5c989f26 7003125: precompiled.hpp is included when precompiled headers are not used
stefank
parents: 7397
diff changeset
   277
endif
c04a5c989f26 7003125: precompiled.hpp is included when precompiled headers are not used
stefank
parents: 7397
diff changeset
   278
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   279
#------------------------------------------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   280
# Linker flags
489c9b5090e2 Initial load
duke
parents:
diff changeset
   281
489c9b5090e2 Initial load
duke
parents:
diff changeset
   282
# statically link libstdc++.so, work with gcc but ignored by g++
489c9b5090e2 Initial load
duke
parents:
diff changeset
   283
STATIC_STDCXX = -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic
489c9b5090e2 Initial load
duke
parents:
diff changeset
   284
24955
fbde9efb7b56 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23544
diff changeset
   285
# Enable linker optimization
fbde9efb7b56 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23544
diff changeset
   286
LFLAGS += -Xlinker -O1
fbde9efb7b56 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23544
diff changeset
   287
17880
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
   288
ifeq ($(USE_CLANG),)
24955
fbde9efb7b56 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23544
diff changeset
   289
  STATIC_LIBGCC += -static-libgcc
fbde9efb7b56 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23544
diff changeset
   290
fbde9efb7b56 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23544
diff changeset
   291
  ifneq (, findstring(debug,$(BUILD_FLAVOR)))
fbde9efb7b56 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23544
diff changeset
   292
    # for relocations read-only
fbde9efb7b56 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23544
diff changeset
   293
    LFLAGS += -Xlinker -z -Xlinker relro
fbde9efb7b56 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23544
diff changeset
   294
fbde9efb7b56 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23544
diff changeset
   295
    ifeq ($(BUILD_FLAVOR), debug)
fbde9efb7b56 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23544
diff changeset
   296
      # disable incremental relocations linking
fbde9efb7b56 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23544
diff changeset
   297
      LFLAGS += -Xlinker -z -Xlinker now
fbde9efb7b56 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23544
diff changeset
   298
    endif
17880
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
   299
  endif
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   300
17880
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
   301
  ifeq ($(BUILDARCH), ia64)
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
   302
    LFLAGS += -Wl,-relax
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
   303
  endif
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   304
17880
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
   305
  # If this is a --hash-style=gnu system, use --hash-style=both
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
   306
  #   The gnu .hash section won't work on some Linux systems like SuSE 10.
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
   307
  _HAS_HASH_STYLE_GNU:=$(shell $(CC) -dumpspecs | grep -- '--hash-style=gnu')
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
   308
  ifneq ($(_HAS_HASH_STYLE_GNU),)
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
   309
    LDFLAGS_HASH_STYLE = -Wl,--hash-style=both
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
   310
  endif
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
   311
else
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
   312
  # Don't know how to find out the 'hash style' of a system as '-dumpspecs'
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
   313
  # doesn't work for Clang. So for now we'll alwys use --hash-style=both
2102
4a1023ae7252 6799141: Build with --hash-style=both so that binaries can work on SuSE 10
ohair
parents: 781
diff changeset
   314
  LDFLAGS_HASH_STYLE = -Wl,--hash-style=both
4a1023ae7252 6799141: Build with --hash-style=both so that binaries can work on SuSE 10
ohair
parents: 781
diff changeset
   315
endif
17880
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
   316
2102
4a1023ae7252 6799141: Build with --hash-style=both so that binaries can work on SuSE 10
ohair
parents: 781
diff changeset
   317
LFLAGS += $(LDFLAGS_HASH_STYLE)
4a1023ae7252 6799141: Build with --hash-style=both so that binaries can work on SuSE 10
ohair
parents: 781
diff changeset
   318
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   319
# Use $(MAPFLAG:FILENAME=real_file_name) to specify a map file.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   320
MAPFLAG = -Xlinker --version-script=FILENAME
489c9b5090e2 Initial load
duke
parents:
diff changeset
   321
489c9b5090e2 Initial load
duke
parents:
diff changeset
   322
# Use $(SONAMEFLAG:SONAME=soname) to specify the intrinsic name of a shared obj
489c9b5090e2 Initial load
duke
parents:
diff changeset
   323
SONAMEFLAG = -Xlinker -soname=SONAME
489c9b5090e2 Initial load
duke
parents:
diff changeset
   324
489c9b5090e2 Initial load
duke
parents:
diff changeset
   325
# Build shared library
489c9b5090e2 Initial load
duke
parents:
diff changeset
   326
SHARED_FLAG = -shared
489c9b5090e2 Initial load
duke
parents:
diff changeset
   327
489c9b5090e2 Initial load
duke
parents:
diff changeset
   328
# Keep symbols even they are not used
9408
8bb4e957dea0 7041156: gcc 4.6 doesn't recognise -export-dynamic option
dsamersoff
parents: 8921
diff changeset
   329
AOUT_FLAGS += -Xlinker -export-dynamic
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   330
489c9b5090e2 Initial load
duke
parents:
diff changeset
   331
#------------------------------------------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   332
# Debug flags
489c9b5090e2 Initial load
duke
parents:
diff changeset
   333
17880
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
   334
ifeq ($(USE_CLANG), true)
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
   335
  # Restrict the debug information created by Clang to avoid
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
   336
  # too big object files and speed the build up a little bit
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
   337
  # (see http://llvm.org/bugs/show_bug.cgi?id=7554)
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
   338
  CFLAGS += -flimit-debug-info
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
   339
endif
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 16670
diff changeset
   340
25498
52d596882831 8047734: Backout use of -Og
mduigou
parents: 24955
diff changeset
   341
# Allow no optimizations.
52d596882831 8047734: Backout use of -Og
mduigou
parents: 24955
diff changeset
   342
DEBUG_CFLAGS=-O0
24955
fbde9efb7b56 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23544
diff changeset
   343
13473
9bbabe271025 7188168: 7071904 broke the DEBUG_BINARIES option on Linux
dcubed
parents: 12943
diff changeset
   344
# DEBUG_BINARIES uses full -g debug information for all configs
9bbabe271025 7188168: 7071904 broke the DEBUG_BINARIES option on Linux
dcubed
parents: 12943
diff changeset
   345
ifeq ($(DEBUG_BINARIES), true)
9bbabe271025 7188168: 7071904 broke the DEBUG_BINARIES option on Linux
dcubed
parents: 12943
diff changeset
   346
  CFLAGS += -g
9bbabe271025 7188168: 7071904 broke the DEBUG_BINARIES option on Linux
dcubed
parents: 12943
diff changeset
   347
else
9bbabe271025 7188168: 7071904 broke the DEBUG_BINARIES option on Linux
dcubed
parents: 12943
diff changeset
   348
  DEBUG_CFLAGS += $(DEBUG_CFLAGS/$(BUILDARCH))
9bbabe271025 7188168: 7071904 broke the DEBUG_BINARIES option on Linux
dcubed
parents: 12943
diff changeset
   349
  ifeq ($(DEBUG_CFLAGS/$(BUILDARCH)),)
23544
e6362a5ba011 8033251: Use DWARF debug symbols for Linux 32-bit as default
ehelin
parents: 23185
diff changeset
   350
    DEBUG_CFLAGS += -g
10559
a94d067da388 7071904: 4/4 HotSpot: Full Debug Symbols
dcubed
parents: 9408
diff changeset
   351
  endif
23544
e6362a5ba011 8033251: Use DWARF debug symbols for Linux 32-bit as default
ehelin
parents: 23185
diff changeset
   352
13473
9bbabe271025 7188168: 7071904 broke the DEBUG_BINARIES option on Linux
dcubed
parents: 12943
diff changeset
   353
  ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
23544
e6362a5ba011 8033251: Use DWARF debug symbols for Linux 32-bit as default
ehelin
parents: 23185
diff changeset
   354
    FASTDEBUG_CFLAGS += $(FASTDEBUG_CFLAGS/$(BUILDARCH))
13473
9bbabe271025 7188168: 7071904 broke the DEBUG_BINARIES option on Linux
dcubed
parents: 12943
diff changeset
   355
    ifeq ($(FASTDEBUG_CFLAGS/$(BUILDARCH)),)
23544
e6362a5ba011 8033251: Use DWARF debug symbols for Linux 32-bit as default
ehelin
parents: 23185
diff changeset
   356
      FASTDEBUG_CFLAGS += -g
13473
9bbabe271025 7188168: 7071904 broke the DEBUG_BINARIES option on Linux
dcubed
parents: 12943
diff changeset
   357
    endif
23544
e6362a5ba011 8033251: Use DWARF debug symbols for Linux 32-bit as default
ehelin
parents: 23185
diff changeset
   358
13473
9bbabe271025 7188168: 7071904 broke the DEBUG_BINARIES option on Linux
dcubed
parents: 12943
diff changeset
   359
    OPT_CFLAGS += $(OPT_CFLAGS/$(BUILDARCH))
9bbabe271025 7188168: 7071904 broke the DEBUG_BINARIES option on Linux
dcubed
parents: 12943
diff changeset
   360
    ifeq ($(OPT_CFLAGS/$(BUILDARCH)),)
23544
e6362a5ba011 8033251: Use DWARF debug symbols for Linux 32-bit as default
ehelin
parents: 23185
diff changeset
   361
      OPT_CFLAGS += -g
13473
9bbabe271025 7188168: 7071904 broke the DEBUG_BINARIES option on Linux
dcubed
parents: 12943
diff changeset
   362
    endif
10559
a94d067da388 7071904: 4/4 HotSpot: Full Debug Symbols
dcubed
parents: 9408
diff changeset
   363
  endif
a94d067da388 7071904: 4/4 HotSpot: Full Debug Symbols
dcubed
parents: 9408
diff changeset
   364
endif
a94d067da388 7071904: 4/4 HotSpot: Full Debug Symbols
dcubed
parents: 9408
diff changeset
   365
24955
fbde9efb7b56 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23544
diff changeset
   366
ifeq ($(USE_CLANG),)
fbde9efb7b56 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23544
diff changeset
   367
  # Enable bounds checking.
fbde9efb7b56 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23544
diff changeset
   368
  ifeq "$(shell expr \( $(CC_VER_MAJOR) \> 3 \) )" "1"
26172
7ab032af2835 8047952: Remove _FORTIFY_SOURCE from fastdebug and slowdebug builds
mduigou
parents: 25498
diff changeset
   369
    # stack smashing checks.
7ab032af2835 8047952: Remove _FORTIFY_SOURCE from fastdebug and slowdebug builds
mduigou
parents: 25498
diff changeset
   370
    DEBUG_CFLAGS += -fstack-protector-all --param ssp-buffer-size=1
24955
fbde9efb7b56 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23544
diff changeset
   371
  endif
fbde9efb7b56 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23544
diff changeset
   372
endif
fbde9efb7b56 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23544
diff changeset
   373
26172
7ab032af2835 8047952: Remove _FORTIFY_SOURCE from fastdebug and slowdebug builds
mduigou
parents: 25498
diff changeset
   374
6176
4d9030fe341f 6953477: Increase portability and flexibility of building Hotspot
bobv
parents: 5547
diff changeset
   375
# If we are building HEADLESS, pass on to VM
4d9030fe341f 6953477: Increase portability and flexibility of building Hotspot
bobv
parents: 5547
diff changeset
   376
# so it can set the java.awt.headless property
4d9030fe341f 6953477: Increase portability and flexibility of building Hotspot
bobv
parents: 5547
diff changeset
   377
ifdef HEADLESS
4d9030fe341f 6953477: Increase portability and flexibility of building Hotspot
bobv
parents: 5547
diff changeset
   378
CFLAGS += -DHEADLESS
4d9030fe341f 6953477: Increase portability and flexibility of building Hotspot
bobv
parents: 5547
diff changeset
   379
endif
4d9030fe341f 6953477: Increase portability and flexibility of building Hotspot
bobv
parents: 5547
diff changeset
   380
4d9030fe341f 6953477: Increase portability and flexibility of building Hotspot
bobv
parents: 5547
diff changeset
   381
# We are building Embedded for a small device
4d9030fe341f 6953477: Increase portability and flexibility of building Hotspot
bobv
parents: 5547
diff changeset
   382
# favor code space over speed
4d9030fe341f 6953477: Increase portability and flexibility of building Hotspot
bobv
parents: 5547
diff changeset
   383
ifdef MINIMIZE_RAM_USAGE
4d9030fe341f 6953477: Increase portability and flexibility of building Hotspot
bobv
parents: 5547
diff changeset
   384
CFLAGS += -DMINIMIZE_RAM_USAGE
4d9030fe341f 6953477: Increase portability and flexibility of building Hotspot
bobv
parents: 5547
diff changeset
   385
endif
19544
8f3ad1962aef 8022183: GCC 4.6 change sdefault setting for omit-frame-pointer which breaks hotspot stack walking
hseigel
parents: 18447
diff changeset
   386
8f3ad1962aef 8022183: GCC 4.6 change sdefault setting for omit-frame-pointer which breaks hotspot stack walking
hseigel
parents: 18447
diff changeset
   387
# Stack walking in the JVM relies on frame pointer (%rbp) to walk thread stack.
8f3ad1962aef 8022183: GCC 4.6 change sdefault setting for omit-frame-pointer which breaks hotspot stack walking
hseigel
parents: 18447
diff changeset
   388
# Explicitly specify -fno-omit-frame-pointer because it is off by default
8f3ad1962aef 8022183: GCC 4.6 change sdefault setting for omit-frame-pointer which breaks hotspot stack walking
hseigel
parents: 18447
diff changeset
   389
# starting with gcc 4.6.
8f3ad1962aef 8022183: GCC 4.6 change sdefault setting for omit-frame-pointer which breaks hotspot stack walking
hseigel
parents: 18447
diff changeset
   390
ifndef USE_SUNCC
8f3ad1962aef 8022183: GCC 4.6 change sdefault setting for omit-frame-pointer which breaks hotspot stack walking
hseigel
parents: 18447
diff changeset
   391
  CFLAGS += -fno-omit-frame-pointer
8f3ad1962aef 8022183: GCC 4.6 change sdefault setting for omit-frame-pointer which breaks hotspot stack walking
hseigel
parents: 18447
diff changeset
   392
endif