diff --git a/make/common/JdkNativeCompilation.gmk b/make/common/JdkNativeCompilation.gmk index 1a1333cf517..58f37bb67f0 100644 --- a/make/common/JdkNativeCompilation.gmk +++ b/make/common/JdkNativeCompilation.gmk @@ -140,6 +140,10 @@ define SetupJdkLibraryBody endif endif + ifeq ($$($1_LINK_TYPE), C++) + $1_LIBS += $(LIBCXX) + endif + ifeq ($$($1_SRC), ) ifneq ($$(MODULE), ) $1_SRC := $$(call FindSrcDirsForLib, $$(MODULE), $$($1_NAME)) @@ -233,6 +237,10 @@ define SetupJdkExecutableBody endif endif + ifeq ($$($1_LINK_TYPE), C++) + $1_LIBS += $(LIBCXX) + endif + ifeq ($$($1_VERSIONINFO_RESOURCE), ) $1_VERSIONINFO_RESOURCE := $$(GLOBAL_VERSION_INFO_RESOURCE) endif diff --git a/make/hotspot/lib/CompileGtest.gmk b/make/hotspot/lib/CompileGtest.gmk index a50d1ffac9e..8210e256189 100644 --- a/make/hotspot/lib/CompileGtest.gmk +++ b/make/hotspot/lib/CompileGtest.gmk @@ -141,7 +141,6 @@ $(eval $(call SetupJdkExecutable, BUILD_GTEST_LAUNCHER, \ -I$(GTEST_FRAMEWORK_SRC)/googlemock/include, \ LDFLAGS := $(LDFLAGS_JDKEXE), \ LDFLAGS_unix := -L$(JVM_OUTPUTDIR)/gtest $(call SET_SHARED_LIBRARY_ORIGIN), \ - LIBS_linux := $(LIBCXX), \ LIBS_unix := -ljvm, \ LIBS_windows := $(JVM_OUTPUTDIR)/gtest/objs/jvm.lib, \ COPY_DEBUG_SYMBOLS := $(GTEST_COPY_DEBUG_SYMBOLS), \ diff --git a/make/modules/java.base/Lib.gmk b/make/modules/java.base/Lib.gmk index 53fe95a1b0c..a0847dba492 100644 --- a/make/modules/java.base/Lib.gmk +++ b/make/modules/java.base/Lib.gmk @@ -213,9 +213,8 @@ $(eval $(call SetupJdkLibrary, BUILD_SYSLOOKUPLIB, \ LDFLAGS := $(LDFLAGS_JDKLIB), \ LDFLAGS_linux := -Wl$(COMMA)--no-as-needed, \ LDFLAGS_aix := -brtl -bexpfull, \ - LIBS := $(LIBCXX), \ - LIBS_linux := -lc -lm -ldl, \ - LIBS_aix := -lc -lm -ldecNumber, \ + LIBS_linux := -lm -ldl, \ + LIBS_aix := -lm -ldecNumber, \ )) TARGETS += $(BUILD_SYSLOOKUPLIB) @@ -247,8 +246,7 @@ ifeq ($(call isTargetOs, linux)+$(call isTargetCpu, x86_64)+$(INCLUDE_COMPILER2) CXXFLAGS := $(CXXFLAGS_JDKLIB) -std=c++17, \ LDFLAGS := $(LDFLAGS_JDKLIB) \ $(call SET_SHARED_LIBRARY_ORIGIN), \ - LIBS := $(LIBCXX), \ - LIBS_linux := -lc -lm -ldl, \ + LIBS_linux := -lm -ldl, \ )) TARGETS += $(BUILD_LIB_SIMD_SORT) diff --git a/make/modules/java.base/lib/CoreLibraries.gmk b/make/modules/java.base/lib/CoreLibraries.gmk index a3c62d1eb16..13ac1000abd 100644 --- a/make/modules/java.base/lib/CoreLibraries.gmk +++ b/make/modules/java.base/lib/CoreLibraries.gmk @@ -122,7 +122,7 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBJIMAGE, \ CFLAGS_unix := -UDEBUG, \ LDFLAGS := $(LDFLAGS_JDKLIB) $(LDFLAGS_CXX_JDK) \ $(call SET_SHARED_LIBRARY_ORIGIN), \ - LIBS_unix := -ljvm -ldl $(LIBCXX), \ + LIBS_unix := -ljvm -ldl, \ LIBS_windows := jvm.lib, \ )) diff --git a/make/modules/java.desktop/Lib.gmk b/make/modules/java.desktop/Lib.gmk index cb831faebf6..7facd363199 100644 --- a/make/modules/java.desktop/Lib.gmk +++ b/make/modules/java.desktop/Lib.gmk @@ -71,7 +71,7 @@ ifeq ($(call isTargetOs, aix), false) LIBS_linux := $(ALSA_LIBS), \ LIBS_macosx := -framework CoreAudio -framework CoreFoundation \ -framework CoreServices -framework AudioUnit \ - -framework CoreMIDI -framework AudioToolbox $(LIBCXX), \ + -framework CoreMIDI -framework AudioToolbox, \ LIBS_windows := $(WIN_JAVA_LIB) advapi32.lib dsound.lib winmm.lib user32.lib ole32.lib, \ )) diff --git a/make/modules/java.desktop/lib/Awt2dLibraries.gmk b/make/modules/java.desktop/lib/Awt2dLibraries.gmk index 048292e385b..817a51f3c77 100644 --- a/make/modules/java.desktop/lib/Awt2dLibraries.gmk +++ b/make/modules/java.desktop/lib/Awt2dLibraries.gmk @@ -572,7 +572,7 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBFONTMANAGER, \ LDFLAGS_unix := -L$(INSTALL_LIBRARIES_HERE), \ LDFLAGS_aix := -Wl$(COMMA)-berok, \ LIBS := $(BUILD_LIBFONTMANAGER_FONTLIB), \ - LIBS_unix := -lawt -ljava -ljvm $(LIBM) $(LIBCXX), \ + LIBS_unix := -lawt -ljava -ljvm $(LIBM), \ LIBS_macosx := -lawt_lwawt -framework CoreText -framework CoreFoundation -framework CoreGraphics, \ LIBS_windows := $(WIN_JAVA_LIB) advapi32.lib user32.lib gdi32.lib \ $(WIN_AWT_LIB), \ diff --git a/make/modules/jdk.hotspot.agent/Lib.gmk b/make/modules/jdk.hotspot.agent/Lib.gmk index 6d850615837..8ac39569a0f 100644 --- a/make/modules/jdk.hotspot.agent/Lib.gmk +++ b/make/modules/jdk.hotspot.agent/Lib.gmk @@ -66,7 +66,6 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBSA, \ CXXFLAGS := $(CXXFLAGS_JDKLIB) $(SA_CFLAGS) $(SA_CXXFLAGS), \ EXTRA_SRC := $(LIBSA_EXTRA_SRC), \ LDFLAGS := $(LDFLAGS_JDKLIB) $(call SET_SHARED_LIBRARY_ORIGIN), \ - LIBS := $(LIBCXX), \ LIBS_unix := -ljava, \ LIBS_linux := $(LIBDL), \ LIBS_macosx := -framework Foundation \ diff --git a/make/modules/jdk.internal.le/Lib.gmk b/make/modules/jdk.internal.le/Lib.gmk index 85550e3cc1d..2f41a9b0b76 100644 --- a/make/modules/jdk.internal.le/Lib.gmk +++ b/make/modules/jdk.internal.le/Lib.gmk @@ -35,7 +35,7 @@ ifeq ($(call isTargetOs, linux macosx windows), true) OPTIMIZATION := LOW, \ CFLAGS := $(CXXFLAGS_JDKLIB), \ LDFLAGS := $(LDFLAGS_JDKLIB), \ - LIBS_unix := $(JDKLIB_LIBS) $(LIBCXX), \ + LIBS_unix := $(JDKLIB_LIBS), \ LIBS_windows := $(JDKLIB_LIBS) user32.lib, \ )) diff --git a/make/modules/jdk.jpackage/Lib.gmk b/make/modules/jdk.jpackage/Lib.gmk index 58e40d772e1..c80f5bc723b 100644 --- a/make/modules/jdk.jpackage/Lib.gmk +++ b/make/modules/jdk.jpackage/Lib.gmk @@ -75,8 +75,8 @@ $(eval $(call SetupJdkExecutable, BUILD_JPACKAGE_APPLAUNCHEREXE, \ CXXFLAGS_windows := $(JPACKAGE_CXXFLAGS_windows), \ CFLAGS_windows := $(JPACKAGE_CFLAGS_windows), \ LDFLAGS := $(LDFLAGS_JDKEXE), \ - LIBS_macosx := $(LIBCXX) -framework Cocoa -rpath @executable_path/../Frameworks/ -rpath @executable_path/../PlugIns/, \ - LIBS_windows := $(LIBCXX) user32.lib ole32.lib msi.lib shlwapi.lib \ + LIBS_macosx := -framework Cocoa -rpath @executable_path/../Frameworks/ -rpath @executable_path/../PlugIns/, \ + LIBS_windows := user32.lib ole32.lib msi.lib shlwapi.lib \ Shell32.lib, \ LIBS_linux := -ldl, \ MANIFEST := $(JAVA_MANIFEST), \ @@ -110,7 +110,7 @@ ifeq ($(call isTargetOs, linux), true) CXXFLAGS := $(CXXFLAGS_JDKLIB) $(JPACKAGE_LIBAPPLAUNCHER_INCLUDES), \ CFLAGS := $(CFLAGS_JDKLIB) $(JPACKAGE_LIBAPPLAUNCHER_INCLUDES), \ LDFLAGS := $(LDFLAGS_JDKLIB), \ - LIBS := $(LIBCXX) -ldl, \ + LIBS := -ldl, \ )) JPACKAGE_TARGETS += $(BUILD_JPACKAGE_LIBAPPLAUNCHER) @@ -129,7 +129,7 @@ ifeq ($(call isTargetOs, windows), true) CXXFLAGS := $(CXXFLAGS_JDKLIB) $(JPACKAGE_CXXFLAGS_windows), \ LDFLAGS := $(LDFLAGS_JDKLIB) $(LDFLAGS_CXX_JDK) \ $(call SET_SHARED_LIBRARY_ORIGIN), \ - LIBS := $(LIBCXX) advapi32.lib ole32.lib msi.lib user32.lib \ + LIBS := advapi32.lib ole32.lib msi.lib user32.lib \ shlwapi.lib Shell32.lib, \ )) @@ -150,7 +150,7 @@ ifeq ($(call isTargetOs, windows), true) CXXFLAGS := $(call JpackageWithStaticCrt, $(CXXFLAGS_JDKLIB)) \ $(addprefix -I, $(JPACKAGE_WIXHELPER_SRC)) $(JPACKAGE_CXXFLAGS_windows), \ LDFLAGS := $(LDFLAGS_JDKLIB) $(LDFLAGS_CXX_JDK), \ - LIBS := $(LIBCXX) ole32.lib msi.lib User32.lib shlwapi.lib \ + LIBS := ole32.lib msi.lib User32.lib shlwapi.lib \ Shell32.lib, \ )) @@ -169,7 +169,7 @@ ifeq ($(call isTargetOs, windows), true) CXXFLAGS := $(call JpackageWithStaticCrt, $(CXXFLAGS_JDKEXE)) \ $(addprefix -I, $(JPACKAGE_MSIWRAPPER_SRC)) $(JPACKAGE_CXXFLAGS_windows), \ LDFLAGS := $(LDFLAGS_JDKEXE), \ - LIBS := $(LIBCXX) ole32.lib msi.lib user32.lib shlwapi.lib Shell32.lib, \ + LIBS := ole32.lib msi.lib user32.lib shlwapi.lib Shell32.lib, \ )) JPACKAGE_TARGETS += $(BUILD_JPACKAGE_MSIWRAPPER)