make/hotspot/lib/CompileDtracePostJvm.gmk
author ihse
Thu, 01 Mar 2018 18:12:50 +0100
changeset 49078 039e63e471e1
parent 49070 d7859531621b
child 49124 6abbc1f5c2a1
child 56228 a20f3126f7c0
permissions -rw-r--r--
8198859: Use elfedit to silence linker warnings on solaris Reviewed-by: tbell
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
37437
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
     1
#
49070
d7859531621b 8198751: Refactor SetupNativeCompilation to take NAME and TYPE
ihse
parents: 47217
diff changeset
     2
# Copyright (c) 2013, 2018, 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
################################################################################
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    27
# Support for dtrace integration with libjvm, and stand-alone dtrace library
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    28
# compilation.
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    29
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    30
ifeq ($(call check-jvm-feature, dtrace), true)
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    31
  ##############################################################################
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    32
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    33
  ifeq ($(OPENJDK_TARGET_OS), solaris)
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    34
    ############################################################################
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    35
    # Integrate with libjvm. Here we generate three object files which are
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    36
    # linked with libjvm.so. This step is complicated from a dependency
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    37
    # perspective, since it needs the rest of the compiled object files from the
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    38
    # libjvm compilation, but the output is object files that are to be included
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    39
    # when linking libjvm.so. So this generation must happen as a part of the
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    40
    # libjvm compilation.
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    41
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    42
    # First we need to generate the dtraceGenOffsets tool. When run, this will
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    43
    # produce more header files and a C++ file.
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    44
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    45
    # Note that generateJvmOffsets.cpp must be compiled as if it were a file
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    46
    # in the libjvm.so, using JVM_CFLAGS as setup in CompileJvm.gmk. Otherwise
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    47
    # this would preferrably have been done as a part of GensrcDtrace.gmk.
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    48
    $(eval $(call SetupNativeCompilation, BUILD_DTRACE_GEN_OFFSETS, \
49070
d7859531621b 8198751: Refactor SetupNativeCompilation to take NAME and TYPE
ihse
parents: 47217
diff changeset
    49
        NAME := dtraceGenOffsets, \
d7859531621b 8198751: Refactor SetupNativeCompilation to take NAME and TYPE
ihse
parents: 47217
diff changeset
    50
        TYPE := EXECUTABLE, \
47217
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 47216
diff changeset
    51
        SRC := $(TOPDIR)/make/hotspot/src/native/dtrace, \
37437
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    52
        CC := $(BUILD_CXX), \
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    53
        CXX := $(BUILD_CXX), \
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    54
        LDEXE := $(BUILD_CXX), \
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    55
        generateJvmOffsets.cpp_CXXFLAGS := $(JVM_CFLAGS) -mt -xnolib -norunpath, \
46539
c23c825bcfc2 8181318: Allow C++ library headers on Solaris Studio
eosterlund
parents: 42885
diff changeset
    56
        generateJvmOffsetsMain.c_CFLAGS := -mt -m64 -norunpath -z nodefs, \
37437
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    57
        LDFLAGS := -m64, \
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    58
        LIBS := -lc, \
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    59
        OBJECT_DIR := $(JVM_VARIANT_OUTPUTDIR)/tools/dtrace-gen-offsets/objs, \
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    60
        OUTPUT_DIR := $(JVM_VARIANT_OUTPUTDIR)/tools/dtrace-gen-offsets, \
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    61
    ))
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    62
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    63
    DTRACE_GEN_OFFSETS_TOOL := $(BUILD_DTRACE_GEN_OFFSETS_TARGET)
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    64
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    65
    # Argument 1: Output filename
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    66
    # Argument 2: dtrace-gen-offset tool command line option
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    67
    define SetupDtraceOffsetsGeneration
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    68
      $1: $$(BUILD_DTRACE_GEN_OFFSETS)
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    69
	$$(call LogInfo, Generating dtrace $2 file $$(@F))
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    70
	$$(call MakeDir, $$(@D))
39622
ea5433c14f21 8158629: bash >(...) construct still causes race conditions
erikj
parents: 38097
diff changeset
    71
	$$(call ExecuteWithLog, $$@, ( $$(DTRACE_GEN_OFFSETS_TOOL) -$$(strip $2) > $$@ ) )
37437
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    72
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    73
      TARGETS += $1
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    74
    endef
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    75
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    76
    JVM_OFFSETS_H := $(DTRACE_SUPPORT_DIR)/JvmOffsets.h
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    77
    JVM_OFFSETS_CPP := $(DTRACE_SUPPORT_DIR)/JvmOffsets.cpp
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    78
    JVM_OFFSETS_INDEX_H := $(DTRACE_SUPPORT_DIR)/JvmOffsetsIndex.h
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    79
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    80
    # Run the dtrace-gen-offset tool to generate these three files.
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    81
    $(eval $(call SetupDtraceOffsetsGeneration, $(JVM_OFFSETS_H), header))
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    82
    $(eval $(call SetupDtraceOffsetsGeneration, $(JVM_OFFSETS_INDEX_H), index))
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    83
    $(eval $(call SetupDtraceOffsetsGeneration, $(JVM_OFFSETS_CPP), table))
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    84
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    85
    ############################################################################
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    86
    # Compile JVM_OFFSETS_OBJ which is linked with libjvm.so.
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    87
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    88
    # JvmOffsets.cpp is compiled without the common JVM_CFLAGS. Otherwise, the
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    89
    # natural way would have been to included this source code in BUILD_LIBJVM.
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    90
    JVM_OFFSETS_CFLAGS := -m64
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    91
    ifeq ($(OPENJDK_TARGET_CPU), sparcv9)
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    92
      JVM_OFFSETS_CFLAGS += -xarch=sparc
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    93
    endif
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    94
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    95
    $(JVM_OFFSETS_OBJ): $(JVM_OFFSETS_CPP) $(JVM_OFFSETS_H)
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    96
	$(call LogInfo, Compiling dtrace file JvmOffsets.cpp (for libjvm.so))
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    97
	$(call ExecuteWithLog, $@, $(CXX) -c -I$(<D) -o $@ $(JVM_OFFSETS_CFLAGS) $<)
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    98
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
    99
    ############################################################################
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   100
    # Generate DTRACE_OBJ which is linked with libjvm.so.
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   101
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   102
    # Concatenate all *.d files into a single file
47217
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 47216
diff changeset
   103
    DTRACE_SOURCE_FILES := $(addprefix $(TOPDIR)/src/hotspot/os/posix/dtrace/, \
37437
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   104
        hotspot_jni.d \
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   105
        hotspot.d \
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   106
        hs_private.d \
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   107
    )
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   108
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   109
    $(JVM_OUTPUTDIR)/objs/dtrace.d: $(DTRACE_SOURCE_FILES)
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   110
	$(call LogInfo, Generating $(@F))
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   111
	$(call MakeDir, $(@D))
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   112
	$(CAT) $^ > $@
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   113
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   114
    DTRACE_INSTRUMENTED_OBJS := $(addprefix $(JVM_OUTPUTDIR)/objs/, \
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   115
        ciEnv.o \
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   116
        classLoadingService.o \
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   117
        compileBroker.o \
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   118
        hashtable.o \
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   119
        instanceKlass.o \
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   120
        java.o \
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   121
        jni.o \
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   122
        jvm.o \
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   123
        memoryManager.o \
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   124
        nmethod.o \
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   125
        objectMonitor.o \
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   126
        runtimeService.o \
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   127
        sharedRuntime.o \
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   128
        synchronizer.o \
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   129
        thread.o \
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   130
        unsafe.o \
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   131
        vmThread.o \
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   132
        vmGCOperations.o \
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   133
    )
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   134
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   135
    ifeq ($(call check-jvm-feature, all-gcs), true)
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   136
      DTRACE_INSTRUMENTED_OBJS += $(addprefix $(JVM_OUTPUTDIR)/objs/, \
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   137
          vmCMSOperations.o \
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   138
          vmPSOperations.o \
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
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   142
    DTRACE_FLAGS := -64 -G
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   143
    DTRACE_CPP_FLAGS := -D_LP64
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   144
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   145
    # Make sure we run our selected compiler for preprocessing instead of letting
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   146
    # the dtrace tool pick it on it's own.
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   147
    $(DTRACE_OBJ): $(JVM_OUTPUTDIR)/objs/dtrace.d $(DTRACE_INSTRUMENTED_OBJS)
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   148
	$(call LogInfo, Generating $(@F) from $(<F) and object files)
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   149
	$(call MakeDir, $(DTRACE_SUPPORT_DIR))
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   150
	$(call ExecuteWithLog, $(DTRACE_SUPPORT_DIR)/$(@F).d, $(CC) -E \
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   151
	    $(DTRACE_CPP_FLAGS) $< > $(DTRACE_SUPPORT_DIR)/$(@F).d)
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   152
	$(call ExecuteWithLog, $@, $(DTRACE) $(DTRACE_FLAGS) -xlazyload -o $@ \
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   153
	    -s $(DTRACE_SUPPORT_DIR)/$(@F).d $(sort $(DTRACE_INSTRUMENTED_OBJS)))
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   154
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   155
    ############################################################################
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   156
    # Generate DTRACE_JHELPER_OBJ which is linked with libjvm.so.
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   157
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   158
    # Unfortunately dtrace generates incorrect types for some symbols in
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   159
    # 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
   160
    # See JDK-6890703 for details.
039e63e471e1 8198859: Use elfedit to silence linker warnings on solaris
ihse
parents: 49070
diff changeset
   161
    # 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
   162
    # after dtrace has generated the .o file.
039e63e471e1 8198859: Use elfedit to silence linker warnings on solaris
ihse
parents: 49070
diff changeset
   163
    JHELPER_DTRACE_SRC := $(TOPDIR)/src/hotspot/os/solaris/dtrace/jhelper.d
039e63e471e1 8198859: Use elfedit to silence linker warnings on solaris
ihse
parents: 49070
diff changeset
   164
    DTRACE_EXTERNAL_SYMBOLS := $(shell $(GREP) ^extern $(JHELPER_DTRACE_SRC) | $(AWK) '{ gsub(";","") ; print $$3 }')
039e63e471e1 8198859: Use elfedit to silence linker warnings on solaris
ihse
parents: 49070
diff changeset
   165
    DTRACE_ELFEDIT_COMMANDS := $(foreach symbol, $(DTRACE_EXTERNAL_SYMBOLS), \
039e63e471e1 8198859: Use elfedit to silence linker warnings on solaris
ihse
parents: 49070
diff changeset
   166
      -e 'sym:st_type $(symbol) 1')
039e63e471e1 8198859: Use elfedit to silence linker warnings on solaris
ihse
parents: 49070
diff changeset
   167
039e63e471e1 8198859: Use elfedit to silence linker warnings on solaris
ihse
parents: 49070
diff changeset
   168
    $(DTRACE_JHELPER_OBJ): $(JHELPER_DTRACE_SRC) $(JVM_OFFSETS_INDEX_H)
37437
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   169
	$(call LogInfo, Running dtrace for $(<F))
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   170
	$(call ExecuteWithLog, $@, $(DTRACE) $(DTRACE_FLAGS) $(DTRACE_CPP_FLAGS) -C \
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   171
	    -I$(DTRACE_SUPPORT_DIR) -o $@ -s $<)
49078
039e63e471e1 8198859: Use elfedit to silence linker warnings on solaris
ihse
parents: 49070
diff changeset
   172
	$(call ExecuteWithLog, $@.elfedit, $(ELFEDIT) $(DTRACE_ELFEDIT_COMMANDS) $@)
37437
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   173
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   174
    ############################################################################
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   175
    # Build the stand-alone dtrace libraries
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   176
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   177
    LIBJVM_DTRACE_OUTPUTDIR := $(JVM_VARIANT_OUTPUTDIR)/libjvm_dtrace
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   178
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   179
    $(eval $(call SetupNativeCompilation, BUILD_LIBJVM_DTRACE, \
49070
d7859531621b 8198751: Refactor SetupNativeCompilation to take NAME and TYPE
ihse
parents: 47217
diff changeset
   180
        NAME := jvm_dtrace, \
41277
65200988b2ee 8150736: Excessive disk space used by build system
erikj
parents: 39622
diff changeset
   181
        OUTPUT_DIR := $(JVM_LIB_OUTPUTDIR), \
47217
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 47216
diff changeset
   182
        SRC := $(TOPDIR)/src/java.base/solaris/native/libjvm_dtrace, \
37437
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   183
        CFLAGS := -m64 -G -mt -KPIC, \
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   184
        LDFLAGS := -m64 -mt -xnolib $(SHARED_LIBRARY_FLAGS), \
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   185
        LIBS := $(LIBDL) -lc -lthread -ldoor, \
47217
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 47216
diff changeset
   186
        MAPFILE := $(TOPDIR)/make/mapfiles/libjvm_dtrace/mapfile-vers, \
37437
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   187
        OBJECT_DIR := $(LIBJVM_DTRACE_OUTPUTDIR)/objs, \
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   188
    ))
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   189
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   190
    LIBJVM_DB_OUTPUTDIR := $(JVM_VARIANT_OUTPUTDIR)/libjvm_db
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   191
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   192
    # Note that libjvm_db.c has tests for COMPILER2, but this was never set by
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   193
    # the old build.
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   194
    $(eval $(call SetupNativeCompilation, BUILD_LIBJVM_DB, \
49070
d7859531621b 8198751: Refactor SetupNativeCompilation to take NAME and TYPE
ihse
parents: 47217
diff changeset
   195
        NAME := jvm_db, \
41277
65200988b2ee 8150736: Excessive disk space used by build system
erikj
parents: 39622
diff changeset
   196
        OUTPUT_DIR := $(JVM_LIB_OUTPUTDIR), \
47217
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 47216
diff changeset
   197
        SRC := $(TOPDIR)/src/java.base/solaris/native/libjvm_db, \
37437
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   198
        CFLAGS := -I$(JVM_VARIANT_OUTPUTDIR)/gensrc -I$(DTRACE_SUPPORT_DIR) \
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   199
            -m64 -G -mt -KPIC, \
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   200
        LDFLAGS := -m64 -mt -xnolib $(SHARED_LIBRARY_FLAGS), \
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   201
        LIBS := -lc, \
47217
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 47216
diff changeset
   202
        MAPFILE := $(TOPDIR)/make/mapfiles/libjvm_db/mapfile-vers, \
37437
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   203
        OBJECT_DIR := $(LIBJVM_DB_OUTPUTDIR)/objs, \
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   204
    ))
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   205
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   206
    # We need the generated JvmOffsets.h before we can compile the libjvm_db source code.
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   207
    $(BUILD_LIBJVM_DB_ALL_OBJS): $(JVM_OFFSETS_H)
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   208
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   209
    TARGETS += $(BUILD_LIBJVM_DTRACE) $(BUILD_LIBJVM_DB)
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   210
  endif
f824aabc7af8 8152666: The new Hotspot Build System
erikj
parents:
diff changeset
   211
endif