mirror of
https://github.com/openjdk/jdk.git
synced 2026-01-28 03:58:21 +00:00
8201236: Straighten out dtrace build logic
Reviewed-by: erikj
This commit is contained in:
parent
6ff35537f6
commit
10201f5b2f
@ -297,7 +297,7 @@ define SetupCompileNativeFileBody
|
||||
endif
|
||||
|
||||
$$($1_OBJ): $$($1_SRC_FILE) $$($$($1_BASE)_COMPILE_VARDEPS_FILE) \
|
||||
$$($1_VARDEPS_FILE) | $$($$($1_BASE)_BUILD_INFO)
|
||||
$$($$($1_BASE)_EXTRA_DEPS) $$($1_VARDEPS_FILE) | $$($$($1_BASE)_BUILD_INFO)
|
||||
$$(call LogInfo, Compiling $$($1_FILENAME) (for $$($$($1_BASE)_BASENAME)))
|
||||
$$(call MakeDir, $$(@D))
|
||||
ifneq ($(TOOLCHAIN_TYPE), microsoft)
|
||||
@ -366,6 +366,7 @@ endef
|
||||
# EXCLUDE_PATTERN exclude files matching any of these substrings
|
||||
# EXTRA_FILES List of extra files not in any of the SRC dirs
|
||||
# EXTRA_OBJECT_FILES List of extra object files to include when linking
|
||||
# EXTRA_DEPS List of extra dependencies to be added to each compiled file
|
||||
# VERSIONINFO_RESOURCE Input file for RC. Setting this implies that RC will be run
|
||||
# RC_FLAGS flags for RC.
|
||||
# EMBED_MANIFEST if true, embed manifest on Windows.
|
||||
|
||||
@ -54,4 +54,56 @@ ifeq ($(call check-jvm-feature, dtrace), true)
|
||||
TARGETS += $(patsubst $(DTRACE_SOURCE_DIR)/%.d, \
|
||||
$(DTRACE_GENSRC_DIR)/%.h, $(wildcard $(DTRACE_SOURCE_DIR)/*.d))
|
||||
|
||||
ifeq ($(OPENJDK_TARGET_OS), solaris)
|
||||
############################################################################
|
||||
# First we need to generate the dtraceGenOffsets tool. When run, this will
|
||||
# produce two header files and a C++ file. Note that generateJvmOffsets.cpp
|
||||
# is using the same JVM_CFLAGS as libjvm.so.
|
||||
|
||||
# Include support files that will setup JVM compiler flags.
|
||||
include lib/JvmFeatures.gmk
|
||||
include lib/JvmFlags.gmk
|
||||
|
||||
# We cannot compile until the JVMTI gensrc has finished
|
||||
JVMTI_H := $(JVM_VARIANT_OUTPUTDIR)/gensrc/jvmtifiles/jvmti.h
|
||||
|
||||
$(eval $(call SetupNativeCompilation, BUILD_DTRACE_GEN_OFFSETS, \
|
||||
NAME := dtraceGenOffsets, \
|
||||
TYPE := EXECUTABLE, \
|
||||
SRC := $(TOPDIR)/make/hotspot/src/native/dtrace, \
|
||||
TOOLCHAIN := $(TOOLCHAIN_BUILD), \
|
||||
LDFLAGS := -m64, \
|
||||
CFLAGS := -m64 $(JVM_CFLAGS), \
|
||||
EXTRA_DEPS := $(JVMTI_H), \
|
||||
OBJECT_DIR := $(JVM_VARIANT_OUTPUTDIR)/tools/dtrace-gen-offsets/objs, \
|
||||
OUTPUT_DIR := $(JVM_VARIANT_OUTPUTDIR)/tools/dtrace-gen-offsets, \
|
||||
))
|
||||
|
||||
DTRACE_GEN_OFFSETS_TOOL := $(BUILD_DTRACE_GEN_OFFSETS_TARGET)
|
||||
|
||||
# Argument 1: Output filename
|
||||
# Argument 2: dtrace-gen-offset tool command line option
|
||||
define SetupDtraceOffsetsGeneration
|
||||
$1: $$(BUILD_DTRACE_GEN_OFFSETS)
|
||||
$$(call LogInfo, Generating dtrace $2 file $$(@F))
|
||||
$$(call MakeDir, $$(@D))
|
||||
$$(call ExecuteWithLog, $$@, ( $$(DTRACE_GEN_OFFSETS_TOOL) -$$(strip $2) > $$@ ) )
|
||||
|
||||
TARGETS += $1
|
||||
endef
|
||||
|
||||
JVM_OFFSETS_H := $(DTRACE_GENSRC_DIR)/JvmOffsets.h
|
||||
JVM_OFFSETS_CPP := $(DTRACE_GENSRC_DIR)/JvmOffsets.cpp
|
||||
JVM_OFFSETS_INDEX_H := $(DTRACE_GENSRC_DIR)/JvmOffsetsIndex.h
|
||||
|
||||
############################################################################
|
||||
# Run the dtrace-gen-offset tool to generate these three files.
|
||||
# The generated JvmOffsets.cpp is compiled with the rest of libjvm.
|
||||
# The header files are used by libjvm_db and jhelper.d, respectively.
|
||||
|
||||
$(eval $(call SetupDtraceOffsetsGeneration, $(JVM_OFFSETS_H), header))
|
||||
$(eval $(call SetupDtraceOffsetsGeneration, $(JVM_OFFSETS_INDEX_H), index))
|
||||
$(eval $(call SetupDtraceOffsetsGeneration, $(JVM_OFFSETS_CPP), table))
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
60
make/hotspot/lib/CompileDtraceLibraries.gmk
Normal file
60
make/hotspot/lib/CompileDtraceLibraries.gmk
Normal file
@ -0,0 +1,60 @@
|
||||
#
|
||||
# Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
#
|
||||
# This code is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License version 2 only, as
|
||||
# published by the Free Software Foundation. Oracle designates this
|
||||
# particular file as subject to the "Classpath" exception as provided
|
||||
# by Oracle in the LICENSE file that accompanied this code.
|
||||
#
|
||||
# This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
# version 2 for more details (a copy is included in the LICENSE file that
|
||||
# accompanied this code).
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License version
|
||||
# 2 along with this work; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
# or visit www.oracle.com if you need additional information or have any
|
||||
# questions.
|
||||
#
|
||||
|
||||
ifeq ($(call check-jvm-feature, dtrace), true)
|
||||
ifeq ($(OPENJDK_TARGET_OS), solaris)
|
||||
|
||||
############################################################################
|
||||
# Build the stand-alone dtrace libraries.
|
||||
|
||||
LIBJVM_DTRACE_OUTPUTDIR := $(JVM_VARIANT_OUTPUTDIR)/libjvm_dtrace
|
||||
$(eval $(call SetupNativeCompilation, BUILD_LIBJVM_DTRACE, \
|
||||
NAME := jvm_dtrace, \
|
||||
OUTPUT_DIR := $(JVM_LIB_OUTPUTDIR), \
|
||||
SRC := $(TOPDIR)/src/java.base/solaris/native/libjvm_dtrace, \
|
||||
CFLAGS := -m64 -G -mt -KPIC, \
|
||||
LDFLAGS := -m64 -mt -xnolib $(SHARED_LIBRARY_FLAGS), \
|
||||
LIBS := $(LIBDL) -lthread -ldoor, \
|
||||
MAPFILE := $(TOPDIR)/make/mapfiles/libjvm_dtrace/mapfile-vers, \
|
||||
OBJECT_DIR := $(LIBJVM_DTRACE_OUTPUTDIR)/objs, \
|
||||
))
|
||||
|
||||
# Note that libjvm_db.c has tests for COMPILER2, but this was never set by
|
||||
# the old build.
|
||||
LIBJVM_DB_OUTPUTDIR := $(JVM_VARIANT_OUTPUTDIR)/libjvm_db
|
||||
$(eval $(call SetupNativeCompilation, BUILD_LIBJVM_DB, \
|
||||
NAME := jvm_db, \
|
||||
OUTPUT_DIR := $(JVM_LIB_OUTPUTDIR), \
|
||||
SRC := $(TOPDIR)/src/java.base/solaris/native/libjvm_db, \
|
||||
CFLAGS := -I$(DTRACE_GENSRC_DIR) -m64 -G -mt -KPIC, \
|
||||
LDFLAGS := -m64 -mt -xnolib $(SHARED_LIBRARY_FLAGS), \
|
||||
MAPFILE := $(TOPDIR)/make/mapfiles/libjvm_db/mapfile-vers, \
|
||||
OBJECT_DIR := $(LIBJVM_DB_OUTPUTDIR)/objs, \
|
||||
))
|
||||
|
||||
TARGETS += $(BUILD_LIBJVM_DTRACE) $(BUILD_LIBJVM_DB)
|
||||
|
||||
endif
|
||||
endif
|
||||
@ -1,39 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
#
|
||||
# This code is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License version 2 only, as
|
||||
# published by the Free Software Foundation. Oracle designates this
|
||||
# particular file as subject to the "Classpath" exception as provided
|
||||
# by Oracle in the LICENSE file that accompanied this code.
|
||||
#
|
||||
# This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
# version 2 for more details (a copy is included in the LICENSE file that
|
||||
# accompanied this code).
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License version
|
||||
# 2 along with this work; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
# or visit www.oracle.com if you need additional information or have any
|
||||
# questions.
|
||||
#
|
||||
|
||||
ifeq ($(call check-jvm-feature, dtrace), true)
|
||||
ifeq ($(OPENJDK_TARGET_OS), solaris)
|
||||
# These files are are generated by CompileDtrace.gmk but consumed by
|
||||
# CompileJvm.gmk
|
||||
DTRACE_OBJ := $(JVM_OUTPUTDIR)/objs/dtrace.o
|
||||
DTRACE_JHELPER_OBJ := $(JVM_OUTPUTDIR)/objs/dtrace_jhelper.o
|
||||
DTRACE_EXTRA_OBJECT_FILES := $(DTRACE_OBJ) $(DTRACE_JHELPER_OBJ)
|
||||
|
||||
# Since we cannot generate JvmOffsets.cpp as part of the gensrc step,
|
||||
# we need this special hook to get it to compile with the rest of libjvm.
|
||||
JVM_OFFSETS_CPP := $(DTRACE_SUPPORT_DIR)/JvmOffsets.cpp
|
||||
DTRACE_EXTRA_SOURCE_FILES := $(JVM_OFFSETS_CPP)
|
||||
endif
|
||||
endif
|
||||
@ -24,11 +24,13 @@
|
||||
#
|
||||
|
||||
# Include support files that will setup compiler flags due to the selected
|
||||
# jvm feature set, and specific file overrides.
|
||||
# jvm feature set, specific file overrides, and general flags.
|
||||
include lib/JvmFeatures.gmk
|
||||
include lib/JvmOverrideFiles.gmk
|
||||
include lib/JvmFlags.gmk
|
||||
|
||||
$(eval $(call IncludeCustomExtension, hotspot/lib/CompileJvm.gmk))
|
||||
# Include support files that will setup DTRACE_EXTRA_OBJECT_FILES.
|
||||
include lib/JvmDtraceObjects.gmk
|
||||
|
||||
################################################################################
|
||||
# Setup compilation of the main Hotspot native library (libjvm).
|
||||
@ -39,71 +41,6 @@ JVM_MAPFILE := $(JVM_OUTPUTDIR)/mapfile
|
||||
################################################################################
|
||||
# Platform independent setup
|
||||
|
||||
# This variable may be added to by a custom extension
|
||||
JVM_SRC_ROOTS += $(TOPDIR)/src/hotspot
|
||||
|
||||
JVM_SRC_DIRS += $(call uniq, $(wildcard $(foreach d, $(JVM_SRC_ROOTS), \
|
||||
$d/share \
|
||||
$d/os/$(HOTSPOT_TARGET_OS) \
|
||||
$d/os/$(HOTSPOT_TARGET_OS_TYPE) \
|
||||
$d/cpu/$(HOTSPOT_TARGET_CPU_ARCH) \
|
||||
$d/os_cpu/$(HOTSPOT_TARGET_OS)_$(HOTSPOT_TARGET_CPU_ARCH) \
|
||||
))) \
|
||||
$(JVM_VARIANT_OUTPUTDIR)/gensrc/jvmtifiles \
|
||||
$(JVM_VARIANT_OUTPUTDIR)/gensrc/tracefiles \
|
||||
#
|
||||
|
||||
JVM_CFLAGS_INCLUDES += \
|
||||
$(patsubst %,-I%,$(filter-out $(JVM_VARIANT_OUTPUTDIR)/gensrc/%, $(JVM_SRC_DIRS))) \
|
||||
-I$(JVM_VARIANT_OUTPUTDIR)/gensrc \
|
||||
-I$(TOPDIR)/src/hotspot/share/precompiled \
|
||||
-I$(TOPDIR)/src/hotspot/share/include \
|
||||
-I$(TOPDIR)/src/hotspot/os/$(HOTSPOT_TARGET_OS_TYPE)/include \
|
||||
-I$(SUPPORT_OUTPUTDIR)/modules_include/java.base \
|
||||
-I$(SUPPORT_OUTPUTDIR)/modules_include/java.base/$(OPENJDK_TARGET_OS_INCLUDE_SUBDIR) \
|
||||
-I$(TOPDIR)/src/java.base/share/native/libjimage \
|
||||
#
|
||||
|
||||
# INCLUDE_SUFFIX_* is only meant for including the proper
|
||||
# platform files. Don't use it to guard code. Use the value of
|
||||
# HOTSPOT_TARGET_CPU_DEFINE etc. instead.
|
||||
# Remaining TARGET_ARCH_* is needed to select the cpu specific
|
||||
# sources for 64-bit ARM ports (arm versus aarch64).
|
||||
JVM_CFLAGS_TARGET_DEFINES += \
|
||||
-DTARGET_ARCH_$(HOTSPOT_TARGET_CPU_ARCH) \
|
||||
-DINCLUDE_SUFFIX_OS=_$(HOTSPOT_TARGET_OS) \
|
||||
-DINCLUDE_SUFFIX_CPU=_$(HOTSPOT_TARGET_CPU_ARCH) \
|
||||
-DINCLUDE_SUFFIX_COMPILER=_$(HOTSPOT_TOOLCHAIN_TYPE) \
|
||||
-DTARGET_COMPILER_$(HOTSPOT_TOOLCHAIN_TYPE) \
|
||||
-D$(HOTSPOT_TARGET_CPU_DEFINE) \
|
||||
-DHOTSPOT_LIB_ARCH='"$(OPENJDK_TARGET_CPU_LEGACY_LIB)"' \
|
||||
#
|
||||
|
||||
ifeq ($(DEBUG_LEVEL), release)
|
||||
# For hotspot, release builds differ internally between "optimized" and "product"
|
||||
# in that "optimize" does not define PRODUCT.
|
||||
ifneq ($(HOTSPOT_DEBUG_LEVEL), optimized)
|
||||
JVM_CFLAGS_DEBUGLEVEL := -DPRODUCT
|
||||
endif
|
||||
else ifeq ($(DEBUG_LEVEL), fastdebug)
|
||||
JVM_CFLAGS_DEBUGLEVEL := -DASSERT
|
||||
ifeq ($(filter $(OPENJDK_TARGET_OS), windows aix), )
|
||||
# NOTE: Old build did not define CHECK_UNHANDLED_OOPS on Windows and AIX.
|
||||
JVM_CFLAGS_DEBUGLEVEL += -DCHECK_UNHANDLED_OOPS
|
||||
endif
|
||||
else ifeq ($(DEBUG_LEVEL), slowdebug)
|
||||
# _NMT_NOINLINE_ informs NMT that no inlining is done by the compiler
|
||||
JVM_CFLAGS_DEBUGLEVEL := -DASSERT -D_NMT_NOINLINE_
|
||||
endif
|
||||
|
||||
JVM_CFLAGS += \
|
||||
$(JVM_CFLAGS_DEBUGLEVEL) \
|
||||
$(JVM_CFLAGS_TARGET_DEFINES) \
|
||||
$(JVM_CFLAGS_FEATURES) \
|
||||
$(JVM_CFLAGS_INCLUDES) \
|
||||
$(EXTRA_CFLAGS) \
|
||||
#
|
||||
|
||||
JVM_LDFLAGS += \
|
||||
$(SHARED_LIBRARY_FLAGS) \
|
||||
$(JVM_LDFLAGS_FEATURES) \
|
||||
@ -142,11 +79,6 @@ CFLAGS_VM_VERSION := \
|
||||
-DCPU='"$(OPENJDK_TARGET_CPU_VM_VERSION)"' \
|
||||
#
|
||||
|
||||
# -DDONT_USE_PRECOMPILED_HEADER will exclude all includes in precompiled.hpp.
|
||||
ifeq ($(USE_PRECOMPILED_HEADER), false)
|
||||
JVM_CFLAGS += -DDONT_USE_PRECOMPILED_HEADER
|
||||
endif
|
||||
|
||||
################################################################################
|
||||
# Platform specific setup
|
||||
|
||||
@ -214,7 +146,6 @@ $(eval $(call SetupNativeCompilation, BUILD_LIBJVM, \
|
||||
TOOLCHAIN := TOOLCHAIN_LINK_CXX, \
|
||||
OUTPUT_DIR := $(JVM_LIB_OUTPUTDIR), \
|
||||
SRC := $(JVM_SRC_DIRS), \
|
||||
EXTRA_FILES := $(DTRACE_EXTRA_SOURCE_FILES), \
|
||||
EXCLUDES := $(JVM_EXCLUDES), \
|
||||
EXCLUDE_FILES := $(JVM_EXCLUDE_FILES), \
|
||||
EXCLUDE_PATTERNS := $(JVM_EXCLUDE_PATTERNS), \
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
# Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
#
|
||||
# This code is free software; you can redistribute it and/or modify it
|
||||
@ -31,11 +31,8 @@ include NativeCompilation.gmk
|
||||
|
||||
include HotspotCommon.gmk
|
||||
|
||||
# The dtrace setup must be done both before and after CompileJvm.gmk, due to
|
||||
# intricate dependencies.
|
||||
include lib/CompileDtracePreJvm.gmk
|
||||
include lib/CompileJvm.gmk
|
||||
include lib/CompileDtracePostJvm.gmk
|
||||
include lib/CompileDtraceLibraries.gmk
|
||||
|
||||
ifeq ($(BUILD_GTEST), true)
|
||||
include lib/CompileGtest.gmk
|
||||
|
||||
@ -23,64 +23,26 @@
|
||||
# questions.
|
||||
#
|
||||
|
||||
################################################################################
|
||||
# Support for dtrace integration with libjvm, and stand-alone dtrace library
|
||||
# compilation.
|
||||
|
||||
ifeq ($(call check-jvm-feature, dtrace), true)
|
||||
##############################################################################
|
||||
|
||||
ifeq ($(OPENJDK_TARGET_OS), solaris)
|
||||
|
||||
############################################################################
|
||||
# Integrate with libjvm. Here we generate three object files which are
|
||||
# Integrate with libjvm. Here we generate two object files which are
|
||||
# linked with libjvm.so. This step is complicated from a dependency
|
||||
# perspective, since it needs the rest of the compiled object files from the
|
||||
# libjvm compilation, but the output is object files that are to be included
|
||||
# when linking libjvm.so. So this generation must happen as a part of the
|
||||
# libjvm compilation.
|
||||
# perspective. We add these two files to the linking of libjvm using
|
||||
# EXTRA_OBJECT_FILES, but they need to be created outside the call to
|
||||
# SetupNativeCompilation. Also, one of the files is dependent on compiled
|
||||
# object files from the libjvm compilation, so this generation must happen
|
||||
# as a part of the libjvm compilation.
|
||||
|
||||
# First we need to generate the dtraceGenOffsets tool. When run, this will
|
||||
# produce more header files and a C++ file.
|
||||
DTRACE_OBJ := $(JVM_OUTPUTDIR)/objs/dtrace.o
|
||||
DTRACE_JHELPER_OBJ := $(JVM_OUTPUTDIR)/objs/dtrace_jhelper.o
|
||||
|
||||
# Note that generateJvmOffsets.cpp must be compiled as if it were a file
|
||||
# in the libjvm.so, using JVM_CFLAGS as setup in CompileJvm.gmk. Otherwise
|
||||
# this would preferrably have been done as a part of GensrcDtrace.gmk.
|
||||
$(eval $(call SetupNativeCompilation, BUILD_DTRACE_GEN_OFFSETS, \
|
||||
NAME := dtraceGenOffsets, \
|
||||
TYPE := EXECUTABLE, \
|
||||
SRC := $(TOPDIR)/make/hotspot/src/native/dtrace, \
|
||||
TOOLCHAIN := $(TOOLCHAIN_BUILD), \
|
||||
LDFLAGS := -m64, \
|
||||
CFLAGS := -m64 $(JVM_CFLAGS), \
|
||||
OBJECT_DIR := $(JVM_VARIANT_OUTPUTDIR)/tools/dtrace-gen-offsets/objs, \
|
||||
OUTPUT_DIR := $(JVM_VARIANT_OUTPUTDIR)/tools/dtrace-gen-offsets, \
|
||||
))
|
||||
|
||||
DTRACE_GEN_OFFSETS_TOOL := $(BUILD_DTRACE_GEN_OFFSETS_TARGET)
|
||||
|
||||
# Argument 1: Output filename
|
||||
# Argument 2: dtrace-gen-offset tool command line option
|
||||
define SetupDtraceOffsetsGeneration
|
||||
$1: $$(BUILD_DTRACE_GEN_OFFSETS)
|
||||
$$(call LogInfo, Generating dtrace $2 file $$(@F))
|
||||
$$(call MakeDir, $$(@D))
|
||||
$$(call ExecuteWithLog, $$@, ( $$(DTRACE_GEN_OFFSETS_TOOL) -$$(strip $2) > $$@ ) )
|
||||
|
||||
TARGETS += $1
|
||||
endef
|
||||
|
||||
JVM_OFFSETS_H := $(DTRACE_SUPPORT_DIR)/JvmOffsets.h
|
||||
JVM_OFFSETS_CPP := $(DTRACE_SUPPORT_DIR)/JvmOffsets.cpp
|
||||
JVM_OFFSETS_INDEX_H := $(DTRACE_SUPPORT_DIR)/JvmOffsetsIndex.h
|
||||
|
||||
# Run the dtrace-gen-offset tool to generate these three files.
|
||||
# The generated JvmOffsets.cpp is compiled with the rest of libjvm.
|
||||
$(eval $(call SetupDtraceOffsetsGeneration, $(JVM_OFFSETS_H), header))
|
||||
$(eval $(call SetupDtraceOffsetsGeneration, $(JVM_OFFSETS_INDEX_H), index))
|
||||
$(eval $(call SetupDtraceOffsetsGeneration, $(JVM_OFFSETS_CPP), table))
|
||||
DTRACE_EXTRA_OBJECT_FILES := $(DTRACE_OBJ) $(DTRACE_JHELPER_OBJ)
|
||||
|
||||
############################################################################
|
||||
# Generate DTRACE_OBJ which is linked with libjvm.so.
|
||||
# Generate DTRACE_OBJ which is linked with libjvm.so. It depends on a set of
|
||||
# object files from the compilation.
|
||||
|
||||
# Concatenate all *.d files into a single file
|
||||
DTRACE_SOURCE_FILES := $(addprefix $(TOPDIR)/src/hotspot/os/posix/dtrace/, \
|
||||
@ -138,13 +100,17 @@ ifeq ($(call check-jvm-feature, dtrace), true)
|
||||
############################################################################
|
||||
# Generate DTRACE_JHELPER_OBJ which is linked with libjvm.so.
|
||||
|
||||
JHELPER_DTRACE_SRC := $(TOPDIR)/src/hotspot/os/solaris/dtrace/jhelper.d
|
||||
|
||||
# jhelper.d includes JvmOffsetsIndex.h which was created by the gensrc step.
|
||||
DTRACE_GENSRC_DIR := $(JVM_VARIANT_OUTPUTDIR)/gensrc/dtracefiles
|
||||
JVM_OFFSETS_INDEX_H := $(DTRACE_GENSRC_DIR)/JvmOffsetsIndex.h
|
||||
|
||||
# Unfortunately dtrace generates incorrect types for some symbols in
|
||||
# dtrace_jhelper.o, resulting in "warning: symbol X has differing types"
|
||||
# See JDK-6890703 for details.
|
||||
# We work around this by fixing the types for these symbols using elfedit,
|
||||
# after dtrace has generated the .o file.
|
||||
JHELPER_DTRACE_SRC := $(TOPDIR)/src/hotspot/os/solaris/dtrace/jhelper.d
|
||||
|
||||
GetElfeditCommands = \
|
||||
$(foreach symbol, \
|
||||
$(shell $(GREP) ^extern $(JHELPER_DTRACE_SRC) | $(AWK) '{ gsub(";","") ; print $$3 }'), \
|
||||
@ -156,7 +122,7 @@ ifeq ($(call check-jvm-feature, dtrace), true)
|
||||
$(call LogInfo, Running dtrace for $(<F))
|
||||
$(call MakeDir, $(DTRACE_SUPPORT_DIR))
|
||||
$(call ExecuteWithLog, $(DTRACE_SUPPORT_DIR)/$(@F).d, \
|
||||
($(CPP) $(DTRACE_CPP_FLAGS) -I$(DTRACE_SUPPORT_DIR) $^ \
|
||||
($(CPP) $(DTRACE_CPP_FLAGS) -I$(DTRACE_GENSRC_DIR) $^ \
|
||||
> $(DTRACE_SUPPORT_DIR)/$(@F).d))
|
||||
$(call ExecuteWithLog, $@, $(DTRACE) $(DTRACE_FLAGS) -o $@ \
|
||||
-s $(DTRACE_SUPPORT_DIR)/$(@F).d)
|
||||
@ -164,40 +130,5 @@ ifeq ($(call check-jvm-feature, dtrace), true)
|
||||
$(call ExecuteWithLog, $@.elfedit, $(ELFEDIT) $(call GetElfeditCommands) $@)
|
||||
endif
|
||||
|
||||
############################################################################
|
||||
# Build the stand-alone dtrace libraries
|
||||
|
||||
LIBJVM_DTRACE_OUTPUTDIR := $(JVM_VARIANT_OUTPUTDIR)/libjvm_dtrace
|
||||
|
||||
$(eval $(call SetupNativeCompilation, BUILD_LIBJVM_DTRACE, \
|
||||
NAME := jvm_dtrace, \
|
||||
OUTPUT_DIR := $(JVM_LIB_OUTPUTDIR), \
|
||||
SRC := $(TOPDIR)/src/java.base/solaris/native/libjvm_dtrace, \
|
||||
CFLAGS := -m64 -G -mt -KPIC, \
|
||||
LDFLAGS := -m64 -mt -xnolib $(SHARED_LIBRARY_FLAGS), \
|
||||
LIBS := $(LIBDL) -lthread -ldoor, \
|
||||
MAPFILE := $(TOPDIR)/make/mapfiles/libjvm_dtrace/mapfile-vers, \
|
||||
OBJECT_DIR := $(LIBJVM_DTRACE_OUTPUTDIR)/objs, \
|
||||
))
|
||||
|
||||
LIBJVM_DB_OUTPUTDIR := $(JVM_VARIANT_OUTPUTDIR)/libjvm_db
|
||||
|
||||
# Note that libjvm_db.c has tests for COMPILER2, but this was never set by
|
||||
# the old build.
|
||||
$(eval $(call SetupNativeCompilation, BUILD_LIBJVM_DB, \
|
||||
NAME := jvm_db, \
|
||||
OUTPUT_DIR := $(JVM_LIB_OUTPUTDIR), \
|
||||
SRC := $(TOPDIR)/src/java.base/solaris/native/libjvm_db, \
|
||||
CFLAGS := -I$(JVM_VARIANT_OUTPUTDIR)/gensrc -I$(DTRACE_SUPPORT_DIR) \
|
||||
-m64 -G -mt -KPIC, \
|
||||
LDFLAGS := -m64 -mt -xnolib $(SHARED_LIBRARY_FLAGS), \
|
||||
MAPFILE := $(TOPDIR)/make/mapfiles/libjvm_db/mapfile-vers, \
|
||||
OBJECT_DIR := $(LIBJVM_DB_OUTPUTDIR)/objs, \
|
||||
))
|
||||
|
||||
# We need the generated JvmOffsets.h before we can compile the libjvm_db source code.
|
||||
$(BUILD_LIBJVM_DB_ALL_OBJS): $(JVM_OFFSETS_H)
|
||||
|
||||
TARGETS += $(BUILD_LIBJVM_DTRACE) $(BUILD_LIBJVM_DB)
|
||||
endif
|
||||
endif
|
||||
97
make/hotspot/lib/JvmFlags.gmk
Normal file
97
make/hotspot/lib/JvmFlags.gmk
Normal file
@ -0,0 +1,97 @@
|
||||
#
|
||||
# Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
#
|
||||
# This code is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License version 2 only, as
|
||||
# published by the Free Software Foundation. Oracle designates this
|
||||
# particular file as subject to the "Classpath" exception as provided
|
||||
# by Oracle in the LICENSE file that accompanied this code.
|
||||
#
|
||||
# This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
# version 2 for more details (a copy is included in the LICENSE file that
|
||||
# accompanied this code).
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License version
|
||||
# 2 along with this work; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
# or visit www.oracle.com if you need additional information or have any
|
||||
# questions.
|
||||
#
|
||||
|
||||
$(eval $(call IncludeCustomExtension, hotspot/lib/JvmFlags.gmk))
|
||||
|
||||
################################################################################
|
||||
# Setup JVM_CFLAGS. These are shared between GensrcDtrace.gmk and CompileJvm.gmk.
|
||||
|
||||
# This variable may be added to by a custom extension
|
||||
JVM_SRC_ROOTS += $(TOPDIR)/src/hotspot
|
||||
|
||||
JVM_SRC_DIRS += $(call uniq, $(wildcard $(foreach d, $(JVM_SRC_ROOTS), \
|
||||
$d/share \
|
||||
$d/os/$(HOTSPOT_TARGET_OS) \
|
||||
$d/os/$(HOTSPOT_TARGET_OS_TYPE) \
|
||||
$d/cpu/$(HOTSPOT_TARGET_CPU_ARCH) \
|
||||
$d/os_cpu/$(HOTSPOT_TARGET_OS)_$(HOTSPOT_TARGET_CPU_ARCH) \
|
||||
))) \
|
||||
$(JVM_VARIANT_OUTPUTDIR)/gensrc
|
||||
#
|
||||
|
||||
JVM_CFLAGS_INCLUDES += \
|
||||
$(patsubst %,-I%,$(JVM_SRC_DIRS)) \
|
||||
-I$(TOPDIR)/src/hotspot/share/precompiled \
|
||||
-I$(TOPDIR)/src/hotspot/share/include \
|
||||
-I$(TOPDIR)/src/hotspot/os/$(HOTSPOT_TARGET_OS_TYPE)/include \
|
||||
-I$(SUPPORT_OUTPUTDIR)/modules_include/java.base \
|
||||
-I$(SUPPORT_OUTPUTDIR)/modules_include/java.base/$(OPENJDK_TARGET_OS_INCLUDE_SUBDIR) \
|
||||
-I$(TOPDIR)/src/java.base/share/native/libjimage \
|
||||
#
|
||||
|
||||
# INCLUDE_SUFFIX_* is only meant for including the proper
|
||||
# platform files. Don't use it to guard code. Use the value of
|
||||
# HOTSPOT_TARGET_CPU_DEFINE etc. instead.
|
||||
# Remaining TARGET_ARCH_* is needed to select the cpu specific
|
||||
# sources for 64-bit ARM ports (arm versus aarch64).
|
||||
JVM_CFLAGS_TARGET_DEFINES += \
|
||||
-DTARGET_ARCH_$(HOTSPOT_TARGET_CPU_ARCH) \
|
||||
-DINCLUDE_SUFFIX_OS=_$(HOTSPOT_TARGET_OS) \
|
||||
-DINCLUDE_SUFFIX_CPU=_$(HOTSPOT_TARGET_CPU_ARCH) \
|
||||
-DINCLUDE_SUFFIX_COMPILER=_$(HOTSPOT_TOOLCHAIN_TYPE) \
|
||||
-DTARGET_COMPILER_$(HOTSPOT_TOOLCHAIN_TYPE) \
|
||||
-D$(HOTSPOT_TARGET_CPU_DEFINE) \
|
||||
-DHOTSPOT_LIB_ARCH='"$(OPENJDK_TARGET_CPU_LEGACY_LIB)"' \
|
||||
#
|
||||
|
||||
ifeq ($(DEBUG_LEVEL), release)
|
||||
# For hotspot, release builds differ internally between "optimized" and "product"
|
||||
# in that "optimize" does not define PRODUCT.
|
||||
ifneq ($(HOTSPOT_DEBUG_LEVEL), optimized)
|
||||
JVM_CFLAGS_DEBUGLEVEL := -DPRODUCT
|
||||
endif
|
||||
else ifeq ($(DEBUG_LEVEL), fastdebug)
|
||||
JVM_CFLAGS_DEBUGLEVEL := -DASSERT
|
||||
ifeq ($(filter $(OPENJDK_TARGET_OS), windows aix), )
|
||||
# NOTE: Old build did not define CHECK_UNHANDLED_OOPS on Windows and AIX.
|
||||
JVM_CFLAGS_DEBUGLEVEL += -DCHECK_UNHANDLED_OOPS
|
||||
endif
|
||||
else ifeq ($(DEBUG_LEVEL), slowdebug)
|
||||
# _NMT_NOINLINE_ informs NMT that no inlining is done by the compiler
|
||||
JVM_CFLAGS_DEBUGLEVEL := -DASSERT -D_NMT_NOINLINE_
|
||||
endif
|
||||
|
||||
JVM_CFLAGS += \
|
||||
$(JVM_CFLAGS_DEBUGLEVEL) \
|
||||
$(JVM_CFLAGS_TARGET_DEFINES) \
|
||||
$(JVM_CFLAGS_FEATURES) \
|
||||
$(JVM_CFLAGS_INCLUDES) \
|
||||
$(EXTRA_CFLAGS) \
|
||||
#
|
||||
|
||||
# -DDONT_USE_PRECOMPILED_HEADER will exclude all includes in precompiled.hpp.
|
||||
ifeq ($(USE_PRECOMPILED_HEADER), false)
|
||||
JVM_CFLAGS += -DDONT_USE_PRECOMPILED_HEADER
|
||||
endif
|
||||
@ -31,29 +31,23 @@
|
||||
* GENOFFS_SCCS_VER 34
|
||||
*/
|
||||
|
||||
#include "generateJvmOffsets.h"
|
||||
#include <stdio.h>
|
||||
#include <strings.h>
|
||||
|
||||
/* A workaround for private and protected fields */
|
||||
#define private public
|
||||
#define protected public
|
||||
|
||||
#include <proc_service.h>
|
||||
#include "code/codeBlob.hpp"
|
||||
#include "code/nmethod.hpp"
|
||||
#include "code/pcDesc.hpp"
|
||||
#include "gc/shared/collectedHeap.hpp"
|
||||
#include "memory/heap.hpp"
|
||||
#include "memory/memRegion.hpp"
|
||||
#include "memory/universe.hpp"
|
||||
#include "memory/virtualspace.hpp"
|
||||
#include "oops/constMethod.hpp"
|
||||
#include "oops/klass.hpp"
|
||||
#include "oops/method.hpp"
|
||||
#include "oops/oop.hpp"
|
||||
#include "oops/symbol.hpp"
|
||||
#include "runtime/vmStructs.hpp"
|
||||
#include "utilities/accessFlags.hpp"
|
||||
#include "utilities/globalDefinitions.hpp"
|
||||
|
||||
typedef enum GEN_variant {
|
||||
GEN_OFFSET = 0,
|
||||
GEN_INDEX = 1,
|
||||
GEN_TABLE = 2
|
||||
} GEN_variant;
|
||||
|
||||
#ifdef COMPILER1
|
||||
#ifdef ASSERT
|
||||
|
||||
|
||||
@ -1,43 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef OS_SOLARIS_DTRACE_GENERATEJVMOFFSETS_H
|
||||
#define OS_SOLARIS_DTRACE_GENERATEJVMOFFSETS_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <strings.h>
|
||||
|
||||
typedef enum GEN_variant {
|
||||
GEN_OFFSET = 0,
|
||||
GEN_INDEX = 1,
|
||||
GEN_TABLE = 2
|
||||
} GEN_variant;
|
||||
|
||||
extern "C" {
|
||||
int generateJvmOffsets(GEN_variant gen_var);
|
||||
void gen_prologue(GEN_variant gen_var);
|
||||
void gen_epilogue(GEN_variant gen_var);
|
||||
}
|
||||
|
||||
#endif // OS_SOLARIS_DTRACE_GENERATEJVMOFFSETS_H
|
||||
Loading…
x
Reference in New Issue
Block a user