< prev index next >

make/hotspot/lib/CompileJvm.gmk

Print this page


   1 #
   2 # Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
   3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4 #
   5 # This code is free software; you can redistribute it and/or modify it
   6 # under the terms of the GNU General Public License version 2 only, as
   7 # published by the Free Software Foundation.  Oracle designates this
   8 # particular file as subject to the "Classpath" exception as provided
   9 # by Oracle in the LICENSE file that accompanied this code.
  10 #
  11 # This code is distributed in the hope that it will be useful, but WITHOUT
  12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14 # version 2 for more details (a copy is included in the LICENSE file that
  15 # accompanied this code).
  16 #
  17 # You should have received a copy of the GNU General Public License version
  18 # 2 along with this work; if not, write to the Free Software Foundation,
  19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20 #
  21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22 # or visit www.oracle.com if you need additional information or have any


  39 JVM_MAPFILE := $(JVM_OUTPUTDIR)/mapfile
  40 
  41 ################################################################################
  42 # Platform independent setup
  43 
  44 JVM_LDFLAGS += \
  45     $(SHARED_LIBRARY_FLAGS) \
  46     $(JVM_LDFLAGS_FEATURES) \
  47     $(EXTRA_LDFLAGS) \
  48     #
  49 
  50 JVM_LIBS += \
  51     $(JVM_LIBS_FEATURES) \
  52     #
  53 
  54 # These files and directories are always excluded
  55 JVM_EXCLUDE_FILES += args.cc
  56 JVM_EXCLUDES += adlc
  57 
  58 # Needed by vm_version.cpp
  59 ifeq ($(call isTargetCpu, x86_64), true)
  60   OPENJDK_TARGET_CPU_VM_VERSION := amd64
  61 else ifeq ($(call isTargetCpu, sparcv9), true)
  62   OPENJDK_TARGET_CPU_VM_VERSION := sparc
  63 else
  64   OPENJDK_TARGET_CPU_VM_VERSION := $(OPENJDK_TARGET_CPU)
  65 endif
  66 
  67 CFLAGS_VM_VERSION := \
  68     $(VERSION_CFLAGS) \
  69     -DHOTSPOT_VERSION_STRING='"$(VERSION_STRING)"' \
  70     -DDEBUG_LEVEL='"$(DEBUG_LEVEL)"' \
  71     -DHOTSPOT_BUILD_USER='"$(USERNAME)"' \
  72     -DHOTSPOT_VM_DISTRO='"$(HOTSPOT_VM_DISTRO)"' \
  73     -DCPU='"$(OPENJDK_TARGET_CPU_VM_VERSION)"' \
  74     #
  75 
  76 ################################################################################
  77 # Disabled warnings
  78 
  79 DISABLED_WARNINGS_gcc := extra parentheses comment unknown-pragmas address \
  80     delete-non-virtual-dtor char-subscripts array-bounds int-in-bool-context \
  81     ignored-qualifiers  missing-field-initializers implicit-fallthrough \


  90     undefined-var-template sometimes-uninitialized unknown-pragmas \
  91     delete-non-virtual-dtor missing-braces char-subscripts \
  92     ignored-qualifiers missing-field-initializers mismatched-tags
  93 
  94 DISABLED_WARNINGS_solstudio := labelnotused hidef w_novirtualdescr inlafteruse \
  95     unknownpragma doubunder w_enumnotused w_toomanyenumnotused \
  96     wvarhidenmem wunreachable wnoretvalue notemsource
  97 
  98 DISABLED_WARNINGS_xlc := 1540-0216 1540-0198 1540-1090 1540-1639 1540-1088 \
  99     1500-010
 100 
 101 DISABLED_WARNINGS_microsoft :=
 102 
 103 
 104 
 105 ################################################################################
 106 # Platform specific setup
 107 
 108 # ARM source selection
 109 
 110 ifeq ($(call And, $(call isTargetOs, linux) $(call isTargetCpu, arm)), true)
 111   JVM_EXCLUDE_PATTERNS += arm_64
 112 
 113 else ifeq ($(call And, $(call isTargetOs, linux) $(call isTargetCpu, aarch64)), true)
 114   # For 64-bit arm builds, we use the 64 bit hotspot/src/cpu/arm
 115   # hotspot sources if HOTSPOT_TARGET_CPU_ARCH is set to arm.
 116   # Exclude the aarch64 and 32 bit arm files for this build.
 117   ifeq ($(HOTSPOT_TARGET_CPU_ARCH), arm)
 118     JVM_EXCLUDE_PATTERNS += arm_32 aarch64
 119   endif
 120 endif
 121 
 122 ifeq ($(call isTargetOs, linux macosx windows), true)
 123   JVM_PRECOMPILED_HEADER := $(TOPDIR)/src/hotspot/share/precompiled/precompiled.hpp
 124 endif
 125 
 126 ifeq ($(call isTargetCpu, x86), true)
 127   JVM_EXCLUDE_PATTERNS += x86_64
 128 else ifeq ($(call isTargetCpu, x86_64), true)
 129   JVM_EXCLUDE_PATTERNS += x86_32
 130 endif
 131 
 132 # Inline assembly for solaris
 133 ifeq ($(call isTargetOs, solaris), true)
 134   ifeq ($(call isTargetCpu, x86_64), true)
 135     JVM_CFLAGS += $(TOPDIR)/src/hotspot/os_cpu/solaris_x86/solaris_x86_64.il
 136   else ifeq ($(call isTargetCpu, sparcv9), true)
 137     JVM_CFLAGS += $(TOPDIR)/src/hotspot/os_cpu/solaris_sparc/solaris_sparc.il
 138   endif
 139   # Exclude warnings in devstudio 12.6
 140   ifeq ($(CC_VERSION_NUMBER), 5.15)
 141     DISABLED_WARNINGS_solstudio += SEC_ARR_OUTSIDE_BOUND_READ \
 142       SEC_ARR_OUTSIDE_BOUND_WRITE
 143   endif
 144 endif
 145 
 146 ifeq ($(call And, $(call isTargetOs, solaris) $(call isTargetCpu, sparcv9)), true)
 147   ifeq ($(COMPILE_WITH_DEBUG_SYMBOLS), false)
 148     # NOTE: In the old build, we weirdly enough set -g/-g0 always, regardless
 149     # of if debug symbols were needed. Without it, compilation fails on
 150     # sparc! :-(
 151     JVM_CFLAGS += -g0
 152   endif
 153 endif
 154 
 155 ifeq ($(call isTargetOs, windows), true)
 156   ifeq ($(call isTargetCpuBits, 64), true)
 157     RC_DESC := 64-Bit$(SPACE)
 158   endif
 159   JVM_RCFLAGS += -D"HS_FILEDESC=$(HOTSPOT_VM_DISTRO) $(RC_DESC)$(JVM_VARIANT) VM"
 160 endif
 161 
 162 JVM_OPTIMIZATION ?= HIGHEST_JVM
 163 
 164 # Need to set JVM_STRIPFLAGS to the default value from SPEC since the STRIPFLAGS
 165 # parameter to SetupNativeCompilation allows an empty value to override the
 166 # default.
 167 JVM_STRIPFLAGS ?= $(STRIPFLAGS)
 168 
 169 # This source set is reused so save in cache.
 170 $(call FillFindCache, $(JVM_SRC_DIRS))
 171 
 172 ################################################################################
 173 # Now set up the actual compilation of the main hotspot native library
 174 
 175 $(eval $(call SetupNativeCompilation, BUILD_LIBJVM, \
 176     NAME := jvm, \
 177     TOOLCHAIN := TOOLCHAIN_LINK_CXX, \
 178     OUTPUT_DIR := $(JVM_LIB_OUTPUTDIR), \
 179     SRC := $(JVM_SRC_DIRS), \
 180     EXCLUDES := $(JVM_EXCLUDES), \
 181     EXCLUDE_FILES := $(JVM_EXCLUDE_FILES), \
 182     EXCLUDE_PATTERNS := $(JVM_EXCLUDE_PATTERNS), \
 183     EXTRA_OBJECT_FILES := $(DTRACE_EXTRA_OBJECT_FILES), \
 184     CFLAGS := $(JVM_CFLAGS), \
 185     vm_version.cpp_CXXFLAGS := $(CFLAGS_VM_VERSION), \
 186     arguments.cpp_CXXFLAGS := $(CFLAGS_VM_VERSION), \
 187     DISABLED_WARNINGS_gcc := $(DISABLED_WARNINGS_gcc), \
 188     DISABLED_WARNINGS_clang := $(DISABLED_WARNINGS_clang), \
 189     DISABLED_WARNINGS_solstudio := $(DISABLED_WARNINGS_solstudio), \
 190     DISABLED_WARNINGS_xlc := $(DISABLED_WARNINGS_xlc), \
 191     DISABLED_WARNINGS_microsoft := $(DISABLED_WARNINGS_microsoft), \
 192     ASFLAGS := $(JVM_ASFLAGS), \
 193     LDFLAGS := $(JVM_LDFLAGS), \
 194     LIBS := $(JVM_LIBS), \
 195     OPTIMIZATION := $(JVM_OPTIMIZATION), \
 196     OBJECT_DIR := $(JVM_OUTPUTDIR)/objs, \
 197     MAPFILE := $(JVM_MAPFILE), \
 198     USE_MAPFILE_FOR_SYMBOLS := true, \
 199     STRIPFLAGS := $(JVM_STRIPFLAGS), \
 200     EMBED_MANIFEST := true, \
 201     RC_FLAGS := $(JVM_RCFLAGS), \
 202     VERSIONINFO_RESOURCE := $(TOPDIR)/src/hotspot/os/windows/version.rc, \
 203     PRECOMPILED_HEADER := $(JVM_PRECOMPILED_HEADER), \
 204     PRECOMPILED_HEADER_EXCLUDE := $(JVM_PRECOMPILED_HEADER_EXCLUDE), \
 205     DEFINE_THIS_FILE := false, \
 206 ))
 207 
 208 # Always recompile vm_version.cpp if libjvm needs to be relinked. This ensures
 209 # that the internal vm version is updated as it relies on __DATE__ and __TIME__
 210 # macros.
 211 VM_VERSION_OBJ := $(JVM_OUTPUTDIR)/objs/vm_version$(OBJ_SUFFIX)
 212 $(VM_VERSION_OBJ): $(filter-out $(VM_VERSION_OBJ) $(JVM_MAPFILE), \
 213     $(BUILD_LIBJVM_TARGET_DEPS))
 214 
 215 ifneq ($(GENERATE_COMPILE_COMMANDS_ONLY), true)
 216   ifeq ($(call isTargetOs, windows), true)
 217     # It doesn't matter which jvm.lib file gets exported, but we need
 218     # to pick just one.
 219     ifeq ($(JVM_VARIANT), $(JVM_VARIANT_MAIN))
 220       $(eval $(call SetupCopyFiles, COPY_JVM_LIB, \
 221           DEST := $(LIB_OUTPUTDIR), \
 222           FILES :=$(BUILD_LIBJVM_IMPORT_LIBRARY), \
 223       ))
 224       TARGETS += $(COPY_JVM_LIB)
 225     endif
 226   endif
 227 endif
 228 
 229 # AIX warning explanation:
 230 # 1500-010  : (W) WARNING in ...: Infinite loop.  Program may not stop.
 231 #             There are several infinite loops in the vm, so better suppress.
 232 # 1540-0198 : (W) The omitted keyword "private" is assumed for base class "...".
 233 # 1540-0216 : (W) An expression of type .. cannot be converted to type ..
 234 #             In hotspot this fires for functionpointer to pointer conversions
 235 # 1540-1088 : (W) The exception specification is being ignored.
 236 #             In hotspot this is caused by throw() in declaration of new() in nmethod.hpp.


   1 #
   2 # Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
   3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4 #
   5 # This code is free software; you can redistribute it and/or modify it
   6 # under the terms of the GNU General Public License version 2 only, as
   7 # published by the Free Software Foundation.  Oracle designates this
   8 # particular file as subject to the "Classpath" exception as provided
   9 # by Oracle in the LICENSE file that accompanied this code.
  10 #
  11 # This code is distributed in the hope that it will be useful, but WITHOUT
  12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14 # version 2 for more details (a copy is included in the LICENSE file that
  15 # accompanied this code).
  16 #
  17 # You should have received a copy of the GNU General Public License version
  18 # 2 along with this work; if not, write to the Free Software Foundation,
  19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20 #
  21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22 # or visit www.oracle.com if you need additional information or have any


  39 JVM_MAPFILE := $(JVM_OUTPUTDIR)/mapfile
  40 
  41 ################################################################################
  42 # Platform independent setup
  43 
  44 JVM_LDFLAGS += \
  45     $(SHARED_LIBRARY_FLAGS) \
  46     $(JVM_LDFLAGS_FEATURES) \
  47     $(EXTRA_LDFLAGS) \
  48     #
  49 
  50 JVM_LIBS += \
  51     $(JVM_LIBS_FEATURES) \
  52     #
  53 
  54 # These files and directories are always excluded
  55 JVM_EXCLUDE_FILES += args.cc
  56 JVM_EXCLUDES += adlc
  57 
  58 # Needed by vm_version.cpp
  59 ifeq ($(OPENJDK_TARGET_CPU), x86_64)
  60   OPENJDK_TARGET_CPU_VM_VERSION := amd64
  61 else ifeq ($(OPENJDK_TARGET_CPU), sparcv9)
  62   OPENJDK_TARGET_CPU_VM_VERSION := sparc
  63 else
  64   OPENJDK_TARGET_CPU_VM_VERSION := $(OPENJDK_TARGET_CPU)
  65 endif
  66 
  67 CFLAGS_VM_VERSION := \
  68     $(VERSION_CFLAGS) \
  69     -DHOTSPOT_VERSION_STRING='"$(VERSION_STRING)"' \
  70     -DDEBUG_LEVEL='"$(DEBUG_LEVEL)"' \
  71     -DHOTSPOT_BUILD_USER='"$(USERNAME)"' \
  72     -DHOTSPOT_VM_DISTRO='"$(HOTSPOT_VM_DISTRO)"' \
  73     -DCPU='"$(OPENJDK_TARGET_CPU_VM_VERSION)"' \
  74     #
  75 
  76 ################################################################################
  77 # Disabled warnings
  78 
  79 DISABLED_WARNINGS_gcc := extra parentheses comment unknown-pragmas address \
  80     delete-non-virtual-dtor char-subscripts array-bounds int-in-bool-context \
  81     ignored-qualifiers  missing-field-initializers implicit-fallthrough \


  90     undefined-var-template sometimes-uninitialized unknown-pragmas \
  91     delete-non-virtual-dtor missing-braces char-subscripts \
  92     ignored-qualifiers missing-field-initializers mismatched-tags
  93 
  94 DISABLED_WARNINGS_solstudio := labelnotused hidef w_novirtualdescr inlafteruse \
  95     unknownpragma doubunder w_enumnotused w_toomanyenumnotused \
  96     wvarhidenmem wunreachable wnoretvalue notemsource
  97 
  98 DISABLED_WARNINGS_xlc := 1540-0216 1540-0198 1540-1090 1540-1639 1540-1088 \
  99     1500-010
 100 
 101 DISABLED_WARNINGS_microsoft :=
 102 
 103 
 104 
 105 ################################################################################
 106 # Platform specific setup
 107 
 108 # ARM source selection
 109 
 110 ifeq ($(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU), linux-arm)
 111   JVM_EXCLUDE_PATTERNS += arm_64
 112 
 113 else ifeq ($(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU), linux-aarch64)
 114   # For 64-bit arm builds, we use the 64 bit hotspot/src/cpu/arm
 115   # hotspot sources if HOTSPOT_TARGET_CPU_ARCH is set to arm.
 116   # Exclude the aarch64 and 32 bit arm files for this build.
 117   ifeq ($(HOTSPOT_TARGET_CPU_ARCH), arm)
 118     JVM_EXCLUDE_PATTERNS += arm_32 aarch64
 119   endif
 120 endif
 121 
 122 ifneq ($(filter $(OPENJDK_TARGET_OS), linux macosx windows), )
 123   JVM_PRECOMPILED_HEADER := $(TOPDIR)/src/hotspot/share/precompiled/precompiled.hpp
 124 endif
 125 
 126 ifeq ($(OPENJDK_TARGET_CPU), x86)
 127   JVM_EXCLUDE_PATTERNS += x86_64
 128 else ifeq ($(OPENJDK_TARGET_CPU), x86_64)
 129   JVM_EXCLUDE_PATTERNS += x86_32
 130 endif
 131 
 132 # Inline assembly for solaris
 133 ifeq ($(OPENJDK_TARGET_OS), solaris)
 134   ifeq ($(OPENJDK_TARGET_CPU), x86_64)
 135     JVM_CFLAGS += $(TOPDIR)/src/hotspot/os_cpu/solaris_x86/solaris_x86_64.il
 136   else ifeq ($(OPENJDK_TARGET_CPU), sparcv9)
 137     JVM_CFLAGS += $(TOPDIR)/src/hotspot/os_cpu/solaris_sparc/solaris_sparc.il
 138   endif
 139   # Exclude warnings in devstudio 12.6
 140   ifeq ($(CC_VERSION_NUMBER), 5.15)
 141     DISABLED_WARNINGS_solstudio += SEC_ARR_OUTSIDE_BOUND_READ \
 142       SEC_ARR_OUTSIDE_BOUND_WRITE
 143   endif
 144 endif
 145 
 146 ifeq ($(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU), solaris-sparcv9)
 147   ifeq ($(COMPILE_WITH_DEBUG_SYMBOLS), false)
 148     # NOTE: In the old build, we weirdly enough set -g/-g0 always, regardless
 149     # of if debug symbols were needed. Without it, compilation fails on
 150     # sparc! :-(
 151     JVM_CFLAGS += -g0
 152   endif
 153 endif
 154 
 155 ifeq ($(OPENJDK_TARGET_OS), windows)
 156   ifeq ($(OPENJDK_TARGET_CPU_BITS), 64)
 157     RC_DESC := 64-Bit$(SPACE)
 158   endif
 159   JVM_RCFLAGS += -D"HS_FILEDESC=$(HOTSPOT_VM_DISTRO) $(RC_DESC)$(JVM_VARIANT) VM"
 160 endif
 161 
 162 JVM_OPTIMIZATION ?= HIGHEST_JVM
 163 
 164 # Need to set JVM_STRIPFLAGS to the default value from SPEC since the STRIPFLAGS
 165 # parameter to SetupNativeCompilation allows an empty value to override the
 166 # default.
 167 JVM_STRIPFLAGS ?= $(STRIPFLAGS)
 168 



 169 ################################################################################
 170 # Now set up the actual compilation of the main hotspot native library
 171 
 172 $(eval $(call SetupNativeCompilation, BUILD_LIBJVM, \
 173     NAME := jvm, \
 174     TOOLCHAIN := TOOLCHAIN_LINK_CXX, \
 175     OUTPUT_DIR := $(JVM_LIB_OUTPUTDIR), \
 176     SRC := $(JVM_SRC_DIRS), \
 177     EXCLUDES := $(JVM_EXCLUDES), \
 178     EXCLUDE_FILES := $(JVM_EXCLUDE_FILES), \
 179     EXCLUDE_PATTERNS := $(JVM_EXCLUDE_PATTERNS), \
 180     EXTRA_OBJECT_FILES := $(DTRACE_EXTRA_OBJECT_FILES), \
 181     CFLAGS := $(JVM_CFLAGS), \
 182     vm_version.cpp_CXXFLAGS := $(CFLAGS_VM_VERSION), \
 183     arguments.cpp_CXXFLAGS := $(CFLAGS_VM_VERSION), \
 184     DISABLED_WARNINGS_gcc := $(DISABLED_WARNINGS_gcc), \
 185     DISABLED_WARNINGS_clang := $(DISABLED_WARNINGS_clang), \
 186     DISABLED_WARNINGS_solstudio := $(DISABLED_WARNINGS_solstudio), \
 187     DISABLED_WARNINGS_xlc := $(DISABLED_WARNINGS_xlc), \
 188     DISABLED_WARNINGS_microsoft := $(DISABLED_WARNINGS_microsoft), \
 189     ASFLAGS := $(JVM_ASFLAGS), \
 190     LDFLAGS := $(JVM_LDFLAGS), \
 191     LIBS := $(JVM_LIBS), \
 192     OPTIMIZATION := $(JVM_OPTIMIZATION), \
 193     OBJECT_DIR := $(JVM_OUTPUTDIR)/objs, \
 194     MAPFILE := $(JVM_MAPFILE), \
 195     USE_MAPFILE_FOR_SYMBOLS := true, \
 196     STRIPFLAGS := $(JVM_STRIPFLAGS), \
 197     EMBED_MANIFEST := true, \
 198     RC_FLAGS := $(JVM_RCFLAGS), \
 199     VERSIONINFO_RESOURCE := $(TOPDIR)/src/hotspot/os/windows/version.rc, \
 200     PRECOMPILED_HEADER := $(JVM_PRECOMPILED_HEADER), \
 201     PRECOMPILED_HEADER_EXCLUDE := $(JVM_PRECOMPILED_HEADER_EXCLUDE), \

 202 ))
 203 
 204 # Always recompile vm_version.cpp if libjvm needs to be relinked. This ensures
 205 # that the internal vm version is updated as it relies on __DATE__ and __TIME__
 206 # macros.
 207 VM_VERSION_OBJ := $(JVM_OUTPUTDIR)/objs/vm_version$(OBJ_SUFFIX)
 208 $(VM_VERSION_OBJ): $(filter-out $(VM_VERSION_OBJ) $(JVM_MAPFILE), \
 209     $(BUILD_LIBJVM_TARGET_DEPS))
 210 
 211 ifneq ($(GENERATE_COMPILE_COMMANDS_ONLY), true)
 212   ifeq ($(OPENJDK_TARGET_OS), windows)
 213     # It doesn't matter which jvm.lib file gets exported, but we need
 214     # to pick just one.
 215     ifeq ($(JVM_VARIANT), $(JVM_VARIANT_MAIN))
 216       $(eval $(call SetupCopyFiles, COPY_JVM_LIB, \
 217           DEST := $(LIB_OUTPUTDIR), \
 218           FILES :=$(BUILD_LIBJVM_IMPORT_LIBRARY), \
 219       ))
 220       TARGETS += $(COPY_JVM_LIB)
 221     endif
 222   endif
 223 endif
 224 
 225 # AIX warning explanation:
 226 # 1500-010  : (W) WARNING in ...: Infinite loop.  Program may not stop.
 227 #             There are several infinite loops in the vm, so better suppress.
 228 # 1540-0198 : (W) The omitted keyword "private" is assumed for base class "...".
 229 # 1540-0216 : (W) An expression of type .. cannot be converted to type ..
 230 #             In hotspot this fires for functionpointer to pointer conversions
 231 # 1540-1088 : (W) The exception specification is being ignored.
 232 #             In hotspot this is caused by throw() in declaration of new() in nmethod.hpp.


< prev index next >