From ac3ce2aa156332fc4e6f33018ff669657ab4b797 Mon Sep 17 00:00:00 2001 From: Magnus Ihse Bursie Date: Tue, 27 Feb 2024 11:14:11 +0000 Subject: [PATCH] 8326583: Remove over-generalized DefineNativeToolchain solution Reviewed-by: erikj --- make/Hsdis.gmk | 20 ++- make/common/NativeCompilation.gmk | 56 +++++++- make/common/TestFilesCompilation.gmk | 4 +- make/common/native/ToolchainDefinitions.gmk | 130 ------------------ make/hotspot/gensrc/GensrcAdlc.gmk | 3 +- make/hotspot/lib/CompileGtest.gmk | 6 +- make/hotspot/lib/CompileJvm.gmk | 2 +- make/modules/java.base/Lib.gmk | 4 +- make/modules/java.base/lib/CoreLibraries.gmk | 4 +- make/modules/java.desktop/Lib.gmk | 7 +- .../java.desktop/lib/Awt2dLibraries.gmk | 4 +- make/modules/jdk.hotspot.agent/Lib.gmk | 6 +- make/modules/jdk.internal.le/Lib.gmk | 4 +- make/modules/jdk.jpackage/Lib.gmk | 12 +- 14 files changed, 89 insertions(+), 173 deletions(-) delete mode 100644 make/common/native/ToolchainDefinitions.gmk diff --git a/make/Hsdis.gmk b/make/Hsdis.gmk index 42d18d61901..6de0e628a52 100644 --- a/make/Hsdis.gmk +++ b/make/Hsdis.gmk @@ -38,7 +38,7 @@ HSDIS_OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/hsdis REAL_HSDIS_NAME := hsdis-$(OPENJDK_TARGET_CPU_LEGACY_LIB)$(SHARED_LIBRARY_SUFFIX) BUILT_HSDIS_LIB := $(HSDIS_OUTPUT_DIR)/$(REAL_HSDIS_NAME) -HSDIS_TOOLCHAIN := TOOLCHAIN_DEFAULT +HSDIS_LINK_TYPE := C HSDIS_TOOLCHAIN_CFLAGS := $(CFLAGS_JDKLIB) HSDIS_TOOLCHAIN_LDFLAGS := $(LDFLAGS_JDKLIB) @@ -59,8 +59,8 @@ endif ifeq ($(HSDIS_BACKEND), llvm) # Use C++ instead of C + HSDIS_LINK_TYPE := C++ HSDIS_TOOLCHAIN_CFLAGS := $(CXXFLAGS_JDKLIB) - HSDIS_TOOLCHAIN := TOOLCHAIN_LINK_CXX ifeq ($(call isTargetOs, linux), true) LLVM_OS := pc-linux-gnu @@ -91,14 +91,11 @@ ifeq ($(HSDIS_BACKEND), binutils) endif endif - $(eval $(call DefineNativeToolchain, TOOLCHAIN_MINGW, \ - CC := $(MINGW_BASE)-gcc, \ - LD := $(MINGW_BASE)-ld, \ - OBJCOPY := $(MINGW_BASE)-objcopy, \ - RC := $(RC), \ - SYSROOT_CFLAGS := --sysroot=$(MINGW_SYSROOT), \ - SYSROOT_LDFLAGS := --sysroot=$(MINGW_SYSROOT), \ - )) + BUILD_HSDIS_CC := $(MINGW_BASE)-gcc + BUILD_HSDIS_LD := $(MINGW_BASE)-ld + BUILD_HSDIS_OBJCOPY := $(MINGW_BASE)-objcopy + BUILD_HSDIS_SYSROOT_CFLAGS := --sysroot=$(MINGW_SYSROOT) + BUILD_HSDIS_SYSROOT_LDFLAGS := --sysroot=$(MINGW_SYSROOT) MINGW_SYSROOT_LIB_PATH := $(MINGW_SYSROOT)/mingw/lib ifeq ($(wildcard $(MINGW_SYSROOT_LIB_PATH)), ) @@ -131,7 +128,6 @@ ifeq ($(HSDIS_BACKEND), binutils) CFLAGS_WARNINGS_ARE_ERRORS := -Werror SHARED_LIBRARY_FLAGS := -shared - HSDIS_TOOLCHAIN := TOOLCHAIN_MINGW HSDIS_TOOLCHAIN_CFLAGS := HSDIS_TOOLCHAIN_LDFLAGS := -L$(MINGW_GCC_LIB_PATH) -L$(MINGW_SYSROOT_LIB_PATH) MINGW_DLLCRT := $(MINGW_SYSROOT_LIB_PATH)/dllcrt2.o @@ -144,9 +140,9 @@ endif $(eval $(call SetupJdkLibrary, BUILD_HSDIS, \ NAME := hsdis, \ + LINK_TYPE := $(HSDIS_LINK_TYPE), \ SRC := $(TOPDIR)/src/utils/hsdis/$(HSDIS_BACKEND), \ EXTRA_HEADER_DIRS := $(TOPDIR)/src/utils/hsdis, \ - TOOLCHAIN := $(HSDIS_TOOLCHAIN), \ OUTPUT_DIR := $(HSDIS_OUTPUT_DIR), \ OBJECT_DIR := $(HSDIS_OUTPUT_DIR), \ DISABLED_WARNINGS_gcc := undef format-nonliteral sign-compare, \ diff --git a/make/common/NativeCompilation.gmk b/make/common/NativeCompilation.gmk index 2bb76ef025e..13b0318b4c7 100644 --- a/make/common/NativeCompilation.gmk +++ b/make/common/NativeCompilation.gmk @@ -42,7 +42,6 @@ include native/Flags.gmk include native/Link.gmk include native/LinkMicrosoft.gmk include native/Paths.gmk -include native/ToolchainDefinitions.gmk ################################################################################ # Setup make rules for creating a native binary (a shared library or an @@ -55,7 +54,8 @@ include native/ToolchainDefinitions.gmk # NAME The base name for the resulting binary, excluding decorations (like *.exe) # TYPE Type of binary (EXECUTABLE, LIBRARY or STATIC_LIBRARY). Default is LIBRARY. # SUFFIX Override the default suffix for the output file -# TOOLCHAIN Name of toolchain setup to use. Defaults to TOOLCHAIN_DEFAULT. +# TARGET_TYPE The type to target, BUILD or TARGET. Defaults to TARGET. +# LINK_TYPE The language to use for the linker, C or C++. Defaults to C. # SRC one or more directory roots to scan for C/C++ files. # CFLAGS the compiler flags to be used, used both for C and C++. # CXXFLAGS the compiler flags to be used for c++, if set overrides CFLAGS. @@ -89,8 +89,18 @@ include native/ToolchainDefinitions.gmk # VERSIONINFO_RESOURCE Input file for RC. Setting this implies that RC will be run # RCFLAGS flags for RC. # EMBED_MANIFEST if true, embed manifest on Windows. -# CC the compiler to use, default is $(CC) -# LD the linker to use, default is $(LD) +# CC the C compiler to use +# CXX the C++ compiler to use +# LD the Linker to use +# AR the static linker to use +# LIB the Windows lib tool to use for creating static libraries +# AS the assembler to use +# MT the Windows MT tool to use +# RC the Windows RC tool to use +# OBJCOPY the objcopy tool for debug symbol handling +# STRIP the tool to use for stripping debug symbols +# SYSROOT_CFLAGS the compiler flags for using the specific sysroot +# SYSROOT_LDFLAGS the linker flags for using the specific sysroot # OPTIMIZATION sets optimization level to NONE, LOW, HIGH, HIGHEST, HIGHEST_JVM, SIZE # DISABLED_WARNINGS_ Disable the given warnings for the specified toolchain # DISABLED_WARNINGS__ Disable the given warnings for the specified @@ -289,6 +299,44 @@ define SetupBasicVariables $1_SAFE_NAME := $$(strip $$(subst /,_, $1)) endef +################################################################################ +# Setup the toolchain variables +define SetupToolchain + ifeq ($$($1_TARGET_TYPE), BUILD) + $$(call SetIfEmpty, $1_CC, $(BUILD_CC)) + $$(call SetIfEmpty, $1_CXX, $(BUILD_CXX)) + $$(call SetIfEmpty, $1_AR, $(BUILD_AR)) + $$(call SetIfEmpty, $1_LIB, $(BUILD_LIB)) + $$(call SetIfEmpty, $1_AS, $(BUILD_AS)) + $$(call SetIfEmpty, $1_OBJCOPY, $(BUILD_OBJCOPY)) + $$(call SetIfEmpty, $1_STRIP, $(BUILD_STRIP)) + $$(call SetIfEmpty, $1_SYSROOT_CFLAGS, $(BUILD_SYSROOT_CFLAGS)) + $$(call SetIfEmpty, $1_SYSROOT_LDFLAGS, $(BUILD_SYSROOT_LDFLAGS)) + ifeq ($$($1_LINK_TYPE), C++) + $$(call SetIfEmpty, $1_LD, $(BUILD_LDCXX)) + else + $$(call SetIfEmpty, $1_LD, $(BUILD_LD)) + endif + else + $$(call SetIfEmpty, $1_CC, $(CC)) + $$(call SetIfEmpty, $1_CXX, $(CXX)) + $$(call SetIfEmpty, $1_AR, $(AR)) + $$(call SetIfEmpty, $1_LIB, $(LIB)) + $$(call SetIfEmpty, $1_AS, $(AS)) + $$(call SetIfEmpty, $1_MT, $(MT)) + $$(call SetIfEmpty, $1_RC, $(RC)) + $$(call SetIfEmpty, $1_OBJCOPY, $(OBJCOPY)) + $$(call SetIfEmpty, $1_STRIP, $(STRIP)) + $$(call SetIfEmpty, $1_SYSROOT_CFLAGS, $(SYSROOT_CFLAGS)) + $$(call SetIfEmpty, $1_SYSROOT_LDFLAGS, $(SYSROOT_LDFLAGS)) + ifeq ($$($1_LINK_TYPE), C++) + $$(call SetIfEmpty, $1_LD, $(LDCXX)) + else + $$(call SetIfEmpty, $1_LD, $(LD)) + endif + endif +endef + ################################################################################ # Setup machinery needed by the build system define SetupBuildSystemSupport diff --git a/make/common/TestFilesCompilation.gmk b/make/common/TestFilesCompilation.gmk index d97d0e6c697..626eb058f0a 100644 --- a/make/common/TestFilesCompilation.gmk +++ b/make/common/TestFilesCompilation.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2015, 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 @@ -103,6 +103,7 @@ define SetupTestFilesCompilationBody $$(eval $$(call SetupNativeCompilation, 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), \ @@ -113,7 +114,6 @@ define SetupTestFilesCompilationBody DISABLED_WARNINGS_clang := undef format-nonliteral \ missing-field-initializers sometimes-uninitialized, \ LIBS := $$($1_LIBS_$$(name)), \ - TOOLCHAIN := $(if $$(filter %.cpp, $$(file)), TOOLCHAIN_LINK_CXX, TOOLCHAIN_DEFAULT), \ 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), \ diff --git a/make/common/native/ToolchainDefinitions.gmk b/make/common/native/ToolchainDefinitions.gmk deleted file mode 100644 index cac3632a218..00000000000 --- a/make/common/native/ToolchainDefinitions.gmk +++ /dev/null @@ -1,130 +0,0 @@ -# -# 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 -# 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. -# - -################################################################################ -# This file contains functionality related to setting up our toolchain -# definition variables. - -################################################################################ -# Define a native toolchain configuration that can be used by -# SetupNativeCompilation calls -# -# Parameter 1 is the name of the toolchain definition -# -# Remaining parameters are named arguments: -# EXTENDS - Optional parent definition to get defaults from -# CC - The C compiler -# CXX - The C++ compiler -# LD - The Linker -# AR - Static linker -# LIB - lib, a Windows for creating static libraries -# AS - Assembler -# MT - Windows MT tool -# RC - Windows RC tool -# OBJCOPY - The objcopy tool for debug symbol handling -# STRIP - The tool to use for stripping debug symbols -# SYSROOT_CFLAGS - Compiler flags for using the specific sysroot -# SYSROOT_LDFLAGS - Linker flags for using the specific sysroot -DefineNativeToolchain = $(NamedParamsMacroTemplate) -define DefineNativeToolchainBody - # If extending another definition, get default values from that, - # otherwise, nothing more needs to be done as variable assignments - # already happened in NamedParamsMacroTemplate. - ifneq ($$($1_EXTENDS), ) - $$(call SetIfEmpty, $1_CC, $$($$($1_EXTENDS)_CC)) - $$(call SetIfEmpty, $1_CXX, $$($$($1_EXTENDS)_CXX)) - $$(call SetIfEmpty, $1_LD, $$($$($1_EXTENDS)_LD)) - $$(call SetIfEmpty, $1_AR, $$($$($1_EXTENDS)_AR)) - $$(call SetIfEmpty, $1_LIB, $$($$($1_EXTENDS)_LIB)) - $$(call SetIfEmpty, $1_AS, $$($$($1_EXTENDS)_AS)) - $$(call SetIfEmpty, $1_MT, $$($$($1_EXTENDS)_MT)) - $$(call SetIfEmpty, $1_RC, $$($$($1_EXTENDS)_RC)) - $$(call SetIfEmpty, $1_OBJCOPY, $$($$($1_EXTENDS)_OBJCOPY)) - $$(call SetIfEmpty, $1_STRIP, $$($$($1_EXTENDS)_STRIP)) - $$(call SetIfEmpty, $1_SYSROOT_CFLAGS, $$($$($1_EXTENDS)_SYSROOT_CFLAGS)) - $$(call SetIfEmpty, $1_SYSROOT_LDFLAGS, $$($$($1_EXTENDS)_SYSROOT_LDFLAGS)) - endif -endef - -# Create a default toolchain with the main compiler and linker -$(eval $(call DefineNativeToolchain, TOOLCHAIN_DEFAULT, \ - CC := $(CC), \ - CXX := $(CXX), \ - LD := $(LD), \ - AR := $(AR), \ - LIB := $(LIB), \ - AS := $(AS), \ - MT := $(MT), \ - RC := $(RC), \ - OBJCOPY := $(OBJCOPY), \ - STRIP := $(STRIP), \ - SYSROOT_CFLAGS := $(SYSROOT_CFLAGS), \ - SYSROOT_LDFLAGS := $(SYSROOT_LDFLAGS), \ -)) - -# Create a toolchain where linking is done with the C++ linker -$(eval $(call DefineNativeToolchain, TOOLCHAIN_LINK_CXX, \ - EXTENDS := TOOLCHAIN_DEFAULT, \ - LD := $(LDCXX), \ -)) - -# Create a toolchain with the BUILD compiler, used for build tools that -# are to be run during the build. -$(eval $(call DefineNativeToolchain, TOOLCHAIN_BUILD, \ - CC := $(BUILD_CC), \ - CXX := $(BUILD_CXX), \ - LD := $(BUILD_LD), \ - AR := $(BUILD_AR), \ - LIB := $(BUILD_LIB), \ - AS := $(BUILD_AS), \ - OBJCOPY := $(BUILD_OBJCOPY), \ - STRIP := $(BUILD_STRIP), \ - SYSROOT_CFLAGS := $(BUILD_SYSROOT_CFLAGS), \ - SYSROOT_LDFLAGS := $(BUILD_SYSROOT_LDFLAGS), \ -)) - -# BUILD toolchain with the C++ linker -$(eval $(call DefineNativeToolchain, TOOLCHAIN_BUILD_LINK_CXX, \ - EXTENDS := TOOLCHAIN_BUILD, \ - LD := $(BUILD_LDCXX), \ -)) - -################################################################################ -# Setup the toolchain to be used -define SetupToolchain - $$(call SetIfEmpty, $1_TOOLCHAIN, TOOLCHAIN_DEFAULT) - $$(call SetIfEmpty, $1_CC, $$($$($1_TOOLCHAIN)_CC)) - $$(call SetIfEmpty, $1_CXX, $$($$($1_TOOLCHAIN)_CXX)) - $$(call SetIfEmpty, $1_LD, $$($$($1_TOOLCHAIN)_LD)) - $$(call SetIfEmpty, $1_AR, $$($$($1_TOOLCHAIN)_AR)) - $$(call SetIfEmpty, $1_LIB, $$($$($1_TOOLCHAIN)_LIB)) - $$(call SetIfEmpty, $1_AS, $$($$($1_TOOLCHAIN)_AS)) - $$(call SetIfEmpty, $1_MT, $$($$($1_TOOLCHAIN)_MT)) - $$(call SetIfEmpty, $1_RC, $$($$($1_TOOLCHAIN)_RC)) - $$(call SetIfEmpty, $1_OBJCOPY, $$($$($1_TOOLCHAIN)_OBJCOPY)) - $$(call SetIfEmpty, $1_STRIP, $$($$($1_TOOLCHAIN)_STRIP)) - $$(call SetIfEmpty, $1_SYSROOT_CFLAGS, $$($$($1_TOOLCHAIN)_SYSROOT_CFLAGS)) - $$(call SetIfEmpty, $1_SYSROOT_LDFLAGS, $$($$($1_TOOLCHAIN)_SYSROOT_LDFLAGS)) -endef diff --git a/make/hotspot/gensrc/GensrcAdlc.gmk b/make/hotspot/gensrc/GensrcAdlc.gmk index 34a4002fc12..f9e09706141 100644 --- a/make/hotspot/gensrc/GensrcAdlc.gmk +++ b/make/hotspot/gensrc/GensrcAdlc.gmk @@ -71,7 +71,8 @@ ifeq ($(call check-jvm-feature, compiler2), true) $(eval $(call SetupNativeCompilation, BUILD_ADLC, \ NAME := adlc, \ TYPE := EXECUTABLE, \ - TOOLCHAIN := TOOLCHAIN_BUILD_LINK_CXX, \ + TARGET_TYPE := BUILD, \ + LINK_TYPE := C++, \ SRC := $(TOPDIR)/src/hotspot/share/adlc, \ EXTRA_FILES := $(TOPDIR)/src/hotspot/share/opto/opcodes.cpp, \ CFLAGS := $(ADLC_CFLAGS) $(ADLC_CFLAGS_WARNINGS), \ diff --git a/make/hotspot/lib/CompileGtest.gmk b/make/hotspot/lib/CompileGtest.gmk index 0af046b8555..a50d1ffac9e 100644 --- a/make/hotspot/lib/CompileGtest.gmk +++ b/make/hotspot/lib/CompileGtest.gmk @@ -50,7 +50,7 @@ endif $(eval $(call SetupJdkLibrary, BUILD_GTEST_LIBGTEST, \ NAME := gtest, \ TYPE := STATIC_LIBRARY, \ - TOOLCHAIN := TOOLCHAIN_LINK_CXX, \ + LINK_TYPE := C++, \ OUTPUT_DIR := $(JVM_OUTPUTDIR)/libgtest, \ OBJECT_DIR := $(JVM_OUTPUTDIR)/libgtest/objs, \ SRC := \ @@ -79,7 +79,7 @@ TARGETS += $(BUILD_GTEST_LIBGTEST) $(eval $(call SetupJdkLibrary, BUILD_GTEST_LIBJVM, \ NAME := jvm, \ - TOOLCHAIN := TOOLCHAIN_LINK_CXX, \ + LINK_TYPE := C++, \ OUTPUT_DIR := $(JVM_OUTPUTDIR)/gtest, \ OBJECT_DIR := $(JVM_OUTPUTDIR)/gtest/objs, \ SRC := $(GTEST_TEST_SRC), \ @@ -128,9 +128,9 @@ TARGETS += $(BUILD_GTEST_LIBJVM) ################################################################################ $(eval $(call SetupJdkExecutable, BUILD_GTEST_LAUNCHER, \ - TOOLCHAIN := TOOLCHAIN_LINK_CXX, \ NAME := gtestLauncher, \ TYPE := EXECUTABLE, \ + LINK_TYPE := C++, \ OUTPUT_DIR := $(JVM_OUTPUTDIR)/gtest, \ EXTRA_FILES := $(GTEST_LAUNCHER_SRC), \ OBJECT_DIR := $(JVM_OUTPUTDIR)/gtest/launcher-objs, \ diff --git a/make/hotspot/lib/CompileJvm.gmk b/make/hotspot/lib/CompileJvm.gmk index 4e21543c2c1..e9175efd4e9 100644 --- a/make/hotspot/lib/CompileJvm.gmk +++ b/make/hotspot/lib/CompileJvm.gmk @@ -162,7 +162,7 @@ endif $(eval $(call SetupJdkLibrary, BUILD_LIBJVM, \ NAME := jvm, \ - TOOLCHAIN := TOOLCHAIN_LINK_CXX, \ + LINK_TYPE := C++, \ OUTPUT_DIR := $(JVM_LIB_OUTPUTDIR), \ SRC := $(JVM_SRC_DIRS), \ EXCLUDES := $(JVM_EXCLUDES), \ diff --git a/make/modules/java.base/Lib.gmk b/make/modules/java.base/Lib.gmk index 924cb8aae26..54050d07986 100644 --- a/make/modules/java.base/Lib.gmk +++ b/make/modules/java.base/Lib.gmk @@ -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 @@ -242,7 +242,7 @@ endif ifeq ($(call isTargetOs, linux)+$(call isTargetCpu, x86_64)+$(INCLUDE_COMPILER2)+$(filter $(TOOLCHAIN_TYPE), gcc), true+true+true+gcc) $(eval $(call SetupJdkLibrary, BUILD_LIB_SIMD_SORT, \ NAME := simdsort, \ - TOOLCHAIN := TOOLCHAIN_LINK_CXX, \ + LINK_TYPE := C++, \ OPTIMIZATION := HIGH, \ CFLAGS := $(CFLAGS_JDKLIB), \ CXXFLAGS := $(CXXFLAGS_JDKLIB) -std=c++17, \ diff --git a/make/modules/java.base/lib/CoreLibraries.gmk b/make/modules/java.base/lib/CoreLibraries.gmk index 8904c39449e..b27013536f8 100644 --- a/make/modules/java.base/lib/CoreLibraries.gmk +++ b/make/modules/java.base/lib/CoreLibraries.gmk @@ -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 @@ -115,7 +115,7 @@ TARGETS += $(BUILD_LIBZIP) $(eval $(call SetupJdkLibrary, BUILD_LIBJIMAGE, \ NAME := jimage, \ - TOOLCHAIN := TOOLCHAIN_LINK_CXX, \ + LINK_TYPE := C++, \ OPTIMIZATION := LOW, \ CFLAGS := $(CFLAGS_JDKLIB), \ CXXFLAGS := $(CXXFLAGS_JDKLIB), \ diff --git a/make/modules/java.desktop/Lib.gmk b/make/modules/java.desktop/Lib.gmk index be1ac3f1fb8..cb831faebf6 100644 --- a/make/modules/java.desktop/Lib.gmk +++ b/make/modules/java.desktop/Lib.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2022, 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 @@ -51,13 +51,14 @@ ifeq ($(call isTargetOs, aix), false) -DUSE_PLATFORM_MIDI_IN=TRUE \ # + LIBJSOUND_LINK_TYPE := C ifeq ($(call isTargetOs, macosx), true) - LIBJSOUND_TOOLCHAIN := TOOLCHAIN_LINK_CXX + LIBJSOUND_LINK_TYPE := C++ endif $(eval $(call SetupJdkLibrary, BUILD_LIBJSOUND, \ NAME := jsound, \ - TOOLCHAIN := $(LIBJSOUND_TOOLCHAIN), \ + LINK_TYPE := $(LIBJSOUND_LINK_TYPE), \ OPTIMIZATION := LOW, \ CFLAGS := $(CFLAGS_JDKLIB) \ $(LIBJSOUND_CFLAGS), \ diff --git a/make/modules/java.desktop/lib/Awt2dLibraries.gmk b/make/modules/java.desktop/lib/Awt2dLibraries.gmk index 6fc9ed2fb2b..aaf98d088fd 100644 --- a/make/modules/java.desktop/lib/Awt2dLibraries.gmk +++ b/make/modules/java.desktop/lib/Awt2dLibraries.gmk @@ -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 @@ -562,9 +562,9 @@ LIBFONTMANAGER_CFLAGS += $(X_CFLAGS) -DLE_STANDALONE -DHEADLESS # libawt_xawt). See JDK-8196516 for details. $(eval $(call SetupJdkLibrary, BUILD_LIBFONTMANAGER, \ NAME := fontmanager, \ + LINK_TYPE := C++, \ EXCLUDE_FILES := $(LIBFONTMANAGER_EXCLUDE_FILES) \ AccelGlyphCache.c, \ - TOOLCHAIN := TOOLCHAIN_LINK_CXX, \ CFLAGS := $(CFLAGS_JDKLIB) $(LIBFONTMANAGER_CFLAGS), \ CXXFLAGS := $(CXXFLAGS_JDKLIB) $(LIBFONTMANAGER_CFLAGS), \ OPTIMIZATION := $(LIBFONTMANAGER_OPTIMIZATION), \ diff --git a/make/modules/jdk.hotspot.agent/Lib.gmk b/make/modules/jdk.hotspot.agent/Lib.gmk index ebdbfecd461..6d850615837 100644 --- a/make/modules/jdk.hotspot.agent/Lib.gmk +++ b/make/modules/jdk.hotspot.agent/Lib.gmk @@ -45,16 +45,16 @@ else ifeq ($(call isTargetOs, windows), true) endif endif -SA_TOOLCHAIN := $(TOOLCHAIN_DEFAULT) +SA_LINK_TYPE := C ifeq ($(call isTargetOs, linux), true) - SA_TOOLCHAIN := TOOLCHAIN_LINK_CXX + SA_LINK_TYPE := C++ endif ################################################################################ $(eval $(call SetupJdkLibrary, BUILD_LIBSA, \ NAME := saproc, \ - TOOLCHAIN := $(SA_TOOLCHAIN), \ + LINK_TYPE := $(SA_LINK_TYPE), \ OPTIMIZATION := HIGH, \ DISABLED_WARNINGS_gcc := sign-compare, \ DISABLED_WARNINGS_gcc_ps_core.c := pointer-arith, \ diff --git a/make/modules/jdk.internal.le/Lib.gmk b/make/modules/jdk.internal.le/Lib.gmk index 75a2446cc5a..85550e3cc1d 100644 --- a/make/modules/jdk.internal.le/Lib.gmk +++ b/make/modules/jdk.internal.le/Lib.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2015, 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 @@ -31,7 +31,7 @@ ifeq ($(call isTargetOs, linux macosx windows), true) $(eval $(call SetupJdkLibrary, BUILD_LIBLE, \ NAME := le, \ - TOOLCHAIN := TOOLCHAIN_LINK_CXX, \ + LINK_TYPE := C++, \ OPTIMIZATION := LOW, \ CFLAGS := $(CXXFLAGS_JDKLIB), \ LDFLAGS := $(LDFLAGS_JDKLIB), \ diff --git a/make/modules/jdk.jpackage/Lib.gmk b/make/modules/jdk.jpackage/Lib.gmk index 1d3e27e8a6b..58e40d772e1 100644 --- a/make/modules/jdk.jpackage/Lib.gmk +++ b/make/modules/jdk.jpackage/Lib.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2018, 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,13 +32,13 @@ include LauncherCommon.gmk ifeq ($(call isTargetOs, linux), true) JPACKAGE_APPLAUNCHER_SRC := \ $(call FindSrcDirsForComponent, jdk.jpackage, applauncher) - JPACKAGE_APPLAUNCHER_TOOLCHAIN := TOOLCHAIN_DEFAULT + JPACKAGE_APPLAUNCHER_LINK_TYPE := C JPACKAGE_APPLAUNCHER_INCLUDE_FILES := %.c else JPACKAGE_APPLAUNCHER_SRC := \ $(call FindSrcDirsForComponent, jdk.jpackage, applauncher) \ $(call FindSrcDirsForComponent, jdk.jpackage, common) - JPACKAGE_APPLAUNCHER_TOOLCHAIN := TOOLCHAIN_LINK_CXX + JPACKAGE_APPLAUNCHER_LINK_TYPE := C++ endif @@ -59,11 +59,11 @@ JPACKAGE_APPLAUNCHER_INCLUDES := $(addprefix -I, $(JPACKAGE_APPLAUNCHER_SRC)) # Output app launcher executable in resources dir, and symbols in the object dir $(eval $(call SetupJdkExecutable, BUILD_JPACKAGE_APPLAUNCHEREXE, \ NAME := jpackageapplauncher, \ + LINK_TYPE := $(JPACKAGE_APPLAUNCHER_LINK_TYPE), \ OUTPUT_DIR := $(JPACKAGE_OUTPUT_DIR), \ SYMBOLS_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/jpackageapplauncher, \ SRC := $(JPACKAGE_APPLAUNCHER_SRC), \ INCLUDE_FILES := $(JPACKAGE_APPLAUNCHER_INCLUDE_FILES), \ - TOOLCHAIN := $(JPACKAGE_APPLAUNCHER_TOOLCHAIN), \ OPTIMIZATION := LOW, \ DISABLED_WARNINGS_clang_LinuxPackage.c := format-nonliteral, \ DISABLED_WARNINGS_clang_JvmLauncherLib.c := format-nonliteral, \ @@ -103,7 +103,7 @@ ifeq ($(call isTargetOs, linux), true) SYMBOLS_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjpackageapplauncheraux, \ SRC := $(JPACKAGE_LIBAPPLAUNCHER_SRC), \ EXCLUDE_FILES := LinuxLauncher.c LinuxPackage.c, \ - TOOLCHAIN := TOOLCHAIN_LINK_CXX, \ + LINK_TYPE := C++, \ OPTIMIZATION := LOW, \ DISABLED_WARNINGS_clang_JvmLauncherLib.c := format-nonliteral, \ DISABLED_WARNINGS_clang_tstrings.cpp := format-nonliteral, \ @@ -177,10 +177,10 @@ ifeq ($(call isTargetOs, windows), true) # Build non-console version of launcher $(eval $(call SetupJdkExecutable, BUILD_JPACKAGE_APPLAUNCHERWEXE, \ NAME := jpackageapplauncherw, \ + LINK_TYPE := $(BUILD_JPACKAGE_APPLAUNCHEREXE_LINK_TYPE), \ OUTPUT_DIR := $(JPACKAGE_OUTPUT_DIR), \ SYMBOLS_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/jpackageapplauncherw, \ SRC := $(BUILD_JPACKAGE_APPLAUNCHEREXE_SRC), \ - TOOLCHAIN := $(BUILD_JPACKAGE_APPLAUNCHEREXE_TOOLCHAIN), \ OPTIMIZATION := $(BUILD_JPACKAGE_APPLAUNCHEREXE_OPTIMIZATION), \ CXXFLAGS := $(BUILD_JPACKAGE_APPLAUNCHEREXE_CXXFLAGS), \ CXXFLAGS_windows := $(BUILD_JPACKAGE_APPLAUNCHEREXE_CXXFLAGS_windows) -DJP_LAUNCHERW, \