From 9d052e93314f7fa50b356e368faa5ea723d3df54 Mon Sep 17 00:00:00 2001 From: Magnus Ihse Bursie Date: Sun, 31 Mar 2024 11:15:49 +0000 Subject: [PATCH] 8329131: Fold libjli_static back into libjli on AIX Reviewed-by: erikj, clanger --- make/common/JdkNativeCompilation.gmk | 6 +++- make/common/NativeCompilation.gmk | 2 -- make/common/modules/LauncherCommon.gmk | 6 ++-- make/common/native/Link.gmk | 4 +-- make/common/native/LinkMicrosoft.gmk | 4 +-- make/modules/java.base/lib/CoreLibraries.gmk | 30 ++++---------------- make/modules/java.instrument/Lib.gmk | 6 ++-- make/test/JtregNativeJdk.gmk | 3 ++ 8 files changed, 22 insertions(+), 39 deletions(-) diff --git a/make/common/JdkNativeCompilation.gmk b/make/common/JdkNativeCompilation.gmk index c08241fae0f..c45da1942b3 100644 --- a/make/common/JdkNativeCompilation.gmk +++ b/make/common/JdkNativeCompilation.gmk @@ -126,7 +126,11 @@ SetupJdkLibrary = $(NamedParamsMacroTemplate) define SetupJdkLibraryBody ifeq ($$($1_OUTPUT_DIR), ) ifneq ($$(MODULE), ) - $1_OUTPUT_DIR := $$(call FindLibDirForModule, $$(MODULE)) + ifeq ($$($1_TYPE), STATIC_LIBRARY) + $1_OUTPUT_DIR := $$(SUPPORT_OUTPUTDIR)/native/$$(MODULE) + else + $1_OUTPUT_DIR := $$(call FindLibDirForModule, $$(MODULE)) + endif else $$(error Must specify OUTPUT_DIR in a MODULE free context) endif diff --git a/make/common/NativeCompilation.gmk b/make/common/NativeCompilation.gmk index 893f4177990..f58976e34e0 100644 --- a/make/common/NativeCompilation.gmk +++ b/make/common/NativeCompilation.gmk @@ -73,8 +73,6 @@ include native/Paths.gmk # used both for C and C++. # LIBS__ the libraries to link to for the specified target # OS and toolchain, used both for C and C++. -# ARFLAGS the archiver flags to be used on unix platforms -# LIBFLAGS the flags for the lib tool used on windows # OBJECT_DIR the directory where we store the object files # OUTPUT_DIR the directory where the resulting binary is put # SYMBOLS_DIR the directory where the debug symbols are put, defaults to OUTPUT_DIR diff --git a/make/common/modules/LauncherCommon.gmk b/make/common/modules/LauncherCommon.gmk index 83ef53a0111..3bc5eb4eb83 100644 --- a/make/common/modules/LauncherCommon.gmk +++ b/make/common/modules/LauncherCommon.gmk @@ -151,9 +151,7 @@ define SetupBuildLauncherBody LDFLAGS_macosx := $$(call SET_EXECUTABLE_ORIGIN,/../lib) \ -L$(call FindLibDirForModule, java.base), \ LDFLAGS_aix := -L$(SUPPORT_OUTPUTDIR)/native/java.base, \ - JDK_LIBS_linux := -ljli, \ - JDK_LIBS_macosx := -ljli, \ - JDK_LIBS_aix := -ljli_static, \ + JDK_LIBS_unix := -ljli, \ JDK_LIBS_windows := \ $(SUPPORT_OUTPUTDIR)/native/java.base/libjava/java.lib \ $$($1_WINDOWS_JLI_LIB), \ @@ -177,7 +175,7 @@ define SetupBuildLauncherBody $$(BUILD_LAUNCHER_$1): $$(BUILD_PLIST_$1) ifeq ($(call isTargetOs, aix), true) - $$(BUILD_LAUNCHER_$1): $(call FindStaticLib, java.base, jli_static) + $$(BUILD_LAUNCHER_$1): $(call FindStaticLib, java.base, jli) endif ifeq ($(call isTargetOs, windows), true) diff --git a/make/common/native/Link.gmk b/make/common/native/Link.gmk index 3390eb3c899..03bc04963c4 100644 --- a/make/common/native/Link.gmk +++ b/make/common/native/Link.gmk @@ -78,7 +78,7 @@ define CreateStaticLibrary endif endif - $1_VARDEPS := $$($1_AR) $$(ARFLAGS) $$($1_ARFLAGS) $$($1_LIBS) \ + $1_VARDEPS := $$($1_AR) $$(ARFLAGS) $$($1_LIBS) \ $$($1_EXTRA_LIBS) ifeq ($$($1_ENABLE_PARTIAL_LINKING), true) $1_VARDEPS += $$($1_LD) $$($1_SYSROOT_LDFLAGS) @@ -116,7 +116,7 @@ define CreateStaticLibrary endif $$(call ExecuteWithLog, $$($1_OBJECT_DIR)/$$($1_SAFE_NAME)_link, \ $(if $$($1_LINK_OBJS_RELATIVE), $$(CD) $$(OUTPUTDIR) ; ) \ - $$($1_AR) $$(ARFLAGS) $$($1_ARFLAGS) -r -cs $$($1_TARGET) \ + $$($1_AR) $$(ARFLAGS) -r -cs $$($1_TARGET) \ $$($1_AR_OBJ_ARG) $$($1_RES)) ifeq ($(STATIC_BUILD), true) $(RM) $$(@D)/$$(basename $$(@F)).symbols; \ diff --git a/make/common/native/LinkMicrosoft.gmk b/make/common/native/LinkMicrosoft.gmk index f998bf3d117..d49553c15e2 100644 --- a/make/common/native/LinkMicrosoft.gmk +++ b/make/common/native/LinkMicrosoft.gmk @@ -38,7 +38,7 @@ endef ################################################################################ define CreateStaticLibraryMicrosoft - $1_VARDEPS := $$($1_LIB) $$(LIBFLAGS) $$($1_LIBFLAGS) $$($1_LIBS) \ + $1_VARDEPS := $$($1_LIB) $$(LIBFLAGS) $$($1_LIBS) \ $$($1_EXTRA_LIBS) $1_VARDEPS_FILE := $$(call DependOnVariable, $1_VARDEPS, \ $$($1_OBJECT_DIR)/$$($1_NOSUFFIX).vardeps) @@ -50,7 +50,7 @@ define CreateStaticLibraryMicrosoft $$(call LogInfo, Building static library $$($1_BASENAME)) $$(call MakeDir, $$($1_OUTPUT_DIR) $$($1_SYMBOLS_DIR)) $$(call ExecuteWithLog, $$($1_OBJECT_DIR)/$$($1_SAFE_NAME)_link, \ - $$($1_LIB) -nologo $$(LIBFLAGS) $$($1_LIBFLAGS) -out:$$($1_TARGET) \ + $$($1_LIB) -nologo $$(LIBFLAGS) -out:$$($1_TARGET) \ $$($1_LD_OBJ_ARG) $$($1_RES)) endef diff --git a/make/modules/java.base/lib/CoreLibraries.gmk b/make/modules/java.base/lib/CoreLibraries.gmk index d129e2839fa..75cd0328db8 100644 --- a/make/modules/java.base/lib/CoreLibraries.gmk +++ b/make/modules/java.base/lib/CoreLibraries.gmk @@ -163,8 +163,14 @@ ifneq ($(USE_EXTERNAL_LIBZ), true) $(subst .c,$(OBJ_SUFFIX),$(LIBJLI_EXTRA_FILE_LIST)) endif +ifeq ($(call isTargetOs, aix), true) + # AIX requires a static libjli because the compiler doesn't support '-rpath' + BUILD_LIBJLI_TYPE := STATIC_LIBRARY +endif + $(eval $(call SetupJdkLibrary, BUILD_LIBJLI, \ NAME := jli, \ + TYPE := $(BUILD_LIBJLI_TYPE), \ EXCLUDE_FILES := $(LIBJLI_EXCLUDE_FILES), \ EXTRA_FILES := $(LIBJLI_EXTRA_FILES), \ OPTIMIZATION := HIGH, \ @@ -173,7 +179,6 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBJLI, \ DISABLED_WARNINGS_clang := format-nonliteral deprecated-non-prototype, \ LIBS_unix := $(LIBZ_LIBS), \ LIBS_linux := $(LIBDL) -lpthread, \ - LIBS_aix := $(LIBDL),\ LIBS_macosx := \ -framework ApplicationServices \ -framework Cocoa \ @@ -183,26 +188,3 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBJLI, \ )) TARGETS += $(BUILD_LIBJLI) - -LIBJLI_SRC_DIRS := $(call FindSrcDirsForComponent, java.base, libjli) - -ifeq ($(call isTargetOs, aix), true) - # AIX also requires a static libjli because the compiler doesn't support - # '-rpath' - $(eval $(call SetupNativeCompilation, BUILD_LIBJLI_STATIC, \ - NAME := jli_static, \ - TYPE := STATIC_LIBRARY, \ - OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE), \ - SRC := $(LIBJLI_SRC_DIRS), \ - EXCLUDE_FILES := $(LIBJLI_EXCLUDE_FILES), \ - EXTRA_FILES := $(LIBJLI_EXTRA_FILES), \ - OPTIMIZATION := HIGH, \ - CFLAGS := $(STATIC_LIBRARY_FLAGS) $(CFLAGS_JDKLIB) $(LIBJLI_CFLAGS) \ - $(LIBZ_CFLAGS) $(addprefix -I, $(LIBJLI_SRC_DIRS)), \ - DISABLED_WARNINGS_clang_aix := format-nonliteral \ - deprecated-non-prototype, \ - ARFLAGS := $(ARFLAGS), \ - OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjli_static)) - - TARGETS += $(BUILD_LIBJLI_STATIC) -endif diff --git a/make/modules/java.instrument/Lib.gmk b/make/modules/java.instrument/Lib.gmk index 95267a6cd95..a6c1da8dfd3 100644 --- a/make/modules/java.instrument/Lib.gmk +++ b/make/modules/java.instrument/Lib.gmk @@ -41,9 +41,7 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBINSTRUMENT, \ LDFLAGS_macosx := -L$(call FindLibDirForModule, java.base), \ LDFLAGS_aix := -L$(SUPPORT_OUTPUTDIR)/native/java.base, \ JDK_LIBS := $(JDKLIB_LIBS), \ - JDK_LIBS_linux := -ljli, \ - JDK_LIBS_macosx := -ljli, \ - JDK_LIBS_aix := -ljli_static, \ + JDK_LIBS_unix := -ljli, \ JDK_LIBS_windows := $(WIN_JAVA_LIB) \ $(SUPPORT_OUTPUTDIR)/native/java.base/libjli/jli.lib jvm.lib, \ LIBS_unix := $(LIBZ_LIBS), \ @@ -57,7 +55,7 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBINSTRUMENT, \ )) ifeq ($(call isTargetOs, aix), true) - $(BUILD_LIBINSTRUMENT): $(call FindStaticLib, java.base, jli_static) + $(BUILD_LIBINSTRUMENT): $(call FindStaticLib, java.base, jli) else $(BUILD_LIBINSTRUMENT): $(call FindLib, java.base, jli) endif diff --git a/make/test/JtregNativeJdk.gmk b/make/test/JtregNativeJdk.gmk index e21280e8a5d..7cffc7311c7 100644 --- a/make/test/JtregNativeJdk.gmk +++ b/make/test/JtregNativeJdk.gmk @@ -94,6 +94,9 @@ else BUILD_JDK_JTREG_EXECUTABLES_LIBS_exelauncher := -ldl endif BUILD_JDK_JTREG_EXECUTABLES_LIBS_exeJliLaunchTest := -ljli + ifeq ($(call isTargetOs, aix), true) + BUILD_JDK_JTREG_EXECUTABLES_LDFLAGS_exeJliLaunchTest := -L$(SUPPORT_OUTPUTDIR)/native/java.base + endif BUILD_JDK_JTREG_EXECUTABLES_LIBS_exeCallerAccessTest := -ljvm BUILD_JDK_JTREG_EXECUTABLES_LIBS_exeNullCallerTest := $(LIBCXX) -ljvm endif