8329672: Only call SetupNativeCompilation from SetupJdkNativeCompilation

Reviewed-by: erikj
This commit is contained in:
Magnus Ihse Bursie 2024-04-05 08:37:41 +00:00
Родитель 8bc1867da7
Коммит 3f4b167c97
15 изменённых файлов: 97 добавлений и 63 удалений

Просмотреть файл

@ -1,5 +1,5 @@
#
# Copyright (c) 2011, 2023, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 2024, 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
@ -32,7 +32,6 @@ default: all
include $(SPEC)
include MakeBase.gmk
include JavaCompilation.gmk
include NativeCompilation.gmk
include TextFileProcessing.gmk
include ZipArchive.gmk

Просмотреть файл

@ -136,6 +136,10 @@ ifeq ($(HSDIS_BACKEND), binutils)
endif
endif
################################################################################
## Build libhsdis
################################################################################
$(eval $(call SetupJdkLibrary, BUILD_HSDIS, \
NAME := hsdis, \
LINK_TYPE := $(HSDIS_LINK_TYPE), \

Просмотреть файл

@ -1,5 +1,5 @@
#
# Copyright (c) 2012, 2022, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2012, 2024, 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
@ -30,7 +30,7 @@ default: all
include $(SPEC)
include MakeBase.gmk
include Execute.gmk
include NativeCompilation.gmk
include JdkNativeCompilation.gmk
include ToolsJdk.gmk
################################################################################
@ -47,14 +47,14 @@ ifeq ($(COMPILE_TYPE), cross)
$(error It is not possible to update the x11wrappers when cross-compiling)
endif
BITS := $(OPENJDK_TARGET_CPU_BITS)
X11WRAPPERS_OUTPUT := $(SUPPORT_OUTPUTDIR)/x11wrappers
GENERATOR_SOURCE_FILE := $(X11WRAPPERS_OUTPUT)/src/data_generator.c
GENSRC_X11WRAPPERS_DATADIR := $(TOPDIR)/src/java.desktop/unix/data/x11wrappergen
WRAPPER_OUTPUT_FILE := $(GENSRC_X11WRAPPERS_DATADIR)/sizes-$(BITS).txt
BITS := $(OPENJDK_TARGET_CPU_BITS)
# Generate the C code for the program that will output the offset file.
$(eval $(call SetupExecute, gensrc_generator, \
INFO := Generating X11 wrapper data generator source code, \
@ -76,14 +76,17 @@ DATA_GENERATOR_INCLUDES := \
-I$(TOPDIR)/src/java.desktop/share/native/libawt/awt/image/cvutils \
#
################################################################################
## Build data_generator
################################################################################
# Compile the generated C code into an executable.
$(eval $(call SetupNativeCompilation, BUILD_DATA_GENERATOR, \
PROGRAM := data_generator, \
OUTPUT_DIR := $(X11WRAPPERS_OUTPUT)/bin, \
$(eval $(call SetupJdkExecutable, BUILD_DATA_GENERATOR, \
NAME := data_generator, \
EXTRA_FILES := $(GENERATOR_SOURCE_FILE), \
CFLAGS := $(X_CFLAGS) $(DATA_GENERATOR_INCLUDES) $(CFLAGS_JDKEXE), \
LDFLAGS := $(LDFLAGS_JDKEXE), \
CFLAGS := $(X_CFLAGS) $(DATA_GENERATOR_INCLUDES), \
LIBS := $(X_LIBS), \
OUTPUT_DIR := $(X11WRAPPERS_OUTPUT)/bin, \
OBJECT_DIR := $(X11WRAPPERS_OUTPUT)/objs, \
))
@ -92,6 +95,7 @@ $(eval $(call SetupExecute, run_wrappergen, \
INFO := Generating X11 wrapper data files, \
DEPS := $(BUILD_DATA_GENERATOR), \
OUTPUT_FILE := $(WRAPPER_OUTPUT_FILE), \
SUPPORT_DIR := $(X11WRAPPERS_OUTPUT)/run-wrapper, \
COMMAND := $(BUILD_DATA_GENERATOR_TARGET) | $(SORT) > $(WRAPPER_OUTPUT_FILE), \
))

Просмотреть файл

@ -122,13 +122,17 @@ JDK_RCFLAGS=$(RCFLAGS) \
# JDK_LIBS -- libraries generated by the JDK build system to link against
# JDK_LIBS_<os> or JDK_LIBS_<osType> -- additional JDK_LIBS for the given OS
# or OS type only
# DEFAULT_LIBCXX -- if false, do not add LIBCXX to LIBS for C++ compilations
# DEFAULT_CFLAGS -- if false, do not add default CFLAGS and CXXFLAGS
# DEFAULT_LDFLAGS -- if false, do not add default LDFLAGS
# CFLAGS_FILTER_OUT -- flags to filter out from default CFLAGS
# CXXFLAGS_FILTER_OUT -- flags to filter out from default CXXFLAGS
# LDFLAGS_FILTER_OUT -- flags to filter out from default LDFLAGS
# LD_SET_ORIGIN -- if false, do not add SET_*_ORIGIN flags to LDFLAGS
# APPEND_LDFLAGS -- a quirk to have additional LDFLAGS that will be set after
# the origin flags
# DEFAULT_VERSIONINFO_RESOURCE -- if false, do not set the default
# VERSIONINFO_RESOURCE
#
SetupJdkNativeCompilation = $(NamedParamsMacroTemplate)
define SetupJdkNativeCompilationBody
@ -164,15 +168,19 @@ define SetupJdkNativeCompilationBody
endif
endif
ifeq ($$($1_LINK_TYPE), C++)
$1_LIBS += $(LIBCXX)
ifneq ($$($1_DEFAULT_LIBCXX), false)
ifeq ($$($1_LINK_TYPE), C++)
$1_LIBS += $(LIBCXX)
endif
endif
ifeq ($$($1_SRC), )
ifneq ($$(MODULE), )
$1_SRC := $$(call FindSrcDirsForComponent, $$(MODULE), $$($1_NATIVE_DIR_PREFIX)$$($1_NAME))
else
$$(error Must specify SRC in a MODULE free context)
ifeq ($$($1_EXTRA_FILES), )
$$(error Must specify SRC or EXTRA_FILES in a MODULE free context)
endif
endif
else
$1_SRC := $$(foreach dir, $$($1_SRC), $$(call ProcessDir, $$(dir)))
@ -188,8 +196,10 @@ define SetupJdkNativeCompilationBody
$1_SRC := $$(filter-out $$($1_EXCLUDE_SRC), $$($1_SRC))
endif
ifeq ($$($1_VERSIONINFO_RESOURCE), )
$1_VERSIONINFO_RESOURCE := $$(GLOBAL_VERSION_INFO_RESOURCE)
ifneq ($$($1_DEFAULT_VERSIONINFO_RESOURCE), false)
ifeq ($$($1_VERSIONINFO_RESOURCE), )
$1_VERSIONINFO_RESOURCE := $$(GLOBAL_VERSION_INFO_RESOURCE)
endif
endif
ifeq ($$($1_RC_FILEDESC), )
@ -208,7 +218,9 @@ define SetupJdkNativeCompilationBody
endif
# Add the module specific java header dir
$1_SRC_HEADER_FLAGS += $$(addprefix -I, $$(call GetJavaHeaderDir, $$(MODULE)))
ifneq ($$(MODULE), )
$1_SRC_HEADER_FLAGS += $$(addprefix -I, $$(call GetJavaHeaderDir, $$(MODULE)))
endif
$1_JDK_LIBS += $$($1_JDK_LIBS_$$(OPENJDK_TARGET_OS))
$1_JDK_LIBS += $$($1_JDK_LIBS_$$(OPENJDK_TARGET_OS_TYPE))

Просмотреть файл

@ -31,7 +31,7 @@ ifeq (,$(_MAKEBASE_GMK))
endif
include NativeCompilation.gmk
include JdkNativeCompilation.gmk
# Setup make rules for creating a set of native test files (libraries or
# executables). This will locate native files matching a certain pattern,
@ -56,27 +56,20 @@ define SetupTestFilesCompilationBody
$$(error There are duplicate test file names for $1: $$($1_DUPLICATED_NAMES))
endif
# Always include common test functionality
TEST_CFLAGS := -I$(TOPDIR)/test/lib/native
# The list to depend on starts out empty
$1 :=
ifeq ($$($1_TYPE), LIBRARY)
$1_PREFIX = lib
$1_OUTPUT_SUBDIR := lib
$1_BASE_CFLAGS := $(CFLAGS_JDKLIB) $$(TEST_CFLAGS)
$1_BASE_CXXFLAGS := $(CXXFLAGS_JDKLIB) $$(TEST_CFLAGS)
$1_LDFLAGS := $(LDFLAGS_JDKLIB) $$(call SET_SHARED_LIBRARY_ORIGIN)
$1_COMPILATION_TYPE := LIBRARY
$1_LOG_TYPE := library
else ifeq ($$($1_TYPE), PROGRAM)
$1_PREFIX = exe
$1_OUTPUT_SUBDIR := bin
$1_BASE_CFLAGS := $(CFLAGS_JDKEXE) $$(TEST_CFLAGS)
$1_BASE_CXXFLAGS := $(CXXFLAGS_JDKEXE) $$(TEST_CFLAGS)
$1_LDFLAGS := $(LDFLAGS_JDKEXE) $(LDFLAGS_TESTEXE)
$1_COMPILATION_TYPE := EXECUTABLE
$1_LOG_TYPE := executable
$1_LD_SET_ORIGIN := false
$1_LDFLAGS := $(LDFLAGS_TESTEXE)
else
$$(error Unknown type: $$($1_TYPE))
endif
@ -99,24 +92,30 @@ define SetupTestFilesCompilationBody
$1_COPY_DEBUG_SYMBOLS := true
endif
# Always include common test functionality
TEST_CFLAGS := -I$(TOPDIR)/test/lib/native
# Setup a compilation for each and every one of them
$$(foreach file, $$($1_FILTERED_FILE_LIST),\
$$(eval name := $$(strip $$(basename $$(notdir $$(file))))) \
$$(eval unprefixed_name := $$(patsubst $$($1_PREFIX)%, %, $$(name))) \
$$(eval $$(call SetupNativeCompilation, BUILD_TEST_$$(name), \
$$(eval $$(call SetupJdkNativeCompilation, BUILD_TEST_$$(name), \
NAME := $$(unprefixed_name), \
TYPE := $$($1_COMPILATION_TYPE), \
LINK_TYPE := $(if $$(filter %.cpp, $$(file)), C++, C), \
EXTRA_FILES := $$(file) $$($1_EXTRA_FILES), \
OBJECT_DIR := $$($1_OUTPUT_DIR)/support/$$(name), \
OUTPUT_DIR := $$($1_OUTPUT_DIR)/$$($1_OUTPUT_SUBDIR), \
CFLAGS := $$($1_BASE_CFLAGS) $$($1_CFLAGS) $$($1_CFLAGS_$$(name)), \
CXXFLAGS := $$($1_BASE_CXXFLAGS) $$($1_CFLAGS) $$($1_CFLAGS_$$(name)), \
CFLAGS := $$(TEST_CFLAGS) $$($1_CFLAGS) $$($1_CFLAGS_$$(name)), \
CXXFLAGS := $$(TEST_CFLAGS) $$($1_CFLAGS) $$($1_CFLAGS_$$(name)), \
LD_SET_ORIGIN := $$($1_LD_SET_ORIGIN), \
LDFLAGS := $$($1_LDFLAGS) $$($1_LDFLAGS_$$(name)), \
DISABLED_WARNINGS_gcc := format undef unused-function unused-value, \
DISABLED_WARNINGS_clang := undef format-nonliteral \
missing-field-initializers sometimes-uninitialized, \
DEFAULT_LIBCXX := false, \
LIBS := $$($1_LIBS_$$(name)), \
DEFAULT_VERSIONINFO_RESOURCE := false, \
OPTIMIZATION := $$(if $$($1_OPTIMIZATION_$$(name)),$$($1_OPTIMIZATION_$$(name)),LOW), \
COPY_DEBUG_SYMBOLS := $$($1_COPY_DEBUG_SYMBOLS), \
STRIP_SYMBOLS := $$(if $$($1_STRIP_SYMBOLS_$$(name)),$$($1_STRIP_SYMBOLS_$$(name)),false), \
@ -129,7 +128,7 @@ define SetupTestFilesCompilationBody
# Setup rule for printing a summary of all the tests being compiled. On Warn
# log level, this replaces the individual build info logging done by
# SetupNativeCompilation.
# SetupJdkNativeCompilation.
$$($1_BUILD_INFO): $$($1_BUILD_INFO_DEPS)
$$(call LogWarn, $$(strip Creating $$(words $$(filter-out %.vardeps, $$?)) \
test $$($1_LOG_TYPE) file(s) for $1))

Просмотреть файл

@ -134,6 +134,10 @@ define SetupBuildLauncherBody
$1_EXTRA_FILES += $(TOPDIR)/make/data/lsan/lsan_default_options.c
endif
##############################################################################
## Build launcher "$1"
##############################################################################
$$(eval $$(call SetupJdkExecutable, BUILD_LAUNCHER_$1, \
NAME := $1, \
EXTRA_FILES := $$($1_EXTRA_FILES), \

Просмотреть файл

@ -1,5 +1,5 @@
#
# Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2013, 2024, 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
@ -29,7 +29,7 @@ include $(SPEC)
include MakeBase.gmk
include Execute.gmk
include JavaCompilation.gmk
include NativeCompilation.gmk
include JdkNativeCompilation.gmk
include TextFileProcessing.gmk
include HotspotCommon.gmk

Просмотреть файл

@ -68,16 +68,22 @@ ifeq ($(call check-jvm-feature, compiler2), true)
ADLC_LDFLAGS += $(UBSAN_LDFLAGS)
endif
$(eval $(call SetupNativeCompilation, BUILD_ADLC, \
##############################################################################
## Build adlc
##############################################################################
$(eval $(call SetupJdkExecutable, BUILD_ADLC, \
NAME := adlc, \
TYPE := EXECUTABLE, \
TARGET_TYPE := BUILD, \
LINK_TYPE := C++, \
SRC := $(TOPDIR)/src/hotspot/share/adlc, \
EXTRA_FILES := $(TOPDIR)/src/hotspot/share/opto/opcodes.cpp, \
DEFAULT_CFLAGS := false, \
CFLAGS := $(ADLC_CFLAGS) $(ADLC_CFLAGS_WARNINGS), \
DEFAULT_LDFLAGS := false, \
LDFLAGS := $(ADLC_LDFLAGS), \
LIBS := $(ADLC_LIBS), \
DEFAULT_VERSIONINFO_RESOURCE := false, \
OBJECT_DIR := $(JVM_VARIANT_OUTPUTDIR)/tools/adlc/objs, \
OUTPUT_DIR := $(JVM_VARIANT_OUTPUTDIR)/tools/adlc, \
DEBUG_SYMBOLS := false, \

Просмотреть файл

@ -44,7 +44,8 @@ else
endif
################################################################################
## Build libgtest
################################################################################
$(eval $(call SetupJdkLibrary, BUILD_GTEST_LIBGTEST, \
NAME := gtest, \
@ -75,8 +76,10 @@ $(eval $(call SetupJdkLibrary, BUILD_GTEST_LIBGTEST, \
TARGETS += $(BUILD_GTEST_LIBGTEST)
################################################################################
# Additional disabled warnings are due to code in the test source.
## Build libjvm (for gtest)
################################################################################
# Additional disabled warnings are due to code in the test source.
$(eval $(call SetupJdkLibrary, BUILD_GTEST_LIBJVM, \
NAME := jvm, \
LINK_TYPE := C++, \
@ -128,6 +131,8 @@ endif
TARGETS += $(BUILD_GTEST_LIBJVM)
################################################################################
## Build gtestLauncher
################################################################################
$(eval $(call SetupJdkExecutable, BUILD_GTEST_LAUNCHER, \

Просмотреть файл

@ -128,7 +128,7 @@ endif
JVM_OPTIMIZATION ?= HIGHEST_JVM
# Need to set JVM_STRIPFLAGS to the default value from SPEC since the STRIPFLAGS
# parameter to SetupNativeCompilation allows an empty value to override the
# parameter to SetupJdkLibrary allows an empty value to override the
# default.
JVM_STRIPFLAGS ?= $(STRIPFLAGS)
@ -159,7 +159,8 @@ ifeq ($(call isTargetOs, linux), true)
endif
################################################################################
# Now set up the actual compilation of the main hotspot native library
## Build libjvm
################################################################################
$(eval $(call SetupJdkLibrary, BUILD_LIBJVM, \
NAME := jvm, \

Просмотреть файл

@ -1,5 +1,5 @@
#
# Copyright (c) 2013, 2023, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2013, 2024, 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
@ -73,7 +73,7 @@ ifeq ($(call isTargetOs, linux), true)
NONPIC_SRC := $(filter $(NONPIC_FILTER), $(ALL_SRC)) globals.cpp location.cpp
# Declare variables for each source file that needs the pic flag like this:
# BUILD_JVM_<srcfile>_CXXFLAGS := -fno-PIC
# This will get implicitly picked up by SetupNativeCompilation below.
# This will get implicitly picked up by SetupJdkLibrary below.
$(foreach s, $(NONPIC_SRC), $(eval BUILD_LIBJVM_$(notdir $s)_CXXFLAGS := -fno-PIC))
endif

Просмотреть файл

@ -99,21 +99,21 @@ ifeq ($(call isTargetOs, macosx), true)
## Build libosxsecurity
##############################################################################
$(eval $(call SetupJdkLibrary, BUILD_LIBOSXSECURITY, \
NAME := osxsecurity, \
OPTIMIZATION := LOW, \
DISABLED_WARNINGS_clang_KeystoreImpl.m := deprecated-declarations, \
LDFLAGS := -L$(SUPPORT_OUTPUTDIR)/modules_libs/java.base,\
JDK_LIBS := $(JDKLIB_LIBS), \
LIBS_macosx := -lobjc \
-framework CoreServices \
-framework Foundation \
-framework Security, \
))
$(eval $(call SetupJdkLibrary, BUILD_LIBOSXSECURITY, \
NAME := osxsecurity, \
OPTIMIZATION := LOW, \
DISABLED_WARNINGS_clang_KeystoreImpl.m := deprecated-declarations, \
LDFLAGS := -L$(SUPPORT_OUTPUTDIR)/modules_libs/java.base,\
JDK_LIBS := $(JDKLIB_LIBS), \
LIBS_macosx := -lobjc \
-framework CoreServices \
-framework Foundation \
-framework Security, \
))
$(BUILD_LIBOSXSECURITY): $(BUILD_LIBJAVA)
$(BUILD_LIBOSXSECURITY): $(BUILD_LIBJAVA)
TARGETS += $(BUILD_LIBOSXSECURITY)
TARGETS += $(BUILD_LIBOSXSECURITY)
endif
ifeq ($(call isTargetOsType, unix)+$(STATIC_BUILD), true+false)

Просмотреть файл

@ -25,11 +25,11 @@
include LibCommon.gmk
################################################################################
## Build libsctp
################################################################################
ifeq ($(call isTargetOs, linux), true)
##############################################################################
## Build libsctp
##############################################################################
$(eval $(call SetupJdkLibrary, BUILD_LIBSCTP, \
NAME := sctp, \
OPTIMIZATION := LOW, \

Просмотреть файл

@ -1,5 +1,5 @@
#
# Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2016, 2024, 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
@ -28,7 +28,6 @@ default: build
include $(SPEC)
include MakeBase.gmk
include JavaCompilation.gmk
include NativeCompilation.gmk
TARGETS :=

Просмотреть файл

@ -140,9 +140,6 @@ BUILD_HOTSPOT_JTREG_LIBRARIES_OPTIMIZATION_libNoFramePointer := HIGH
JVMTI_COMMON_INCLUDES=-I$(TOPDIR)/test/lib/jdk/test/lib/jvmti
BUILD_HOTSPOT_JTREG_LIBRARIES_CFLAGS := -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS $(JVMTI_COMMON_INCLUDES)
BUILD_HOTSPOT_JTREG_EXECUTABLES_CFLAGS := -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS $(JVMTI_COMMON_INCLUDES)
BUILD_HOTSPOT_JTREG_LIBRARIES_CFLAGS_libProcessUtils := $(VM_SHARE_INCLUDES)
BUILD_HOTSPOT_JTREG_LIBRARIES_CFLAGS_libThreadController := $(NSK_MONITORING_INCLUDES)
@ -1527,6 +1524,10 @@ ifeq ($(LSAN_ENABLED), true)
BUILD_HOTSPOT_JTREG_EXTRA_FILES += $(TOPDIR)/make/data/lsan/lsan_default_options.c
endif
# These apply to all tests
BUILD_HOTSPOT_JTREG_LIBRARIES_CFLAGS := -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS $(JVMTI_COMMON_INCLUDES)
BUILD_HOTSPOT_JTREG_EXECUTABLES_CFLAGS := -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS $(JVMTI_COMMON_INCLUDES)
# This evaluation is expensive and should only be done if this target was
# explicitly called.
ifneq ($(filter build-test-hotspot-jtreg-native, $(MAKECMDGOALS)), )