make/hotspot/lib/JvmDtraceObjects.gmk
author darcy
Tue, 12 Nov 2019 10:45:23 -0800
changeset 59037 3d2575331a41
parent 58908 73bb9c4002cc
child 59053 ba6c248cae19
permissions -rw-r--r--
8233940: Preview API tests for String methods should use ${jdk.version} as -source arg Reviewed-by: jlaskey, jlahoda
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
37437
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
     1
#
58908
73bb9c4002cc 8233381: Update copyright year in build system files
ihse
parents: 55017
diff changeset
     2
# Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
37437
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
     3
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
     4
#
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
     5
# This code is free software; you can redistribute it and/or modify it
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
     6
# under the terms of the GNU General Public License version 2 only, as
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
     7
# published by the Free Software Foundation.  Oracle designates this
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
     8
# particular file as subject to the "Classpath" exception as provided
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
     9
# by Oracle in the LICENSE file that accompanied this code.
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    10
#
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    11
# This code is distributed in the hope that it will be useful, but WITHOUT
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    13
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    14
# version 2 for more details (a copy is included in the LICENSE file that
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    15
# accompanied this code).
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    16
#
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    17
# You should have received a copy of the GNU General Public License version
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    18
# 2 along with this work; if not, write to the Free Software Foundation,
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    19
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    20
#
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    21
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    22
# or visit www.oracle.com if you need additional information or have any
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    23
# questions.
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    24
#
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    25
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    26
ifeq ($(call check-jvm-feature, dtrace), true)
53683
48ff68e2fe5c 8218431: Improved platform checking in makefiles
ihse
parents: 52876
diff changeset
    27
  ifeq ($(call isTargetOs, solaris), true)
37437
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    28
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    29
    ############################################################################
49553
58cffb6ec13c 8201236: Straighten out dtrace build logic
ihse
parents: 49241
diff changeset
    30
    # Integrate with libjvm. Here we generate two object files which are
58cffb6ec13c 8201236: Straighten out dtrace build logic
ihse
parents: 49241
diff changeset
    31
    # linked with libjvm.so. This step is complicated from a dependency
58cffb6ec13c 8201236: Straighten out dtrace build logic
ihse
parents: 49241
diff changeset
    32
    # perspective. We add these two files to the linking of libjvm using
58cffb6ec13c 8201236: Straighten out dtrace build logic
ihse
parents: 49241
diff changeset
    33
    # EXTRA_OBJECT_FILES, but they need to be created outside the call to
58cffb6ec13c 8201236: Straighten out dtrace build logic
ihse
parents: 49241
diff changeset
    34
    # SetupNativeCompilation. Also, one of the files is dependent on compiled
58cffb6ec13c 8201236: Straighten out dtrace build logic
ihse
parents: 49241
diff changeset
    35
    # object files from the libjvm compilation, so this generation must happen
58cffb6ec13c 8201236: Straighten out dtrace build logic
ihse
parents: 49241
diff changeset
    36
    # as a part of the libjvm compilation.
58cffb6ec13c 8201236: Straighten out dtrace build logic
ihse
parents: 49241
diff changeset
    37
58cffb6ec13c 8201236: Straighten out dtrace build logic
ihse
parents: 49241
diff changeset
    38
    DTRACE_OBJ := $(JVM_OUTPUTDIR)/objs/dtrace.o
58cffb6ec13c 8201236: Straighten out dtrace build logic
ihse
parents: 49241
diff changeset
    39
    DTRACE_JHELPER_OBJ := $(JVM_OUTPUTDIR)/objs/dtrace_jhelper.o
58cffb6ec13c 8201236: Straighten out dtrace build logic
ihse
parents: 49241
diff changeset
    40
58cffb6ec13c 8201236: Straighten out dtrace build logic
ihse
parents: 49241
diff changeset
    41
    DTRACE_EXTRA_OBJECT_FILES := $(DTRACE_OBJ) $(DTRACE_JHELPER_OBJ)
58cffb6ec13c 8201236: Straighten out dtrace build logic
ihse
parents: 49241
diff changeset
    42
58cffb6ec13c 8201236: Straighten out dtrace build logic
ihse
parents: 49241
diff changeset
    43
    ############################################################################
58cffb6ec13c 8201236: Straighten out dtrace build logic
ihse
parents: 49241
diff changeset
    44
    # Generate DTRACE_OBJ which is linked with libjvm.so. It depends on a set of
58cffb6ec13c 8201236: Straighten out dtrace build logic
ihse
parents: 49241
diff changeset
    45
    # object files from the compilation.
37437
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    46
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    47
    # Concatenate all *.d files into a single file
47217
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 47216
diff changeset
    48
    DTRACE_SOURCE_FILES := $(addprefix $(TOPDIR)/src/hotspot/os/posix/dtrace/, \
37437
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    49
        hotspot_jni.d \
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    50
        hotspot.d \
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    51
        hs_private.d \
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    52
    )
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    53
55017
5dc15cb1405c 8224677: Dtrace .d files clash with make dependency .d files
erikj
parents: 53683
diff changeset
    54
    # *.d in the objs dir is used for generated make dependency files, so use
5dc15cb1405c 8224677: Dtrace .d files clash with make dependency .d files
erikj
parents: 53683
diff changeset
    55
    # *.dt for dtrace files to avoid clashes.
5dc15cb1405c 8224677: Dtrace .d files clash with make dependency .d files
erikj
parents: 53683
diff changeset
    56
    $(JVM_OUTPUTDIR)/objs/dtrace.dt: $(DTRACE_SOURCE_FILES)
37437
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    57
	$(call LogInfo, Generating $(@F))
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    58
	$(call MakeDir, $(@D))
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    59
	$(CAT) $^ > $@
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    60
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    61
    DTRACE_INSTRUMENTED_OBJS := $(addprefix $(JVM_OUTPUTDIR)/objs/, \
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    62
        ciEnv.o \
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    63
        classLoadingService.o \
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    64
        compileBroker.o \
52876
2d17750d41e7 8214791: Consistently name gc files containing VM operations
tschatzl
parents: 49982
diff changeset
    65
        gcVMOperations.o \
37437
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    66
        hashtable.o \
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    67
        instanceKlass.o \
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    68
        java.o \
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    69
        jni.o \
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    70
        jvm.o \
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    71
        memoryManager.o \
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    72
        nmethod.o \
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    73
        objectMonitor.o \
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    74
        runtimeService.o \
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    75
        sharedRuntime.o \
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    76
        synchronizer.o \
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    77
        thread.o \
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    78
        unsafe.o \
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    79
        vmThread.o \
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    80
    )
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    81
49982
9042ffe5b7fe 8200729: Conditional compilation of GCs
stefank
parents: 49553
diff changeset
    82
    ifeq ($(call check-jvm-feature, cmsgc), true)
37437
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    83
      DTRACE_INSTRUMENTED_OBJS += $(addprefix $(JVM_OUTPUTDIR)/objs/, \
52876
2d17750d41e7 8214791: Consistently name gc files containing VM operations
tschatzl
parents: 49982
diff changeset
    84
          cmsVMOperations.o \
49982
9042ffe5b7fe 8200729: Conditional compilation of GCs
stefank
parents: 49553
diff changeset
    85
      )
9042ffe5b7fe 8200729: Conditional compilation of GCs
stefank
parents: 49553
diff changeset
    86
    endif
9042ffe5b7fe 8200729: Conditional compilation of GCs
stefank
parents: 49553
diff changeset
    87
9042ffe5b7fe 8200729: Conditional compilation of GCs
stefank
parents: 49553
diff changeset
    88
    ifeq ($(call check-jvm-feature, parallelgc), true)
9042ffe5b7fe 8200729: Conditional compilation of GCs
stefank
parents: 49553
diff changeset
    89
      DTRACE_INSTRUMENTED_OBJS += $(addprefix $(JVM_OUTPUTDIR)/objs/, \
52876
2d17750d41e7 8214791: Consistently name gc files containing VM operations
tschatzl
parents: 49982
diff changeset
    90
          psVMOperations.o \
37437
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    91
      )
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    92
    endif
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    93
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    94
    DTRACE_FLAGS := -64 -G
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    95
    DTRACE_CPP_FLAGS := -D_LP64
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    96
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    97
    # Make sure we run our selected compiler for preprocessing instead of letting
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    98
    # the dtrace tool pick it on it's own.
55017
5dc15cb1405c 8224677: Dtrace .d files clash with make dependency .d files
erikj
parents: 53683
diff changeset
    99
    $(DTRACE_OBJ): $(JVM_OUTPUTDIR)/objs/dtrace.dt $(DTRACE_INSTRUMENTED_OBJS)
37437
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   100
	$(call LogInfo, Generating $(@F) from $(<F) and object files)
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   101
	$(call MakeDir, $(DTRACE_SUPPORT_DIR))
55017
5dc15cb1405c 8224677: Dtrace .d files clash with make dependency .d files
erikj
parents: 53683
diff changeset
   102
	$(call ExecuteWithLog, $(DTRACE_SUPPORT_DIR)/$(@F).dt, \
5dc15cb1405c 8224677: Dtrace .d files clash with make dependency .d files
erikj
parents: 53683
diff changeset
   103
	    ($(CPP) $(DTRACE_CPP_FLAGS) $< > $(DTRACE_SUPPORT_DIR)/$(@F).dt))
37437
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   104
	$(call ExecuteWithLog, $@, $(DTRACE) $(DTRACE_FLAGS) -xlazyload -o $@ \
55017
5dc15cb1405c 8224677: Dtrace .d files clash with make dependency .d files
erikj
parents: 53683
diff changeset
   105
	    -s $(DTRACE_SUPPORT_DIR)/$(@F).dt $(sort $(DTRACE_INSTRUMENTED_OBJS)))
37437
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   106
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   107
    ############################################################################
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   108
    # Generate DTRACE_JHELPER_OBJ which is linked with libjvm.so.
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   109
49553
58cffb6ec13c 8201236: Straighten out dtrace build logic
ihse
parents: 49241
diff changeset
   110
    JHELPER_DTRACE_SRC := $(TOPDIR)/src/hotspot/os/solaris/dtrace/jhelper.d
58cffb6ec13c 8201236: Straighten out dtrace build logic
ihse
parents: 49241
diff changeset
   111
58cffb6ec13c 8201236: Straighten out dtrace build logic
ihse
parents: 49241
diff changeset
   112
    # jhelper.d includes JvmOffsetsIndex.h which was created by the gensrc step.
58cffb6ec13c 8201236: Straighten out dtrace build logic
ihse
parents: 49241
diff changeset
   113
    DTRACE_GENSRC_DIR := $(JVM_VARIANT_OUTPUTDIR)/gensrc/dtracefiles
58cffb6ec13c 8201236: Straighten out dtrace build logic
ihse
parents: 49241
diff changeset
   114
    JVM_OFFSETS_INDEX_H := $(DTRACE_GENSRC_DIR)/JvmOffsetsIndex.h
58cffb6ec13c 8201236: Straighten out dtrace build logic
ihse
parents: 49241
diff changeset
   115
37437
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   116
    # Unfortunately dtrace generates incorrect types for some symbols in
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   117
    # dtrace_jhelper.o, resulting in "warning: symbol X has differing types"
49078
039e63e471e1 8198859: Use elfedit to silence linker warnings on solaris
ihse
parents: 49070
diff changeset
   118
    # See JDK-6890703 for details.
039e63e471e1 8198859: Use elfedit to silence linker warnings on solaris
ihse
parents: 49070
diff changeset
   119
    # We work around this by fixing the types for these symbols using elfedit,
039e63e471e1 8198859: Use elfedit to silence linker warnings on solaris
ihse
parents: 49070
diff changeset
   120
    # after dtrace has generated the .o file.
49124
6abbc1f5c2a1 8198862: Stop doing funky compilation stuff for dtrace
ihse
parents: 49078
diff changeset
   121
    GetElfeditCommands = \
6abbc1f5c2a1 8198862: Stop doing funky compilation stuff for dtrace
ihse
parents: 49078
diff changeset
   122
      $(foreach symbol, \
6abbc1f5c2a1 8198862: Stop doing funky compilation stuff for dtrace
ihse
parents: 49078
diff changeset
   123
          $(shell $(GREP) ^extern $(JHELPER_DTRACE_SRC) | $(AWK) '{ gsub(";","") ; print $$3 }'), \
6abbc1f5c2a1 8198862: Stop doing funky compilation stuff for dtrace
ihse
parents: 49078
diff changeset
   124
          -e 'sym:st_type $(symbol) 1')
6abbc1f5c2a1 8198862: Stop doing funky compilation stuff for dtrace
ihse
parents: 49078
diff changeset
   125
6abbc1f5c2a1 8198862: Stop doing funky compilation stuff for dtrace
ihse
parents: 49078
diff changeset
   126
    # Make sure we run our selected compiler for preprocessing instead of letting
6abbc1f5c2a1 8198862: Stop doing funky compilation stuff for dtrace
ihse
parents: 49078
diff changeset
   127
    # the dtrace tool pick it on it's own.
49078
039e63e471e1 8198859: Use elfedit to silence linker warnings on solaris
ihse
parents: 49070
diff changeset
   128
    $(DTRACE_JHELPER_OBJ): $(JHELPER_DTRACE_SRC) $(JVM_OFFSETS_INDEX_H)
37437
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   129
	$(call LogInfo, Running dtrace for $(<F))
49124
6abbc1f5c2a1 8198862: Stop doing funky compilation stuff for dtrace
ihse
parents: 49078
diff changeset
   130
	$(call MakeDir, $(DTRACE_SUPPORT_DIR))
55017
5dc15cb1405c 8224677: Dtrace .d files clash with make dependency .d files
erikj
parents: 53683
diff changeset
   131
	$(call ExecuteWithLog, $(DTRACE_SUPPORT_DIR)/$(@F).dt, \
49553
58cffb6ec13c 8201236: Straighten out dtrace build logic
ihse
parents: 49241
diff changeset
   132
	    ($(CPP) $(DTRACE_CPP_FLAGS) -I$(DTRACE_GENSRC_DIR) $^ \
55017
5dc15cb1405c 8224677: Dtrace .d files clash with make dependency .d files
erikj
parents: 53683
diff changeset
   133
	    > $(DTRACE_SUPPORT_DIR)/$(@F).dt))
49124
6abbc1f5c2a1 8198862: Stop doing funky compilation stuff for dtrace
ihse
parents: 49078
diff changeset
   134
	$(call ExecuteWithLog, $@, $(DTRACE) $(DTRACE_FLAGS) -o $@ \
55017
5dc15cb1405c 8224677: Dtrace .d files clash with make dependency .d files
erikj
parents: 53683
diff changeset
   135
	    -s $(DTRACE_SUPPORT_DIR)/$(@F).dt)
53683
48ff68e2fe5c 8218431: Improved platform checking in makefiles
ihse
parents: 52876
diff changeset
   136
        ifeq ($(call isTargetCpuArch, sparc), true)
49157
2478f56cf409 8199339: JDK-8198859 broke solaris x64
erikj
parents: 49124
diff changeset
   137
	  $(call ExecuteWithLog, $@.elfedit, $(ELFEDIT) $(call GetElfeditCommands) $@)
2478f56cf409 8199339: JDK-8198859 broke solaris x64
erikj
parents: 49124
diff changeset
   138
        endif
37437
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   139
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   140
  endif
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   141
endif