< prev index next >

make/hotspot/lib/CompileJvm.gmk

Print this page




   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
  23 # questions.
  24 #
  25 
  26 # Include support files that will setup compiler flags due to the selected
  27 # jvm feature set, and specific file overrides.
  28 include lib/JvmFeatures.gmk
  29 include lib/JvmOverrideFiles.gmk

  30 
  31 $(eval $(call IncludeCustomExtension, hotspot/lib/CompileJvm.gmk))

  32 
  33 ################################################################################
  34 # Setup compilation of the main Hotspot native library (libjvm).
  35 
  36 JVM_OUTPUTDIR := $(JVM_VARIANT_OUTPUTDIR)/libjvm
  37 JVM_MAPFILE := $(JVM_OUTPUTDIR)/mapfile
  38 
  39 ################################################################################
  40 # Platform independent setup
  41 
  42 # This variable may be added to by a custom extension
  43 JVM_SRC_ROOTS += $(TOPDIR)/src/hotspot
  44 
  45 JVM_SRC_DIRS += $(call uniq, $(wildcard $(foreach d, $(JVM_SRC_ROOTS), \
  46         $d/share \
  47         $d/os/$(HOTSPOT_TARGET_OS) \
  48         $d/os/$(HOTSPOT_TARGET_OS_TYPE) \
  49         $d/cpu/$(HOTSPOT_TARGET_CPU_ARCH) \
  50         $d/os_cpu/$(HOTSPOT_TARGET_OS)_$(HOTSPOT_TARGET_CPU_ARCH) \
  51     ))) \
  52     $(JVM_VARIANT_OUTPUTDIR)/gensrc/jvmtifiles \
  53     $(JVM_VARIANT_OUTPUTDIR)/gensrc/tracefiles \
  54     #
  55 
  56 JVM_CFLAGS_INCLUDES += \
  57     $(patsubst %,-I%,$(filter-out $(JVM_VARIANT_OUTPUTDIR)/gensrc/%, $(JVM_SRC_DIRS))) \
  58     -I$(JVM_VARIANT_OUTPUTDIR)/gensrc \
  59     -I$(TOPDIR)/src/hotspot/share/precompiled \
  60     -I$(TOPDIR)/src/hotspot/share/include \
  61     -I$(TOPDIR)/src/hotspot/os/$(HOTSPOT_TARGET_OS_TYPE)/include \
  62     -I$(SUPPORT_OUTPUTDIR)/modules_include/java.base \
  63     -I$(SUPPORT_OUTPUTDIR)/modules_include/java.base/$(OPENJDK_TARGET_OS_INCLUDE_SUBDIR) \
  64     -I$(TOPDIR)/src/java.base/share/native/libjimage \
  65     #
  66 
  67 # INCLUDE_SUFFIX_* is only meant for including the proper
  68 # platform files. Don't use it to guard code. Use the value of
  69 # HOTSPOT_TARGET_CPU_DEFINE etc. instead.
  70 # Remaining TARGET_ARCH_* is needed to select the cpu specific
  71 # sources for 64-bit ARM ports (arm versus aarch64).
  72 JVM_CFLAGS_TARGET_DEFINES += \
  73     -DTARGET_ARCH_$(HOTSPOT_TARGET_CPU_ARCH) \
  74     -DINCLUDE_SUFFIX_OS=_$(HOTSPOT_TARGET_OS) \
  75     -DINCLUDE_SUFFIX_CPU=_$(HOTSPOT_TARGET_CPU_ARCH) \
  76     -DINCLUDE_SUFFIX_COMPILER=_$(HOTSPOT_TOOLCHAIN_TYPE) \
  77     -DTARGET_COMPILER_$(HOTSPOT_TOOLCHAIN_TYPE) \
  78     -D$(HOTSPOT_TARGET_CPU_DEFINE) \
  79     -DHOTSPOT_LIB_ARCH='"$(OPENJDK_TARGET_CPU_LEGACY_LIB)"' \
  80     #
  81 
  82 ifeq ($(DEBUG_LEVEL), release)
  83   # For hotspot, release builds differ internally between "optimized" and "product"
  84   # in that "optimize" does not define PRODUCT.
  85   ifneq ($(HOTSPOT_DEBUG_LEVEL), optimized)
  86     JVM_CFLAGS_DEBUGLEVEL := -DPRODUCT
  87   endif
  88 else ifeq ($(DEBUG_LEVEL), fastdebug)
  89   JVM_CFLAGS_DEBUGLEVEL := -DASSERT
  90   ifeq ($(filter $(OPENJDK_TARGET_OS), windows aix), )
  91     # NOTE: Old build did not define CHECK_UNHANDLED_OOPS on Windows and AIX.
  92     JVM_CFLAGS_DEBUGLEVEL += -DCHECK_UNHANDLED_OOPS
  93   endif
  94 else ifeq ($(DEBUG_LEVEL), slowdebug)
  95   # _NMT_NOINLINE_ informs NMT that no inlining is done by the compiler
  96   JVM_CFLAGS_DEBUGLEVEL := -DASSERT -D_NMT_NOINLINE_
  97 endif
  98 
  99 JVM_CFLAGS += \
 100     $(JVM_CFLAGS_DEBUGLEVEL) \
 101     $(JVM_CFLAGS_TARGET_DEFINES) \
 102     $(JVM_CFLAGS_FEATURES) \
 103     $(JVM_CFLAGS_INCLUDES) \
 104     $(EXTRA_CFLAGS) \
 105     #
 106 
 107 JVM_LDFLAGS += \
 108     $(SHARED_LIBRARY_FLAGS) \
 109     $(JVM_LDFLAGS_FEATURES) \
 110     $(EXTRA_LDFLAGS) \
 111     #
 112 
 113 JVM_LIBS += \
 114     $(JVM_LIBS_FEATURES) \
 115     #
 116 
 117 # These files and directories are always excluded
 118 JVM_EXCLUDE_FILES += args.cc
 119 JVM_EXCLUDES += adlc
 120 
 121 # Needed by vm_version.cpp
 122 ifeq ($(OPENJDK_TARGET_CPU), x86_64)
 123   OPENJDK_TARGET_CPU_VM_VERSION := amd64
 124 else ifeq ($(OPENJDK_TARGET_CPU), sparcv9)
 125   OPENJDK_TARGET_CPU_VM_VERSION := sparc
 126 else ifeq ($(HOTSPOT_TARGET_CPU_ARCH), arm)
 127   ifeq ($(OPENJDK_TARGET_CPU), aarch64)
 128     # This sets the Oracle Aarch64 port to use arm64
 129     # while the original Aarch64 port uses aarch64
 130     OPENJDK_TARGET_CPU_VM_VERSION := arm64
 131   endif
 132 else
 133   OPENJDK_TARGET_CPU_VM_VERSION := $(OPENJDK_TARGET_CPU)
 134 endif
 135 
 136 CFLAGS_VM_VERSION := \
 137     $(VERSION_CFLAGS) \
 138     -DHOTSPOT_VERSION_STRING='"$(VERSION_STRING)"' \
 139     -DDEBUG_LEVEL='"$(DEBUG_LEVEL)"' \
 140     -DHOTSPOT_BUILD_USER='"$(USERNAME)"' \
 141     -DHOTSPOT_VM_DISTRO='"$(HOTSPOT_VM_DISTRO)"' \
 142     -DCPU='"$(OPENJDK_TARGET_CPU_VM_VERSION)"' \
 143     #
 144 
 145 # -DDONT_USE_PRECOMPILED_HEADER will exclude all includes in precompiled.hpp.
 146 ifeq ($(USE_PRECOMPILED_HEADER), false)
 147   JVM_CFLAGS += -DDONT_USE_PRECOMPILED_HEADER
 148 endif
 149 
 150 ################################################################################
 151 # Platform specific setup
 152 
 153 # ARM source selection
 154 
 155 ifeq ($(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU), linux-arm)
 156   JVM_EXCLUDE_PATTERNS += arm_64
 157 
 158 else ifeq ($(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU), linux-aarch64)
 159   # For 64-bit arm builds, we use the 64 bit hotspot/src/cpu/arm
 160   # hotspot sources if HOTSPOT_TARGET_CPU_ARCH is set to arm.
 161   # Exclude the aarch64 and 32 bit arm files for this build.
 162   ifeq ($(HOTSPOT_TARGET_CPU_ARCH), arm)
 163     JVM_EXCLUDE_PATTERNS += arm_32 aarch64
 164   endif
 165 endif
 166 
 167 ifneq ($(filter $(OPENJDK_TARGET_OS), linux macosx windows), )
 168   JVM_PRECOMPILED_HEADER := $(TOPDIR)/src/hotspot/share/precompiled/precompiled.hpp
 169 endif


 197     RC_DESC := 64-Bit$(SPACE)
 198   endif
 199   JVM_RCFLAGS += -D"HS_FILEDESC=$(HOTSPOT_VM_DISTRO) $(RC_DESC)$(JVM_VARIANT) VM"
 200 endif
 201 
 202 JVM_OPTIMIZATION ?= HIGHEST_JVM
 203 
 204 # Need to set JVM_STRIPFLAGS to the default value from SPEC since the STRIPFLAGS
 205 # parameter to SetupNativeCompilation allows an empty value to override the
 206 # default.
 207 JVM_STRIPFLAGS ?= $(STRIPFLAGS)
 208 
 209 ################################################################################
 210 # Now set up the actual compilation of the main hotspot native library
 211 
 212 $(eval $(call SetupNativeCompilation, BUILD_LIBJVM, \
 213     NAME := jvm, \
 214     TOOLCHAIN := TOOLCHAIN_LINK_CXX, \
 215     OUTPUT_DIR := $(JVM_LIB_OUTPUTDIR), \
 216     SRC := $(JVM_SRC_DIRS), \
 217     EXTRA_FILES := $(DTRACE_EXTRA_SOURCE_FILES), \
 218     EXCLUDES := $(JVM_EXCLUDES), \
 219     EXCLUDE_FILES := $(JVM_EXCLUDE_FILES), \
 220     EXCLUDE_PATTERNS := $(JVM_EXCLUDE_PATTERNS), \
 221     EXTRA_OBJECT_FILES := $(DTRACE_EXTRA_OBJECT_FILES), \
 222     CFLAGS := $(JVM_CFLAGS), \
 223     vm_version.cpp_CXXFLAGS := $(CFLAGS_VM_VERSION), \
 224     arguments.cpp_CXXFLAGS := $(CFLAGS_VM_VERSION), \
 225     DISABLED_WARNINGS_clang := tautological-compare, \
 226     DISABLED_WARNINGS_xlc := 1540-0216 1540-0198 1540-1090 1540-1639 \
 227         1540-1088 1500-010, \
 228     ASFLAGS := $(JVM_ASFLAGS), \
 229     LDFLAGS := $(JVM_LDFLAGS), \
 230     LIBS := $(JVM_LIBS), \
 231     OPTIMIZATION := $(JVM_OPTIMIZATION), \
 232     OBJECT_DIR := $(JVM_OUTPUTDIR)/objs, \
 233     MAPFILE := $(JVM_MAPFILE), \
 234     USE_MAPFILE_FOR_SYMBOLS := true, \
 235     STRIPFLAGS := $(JVM_STRIPFLAGS), \
 236     EMBED_MANIFEST := true, \
 237     RC_FLAGS := $(JVM_RCFLAGS), \




   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
  23 # questions.
  24 #
  25 
  26 # Include support files that will setup compiler flags due to the selected
  27 # jvm feature set, specific file overrides, and general flags.
  28 include lib/JvmFeatures.gmk
  29 include lib/JvmOverrideFiles.gmk
  30 include lib/JvmFlags.gmk
  31 
  32 # Include support files that will setup DTRACE_EXTRA_OBJECT_FILES.
  33 include lib/JvmDtraceObjects.gmk
  34 
  35 ################################################################################
  36 # Setup compilation of the main Hotspot native library (libjvm).
  37 
  38 JVM_OUTPUTDIR := $(JVM_VARIANT_OUTPUTDIR)/libjvm
  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 ifeq ($(HOTSPOT_TARGET_CPU_ARCH), arm)
  64   ifeq ($(OPENJDK_TARGET_CPU), aarch64)
  65     # This sets the Oracle Aarch64 port to use arm64
  66     # while the original Aarch64 port uses aarch64
  67     OPENJDK_TARGET_CPU_VM_VERSION := arm64
  68   endif
  69 else
  70   OPENJDK_TARGET_CPU_VM_VERSION := $(OPENJDK_TARGET_CPU)
  71 endif
  72 
  73 CFLAGS_VM_VERSION := \
  74     $(VERSION_CFLAGS) \
  75     -DHOTSPOT_VERSION_STRING='"$(VERSION_STRING)"' \
  76     -DDEBUG_LEVEL='"$(DEBUG_LEVEL)"' \
  77     -DHOTSPOT_BUILD_USER='"$(USERNAME)"' \
  78     -DHOTSPOT_VM_DISTRO='"$(HOTSPOT_VM_DISTRO)"' \
  79     -DCPU='"$(OPENJDK_TARGET_CPU_VM_VERSION)"' \
  80     #
  81 





  82 ################################################################################
  83 # Platform specific setup
  84 
  85 # ARM source selection
  86 
  87 ifeq ($(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU), linux-arm)
  88   JVM_EXCLUDE_PATTERNS += arm_64
  89 
  90 else ifeq ($(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU), linux-aarch64)
  91   # For 64-bit arm builds, we use the 64 bit hotspot/src/cpu/arm
  92   # hotspot sources if HOTSPOT_TARGET_CPU_ARCH is set to arm.
  93   # Exclude the aarch64 and 32 bit arm files for this build.
  94   ifeq ($(HOTSPOT_TARGET_CPU_ARCH), arm)
  95     JVM_EXCLUDE_PATTERNS += arm_32 aarch64
  96   endif
  97 endif
  98 
  99 ifneq ($(filter $(OPENJDK_TARGET_OS), linux macosx windows), )
 100   JVM_PRECOMPILED_HEADER := $(TOPDIR)/src/hotspot/share/precompiled/precompiled.hpp
 101 endif


 129     RC_DESC := 64-Bit$(SPACE)
 130   endif
 131   JVM_RCFLAGS += -D"HS_FILEDESC=$(HOTSPOT_VM_DISTRO) $(RC_DESC)$(JVM_VARIANT) VM"
 132 endif
 133 
 134 JVM_OPTIMIZATION ?= HIGHEST_JVM
 135 
 136 # Need to set JVM_STRIPFLAGS to the default value from SPEC since the STRIPFLAGS
 137 # parameter to SetupNativeCompilation allows an empty value to override the
 138 # default.
 139 JVM_STRIPFLAGS ?= $(STRIPFLAGS)
 140 
 141 ################################################################################
 142 # Now set up the actual compilation of the main hotspot native library
 143 
 144 $(eval $(call SetupNativeCompilation, BUILD_LIBJVM, \
 145     NAME := jvm, \
 146     TOOLCHAIN := TOOLCHAIN_LINK_CXX, \
 147     OUTPUT_DIR := $(JVM_LIB_OUTPUTDIR), \
 148     SRC := $(JVM_SRC_DIRS), \

 149     EXCLUDES := $(JVM_EXCLUDES), \
 150     EXCLUDE_FILES := $(JVM_EXCLUDE_FILES), \
 151     EXCLUDE_PATTERNS := $(JVM_EXCLUDE_PATTERNS), \
 152     EXTRA_OBJECT_FILES := $(DTRACE_EXTRA_OBJECT_FILES), \
 153     CFLAGS := $(JVM_CFLAGS), \
 154     vm_version.cpp_CXXFLAGS := $(CFLAGS_VM_VERSION), \
 155     arguments.cpp_CXXFLAGS := $(CFLAGS_VM_VERSION), \
 156     DISABLED_WARNINGS_clang := tautological-compare, \
 157     DISABLED_WARNINGS_xlc := 1540-0216 1540-0198 1540-1090 1540-1639 \
 158         1540-1088 1500-010, \
 159     ASFLAGS := $(JVM_ASFLAGS), \
 160     LDFLAGS := $(JVM_LDFLAGS), \
 161     LIBS := $(JVM_LIBS), \
 162     OPTIMIZATION := $(JVM_OPTIMIZATION), \
 163     OBJECT_DIR := $(JVM_OUTPUTDIR)/objs, \
 164     MAPFILE := $(JVM_MAPFILE), \
 165     USE_MAPFILE_FOR_SYMBOLS := true, \
 166     STRIPFLAGS := $(JVM_STRIPFLAGS), \
 167     EMBED_MANIFEST := true, \
 168     RC_FLAGS := $(JVM_RCFLAGS), \


< prev index next >