8329131: Fold libjli_static back into libjli on AIX

Reviewed-by: erikj, clanger
This commit is contained in:
Magnus Ihse Bursie 2024-03-31 11:15:49 +00:00
parent f2e5808b46
commit 9d052e9331
8 changed files with 22 additions and 39 deletions

View File

@ -126,7 +126,11 @@ SetupJdkLibrary = $(NamedParamsMacroTemplate)
define SetupJdkLibraryBody
ifeq ($$($1_OUTPUT_DIR), )
ifneq ($$(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

View File

@ -73,8 +73,6 @@ include native/Paths.gmk
# used both for C and C++.
# LIBS_<toolchain>_<OS> 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

View File

@ -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)

View File

@ -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; \

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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