From f0bffbce35bb06e724857e8651dd429c4f9df284 Mon Sep 17 00:00:00 2001 From: Magnus Ihse Bursie Date: Mon, 3 Jun 2024 10:03:42 +0000 Subject: [PATCH] 8333301: Remove static builds using --enable-static-build Reviewed-by: sgehwolf, erikj --- make/BuildStatic.gmk | 54 -------------------------- make/Main.gmk | 12 ------ make/autoconf/flags-cflags.m4 | 7 +--- make/autoconf/jdk-options.m4 | 25 +----------- make/autoconf/jvm-features.m4 | 21 +--------- make/autoconf/spec.gmk.template | 1 - make/autoconf/toolchain.m4 | 19 +++------ make/common/JdkNativeCompilation.gmk | 3 -- make/common/NativeCompilation.gmk | 8 ---- make/common/modules/LauncherCommon.gmk | 13 ------- make/common/native/Link.gmk | 7 ---- make/hotspot/lib/JvmFeatures.gmk | 4 -- make/modules/java.base/Lib.gmk | 31 +-------------- make/modules/jdk.jdwp.agent/Lib.gmk | 21 ---------- 14 files changed, 12 insertions(+), 214 deletions(-) delete mode 100644 make/BuildStatic.gmk diff --git a/make/BuildStatic.gmk b/make/BuildStatic.gmk deleted file mode 100644 index 763f0406a42..00000000000 --- a/make/BuildStatic.gmk +++ /dev/null @@ -1,54 +0,0 @@ -# -# Copyright (c) 2015, 2018, 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. -# - -default: all - -include $(SPEC) -include MakeBase.gmk - -################################################################################ -# -# Concatenate exported.symbols files for modules into a single global file. -# - -GLOBAL_SYMBOLS_FILE := $(SUPPORT_OUTPUTDIR)/build-static/exported.symbols - -EXPORTED_SYMBOLS_MODULES := java.base jdk.jdwp.agent - -MODULES_SYMBOLS_FILES := $(foreach module, $(EXPORTED_SYMBOLS_MODULES), \ - $(SUPPORT_OUTPUTDIR)/modules_libs/$(module)/$(module).symbols) - -$(GLOBAL_SYMBOLS_FILE): $(MODULES_SYMBOLS_FILES) - $(call LogInfo, Generating global exported.symbols file) - $(call MakeTargetDir) - $(CAT) $^ > $@ - -TARGETS += $(GLOBAL_SYMBOLS_FILE) - -################################################################################ - -all: $(TARGETS) - -.PHONY: default all diff --git a/make/Main.gmk b/make/Main.gmk index ca9e501a2b1..fbd394c1472 100644 --- a/make/Main.gmk +++ b/make/Main.gmk @@ -96,14 +96,6 @@ $(eval $(call SetupTarget, buildtools-hotspot, \ MAKEFILE := CompileToolsHotspot, \ )) -################################################################################ -# Special targets for certain modules - -$(eval $(call SetupTarget, generate-exported-symbols, \ - MAKEFILE := BuildStatic, \ - DEPS := java.base-libs jdk.jdwp.agent-libs, \ -)) - ################################################################################ # Gensrc targets, generating source before java compilation can be done # @@ -905,10 +897,6 @@ else $(LAUNCHER_TARGETS): java.base-libs - ifeq ($(STATIC_BUILD), true) - $(LAUNCHER_TARGETS): generate-exported-symbols - endif - # Declare dependency from -java to -gensrc $(foreach m, $(GENSRC_MODULES), $(eval $m-java: $m-gensrc)) diff --git a/make/autoconf/flags-cflags.m4 b/make/autoconf/flags-cflags.m4 index 97a3ec14ecd..09395202f22 100644 --- a/make/autoconf/flags-cflags.m4 +++ b/make/autoconf/flags-cflags.m4 @@ -641,11 +641,8 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_HELPER], JDK_PICFLAG="$PICFLAG" if test "x$OPENJDK_TARGET_OS" = xmacosx; then - # Linking is different on MacOSX - JDK_PICFLAG='' - if test "x$STATIC_BUILD" = xtrue; then - JVM_PICFLAG="" - fi + # Linking is different on macOS + JVM_PICFLAG="" fi # Extra flags needed when building optional static versions of certain diff --git a/make/autoconf/jdk-options.m4 b/make/autoconf/jdk-options.m4 index 23f331e79b7..b5c679d2a8e 100644 --- a/make/autoconf/jdk-options.m4 +++ b/make/autoconf/jdk-options.m4 @@ -267,11 +267,7 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_DEBUG_SYMBOLS], fi ], [ - if test "x$STATIC_BUILD" = xtrue; then - with_native_debug_symbols="none" - else - with_native_debug_symbols="external" - fi + with_native_debug_symbols="external" ]) AC_MSG_RESULT([$with_native_debug_symbols]) @@ -543,24 +539,7 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_UNDEFINED_BEHAVIOR_SANITIZER], # AC_DEFUN_ONCE([JDKOPT_SETUP_STATIC_BUILD], [ - UTIL_ARG_ENABLE(NAME: static-build, DEFAULT: false, RESULT: STATIC_BUILD, - DESC: [enable static library build], - CHECKING_MSG: [if static build is enabled], - CHECK_AVAILABLE: [ - AC_MSG_CHECKING([if static build is available]) - if test "x$OPENJDK_TARGET_OS" = "xmacosx"; then - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) - AVAILABLE=false - fi - ], - IF_ENABLED: [ - STATIC_BUILD_CFLAGS="-DSTATIC_BUILD=1" - CFLAGS_JDKLIB_EXTRA="$CFLAGS_JDKLIB_EXTRA $STATIC_BUILD_CFLAGS" - CXXFLAGS_JDKLIB_EXTRA="$CXXFLAGS_JDKLIB_EXTRA $STATIC_BUILD_CFLAGS" - ]) - AC_SUBST(STATIC_BUILD) + UTIL_DEPRECATED_ARG_ENABLE(static-build) ]) ################################################################################ diff --git a/make/autoconf/jvm-features.m4 b/make/autoconf/jvm-features.m4 index 28801984862..bdf92d701b9 100644 --- a/make/autoconf/jvm-features.m4 +++ b/make/autoconf/jvm-features.m4 @@ -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 @@ -46,7 +46,7 @@ m4_define(jvm_features_valid, m4_normalize( \ \ cds compiler1 compiler2 dtrace epsilongc g1gc jfr jni-check \ jvmci jvmti link-time-opt management minimal opt-size parallelgc \ - serialgc services shenandoahgc static-build vm-structs zero zgc \ + serialgc services shenandoahgc vm-structs zero zgc \ )) # Deprecated JVM features (these are ignored, but with a warning) @@ -309,22 +309,6 @@ AC_DEFUN_ONCE([JVM_FEATURES_CHECK_SHENANDOAHGC], ]) ]) -############################################################################### -# Check if the feature 'static-build' is available on this platform. -# -AC_DEFUN_ONCE([JVM_FEATURES_CHECK_STATIC_BUILD], -[ - JVM_FEATURES_CHECK_AVAILABILITY(static-build, [ - AC_MSG_CHECKING([if static-build is enabled in configure]) - if test "x$STATIC_BUILD" = "xtrue"; then - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no, use --enable-static-build to enable static build.]) - AVAILABLE=false - fi - ]) -]) - ############################################################################### # Check if the feature 'zgc' is available on this platform. # @@ -395,7 +379,6 @@ AC_DEFUN_ONCE([JVM_FEATURES_PREPARE_PLATFORM], JVM_FEATURES_CHECK_DTRACE JVM_FEATURES_CHECK_JVMCI JVM_FEATURES_CHECK_SHENANDOAHGC - JVM_FEATURES_CHECK_STATIC_BUILD JVM_FEATURES_CHECK_ZGC ]) diff --git a/make/autoconf/spec.gmk.template b/make/autoconf/spec.gmk.template index 7ef1aee861a..79a541dc78c 100644 --- a/make/autoconf/spec.gmk.template +++ b/make/autoconf/spec.gmk.template @@ -632,7 +632,6 @@ SHARED_LIBRARY_SUFFIX := @SHARED_LIBRARY_SUFFIX@ STATIC_LIBRARY_SUFFIX := @STATIC_LIBRARY_SUFFIX@ EXECUTABLE_SUFFIX := @EXECUTABLE_SUFFIX@ OBJ_SUFFIX := @OBJ_SUFFIX@ -STATIC_BUILD := @STATIC_BUILD@ STRIPFLAGS := @STRIPFLAGS@ diff --git a/make/autoconf/toolchain.m4 b/make/autoconf/toolchain.m4 index 15f4247b274..57064df1ed7 100644 --- a/make/autoconf/toolchain.m4 +++ b/make/autoconf/toolchain.m4 @@ -178,23 +178,14 @@ AC_DEFUN([TOOLCHAIN_SETUP_FILENAME_PATTERNS], EXECUTABLE_SUFFIX='.exe' else LIBRARY_PREFIX=lib - SHARED_LIBRARY_SUFFIX='.so' + if test "x$OPENJDK_TARGET_OS" = xmacosx; then + SHARED_LIBRARY_SUFFIX='.dylib' + else + SHARED_LIBRARY_SUFFIX='.so' + fi STATIC_LIBRARY_SUFFIX='.a' OBJ_SUFFIX='.o' EXECUTABLE_SUFFIX='' - if test "x$OPENJDK_TARGET_OS" = xmacosx; then - # For full static builds, we're overloading the shared library suffix - # in order to limit the amount of changes required. - # It would be better to remove SHARED and just use LIBRARY and - # LIBRARY_SUFFIX for libraries that can be built either - # shared or static and use STATIC_* for libraries that are - # always built statically. - if test "x$STATIC_BUILD" = xtrue; then - SHARED_LIBRARY_SUFFIX='.a' - else - SHARED_LIBRARY_SUFFIX='.dylib' - fi - fi fi AC_SUBST(LIBRARY_PREFIX) diff --git a/make/common/JdkNativeCompilation.gmk b/make/common/JdkNativeCompilation.gmk index 4385fb95988..846597ecee9 100644 --- a/make/common/JdkNativeCompilation.gmk +++ b/make/common/JdkNativeCompilation.gmk @@ -194,9 +194,6 @@ define AddJdkLibrary endif # Determine if the library in question is static. - ifeq ($(STATIC_BUILD), true) - $1_$2_STATIC_LIBRARY := true - endif # Ideally, we should not hardcode these ifeq ($(call isTargetOs, aix)+$$($1_$2_MODULE):$$($1_$2_NAME), true+java.base:jli) $1_$2_STATIC_LIBRARY := true diff --git a/make/common/NativeCompilation.gmk b/make/common/NativeCompilation.gmk index 8db00247f9a..abd4f65f753 100644 --- a/make/common/NativeCompilation.gmk +++ b/make/common/NativeCompilation.gmk @@ -259,14 +259,6 @@ define SetupBasicVariables $1_TYPE := LIBRARY endif - # If we're doing a static build and producing a library - # force it to be a static library and remove the -l libraries - ifeq ($(STATIC_BUILD), true) - ifeq ($$($1_TYPE), LIBRARY) - $1_TYPE := STATIC_LIBRARY - endif - endif - # STATIC_LIBS is set from Main.gmk when building static versions of certain # native libraries. ifeq ($(STATIC_LIBS), true) diff --git a/make/common/modules/LauncherCommon.gmk b/make/common/modules/LauncherCommon.gmk index a801631a9c9..fc7d721fb63 100644 --- a/make/common/modules/LauncherCommon.gmk +++ b/make/common/modules/LauncherCommon.gmk @@ -108,19 +108,6 @@ define SetupBuildLauncherBody )) $1_LDFLAGS += -sectcreate __TEXT __info_plist $$($1_PLIST_FILE) - - ifeq ($(STATIC_BUILD), true) - $1_LDFLAGS += -exported_symbols_list \ - $(SUPPORT_OUTPUTDIR)/build-static/exported.symbols - $1_LIBS += \ - $$(shell $(FIND) $(SUPPORT_OUTPUTDIR)/modules_libs/java.base -name "*.a") \ - $(SUPPORT_OUTPUTDIR)/modules_libs/jdk.jdwp.agent/libdt_socket.a \ - $(SUPPORT_OUTPUTDIR)/modules_libs/jdk.jdwp.agent/libjdwp.a \ - -framework CoreFoundation \ - -framework Foundation \ - -framework SystemConfiguration \ - -lstdc++ -liconv - endif endif $1_EXTRA_FILES := $(LAUNCHER_SRC)/main.c diff --git a/make/common/native/Link.gmk b/make/common/native/Link.gmk index 1ebc4b14c34..2090218ffbb 100644 --- a/make/common/native/Link.gmk +++ b/make/common/native/Link.gmk @@ -114,13 +114,6 @@ define CreateStaticLibrary $(if $$($1_LINK_OBJS_RELATIVE), $$(CD) $$(OUTPUTDIR) ; ) \ $$($1_AR) $$(ARFLAGS) -r -cs $$($1_TARGET) \ $$($1_AR_OBJ_ARG) $$($1_RES)) - ifeq ($(STATIC_BUILD), true) - $(RM) $$(@D)/$$(basename $$(@F)).symbols; \ - $(ECHO) "Getting symbols from nm"; \ - $(NM) $(NMFLAGS) -m $$($1_TARGET) | $(GREP) "__TEXT" | \ - $(EGREP) -v "non-external|private extern|__TEXT,__eh_frame" | \ - $(SED) -e 's/.* //' > $$(@D)/$$(basename $$(@F)).symbols - endif endef ################################################################################ diff --git a/make/hotspot/lib/JvmFeatures.gmk b/make/hotspot/lib/JvmFeatures.gmk index 9b455ba4021..c8a58465d52 100644 --- a/make/hotspot/lib/JvmFeatures.gmk +++ b/make/hotspot/lib/JvmFeatures.gmk @@ -78,10 +78,6 @@ ifeq ($(call check-jvm-feature, dtrace), true) JVM_CFLAGS_FEATURES += -DDTRACE_ENABLED endif -ifeq ($(call check-jvm-feature, static-build), true) - JVM_CFLAGS_FEATURES += -DSTATIC_BUILD=1 -endif - ifneq ($(call check-jvm-feature, jvmti), true) JVM_CFLAGS_FEATURES += -DINCLUDE_JVMTI=0 JVM_EXCLUDE_FILES += jvmtiGetLoadedClasses.cpp jvmtiThreadState.cpp jvmtiExtensions.cpp \ diff --git a/make/modules/java.base/Lib.gmk b/make/modules/java.base/Lib.gmk index cb7c2ed84ae..3f4b1c73e89 100644 --- a/make/modules/java.base/Lib.gmk +++ b/make/modules/java.base/Lib.gmk @@ -107,7 +107,7 @@ ifeq ($(call isTargetOs, macosx), true) TARGETS += $(BUILD_LIBOSXSECURITY) endif -ifeq ($(call isTargetOsType, unix)+$(STATIC_BUILD), true+false) +ifeq ($(call isTargetOsType, unix), true) ############################################################################## ## Build libjsig ############################################################################## @@ -145,35 +145,6 @@ ifeq ($(call isTargetOsType, unix)+$(STATIC_BUILD), true+false) endif endif -################################################################################ -# Create the symbols file for static builds. -ifeq ($(STATIC_BUILD), true) - STATIC_SYMBOLS_DIR := $(SUPPORT_OUTPUTDIR)/modules_libs/java.base - JAVA_BASE_EXPORT_SYMBOLS_SRC := \ - $(STATIC_SYMBOLS_DIR)/$(LIBRARY_PREFIX)jli.symbols \ - $(STATIC_SYMBOLS_DIR)/$(LIBRARY_PREFIX)java.symbols \ - $(STATIC_SYMBOLS_DIR)/$(LIBRARY_PREFIX)net.symbols \ - $(STATIC_SYMBOLS_DIR)/$(LIBRARY_PREFIX)nio.symbols \ - $(STATIC_SYMBOLS_DIR)/$(LIBRARY_PREFIX)verify.symbols \ - $(STATIC_SYMBOLS_DIR)/$(LIBRARY_PREFIX)zip.symbols \ - $(STATIC_SYMBOLS_DIR)/$(LIBRARY_PREFIX)jimage.symbols \ - $(STATIC_SYMBOLS_DIR)/server/$(LIBRARY_PREFIX)jvm.symbols \ - # - - JAVA_BASE_EXPORT_SYMBOL_FILE := $(STATIC_SYMBOLS_DIR)/java.base.symbols - - $(JAVA_BASE_EXPORT_SYMBOL_FILE): $(JAVA_BASE_EXPORT_SYMBOLS_SRC) - $(call LogInfo, Generating java.base.symbols file) - $(CAT) $^ > $@ - - # The individual symbol files is generated when the respective lib is built - $(JAVA_BASE_EXPORT_SYMBOLS_SRC): $(BUILD_LIBJLI) $(BUILD_LIBJAVA) \ - $(BUILD_LIBNET) $(BUILD_LIBNIO) $(BUILD_LIBVERIFY) $(BUILD_LIBZIP) \ - $(BUILD_LIBJIMAGE) - - TARGETS += $(JAVA_BASE_EXPORT_SYMBOL_FILE) -endif - ################################################################################ ## Build libsyslookup ################################################################################ diff --git a/make/modules/jdk.jdwp.agent/Lib.gmk b/make/modules/jdk.jdwp.agent/Lib.gmk index 03fab3c39ea..d83ff06f786 100644 --- a/make/modules/jdk.jdwp.agent/Lib.gmk +++ b/make/modules/jdk.jdwp.agent/Lib.gmk @@ -68,24 +68,3 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBJDWP, \ )) TARGETS += $(BUILD_LIBJDWP) - -################################################################################ -# Setup static build symbols - -ifeq ($(STATIC_BUILD), true) - STATIC_SYMBOLS_DIR := $(SUPPORT_OUTPUTDIR)/modules_libs/jdk.jdwp.agent - JDK_JDWP_AGENT_EXPORT_SYMBOLS_SRC := \ - $(STATIC_SYMBOLS_DIR)/$(LIBRARY_PREFIX)dt_socket.symbols \ - $(STATIC_SYMBOLS_DIR)/$(LIBRARY_PREFIX)jdwp.symbols - - JDK_JDWP_AGENT_EXPORT_SYMBOL_FILE := $(STATIC_SYMBOLS_DIR)/jdk.jdwp.agent.symbols - - $(JDK_JDWP_AGENT_EXPORT_SYMBOL_FILE): $(JDK_JDWP_AGENT_EXPORT_SYMBOLS_SRC) - $(call LogInfo, Generating jdk.jdwp.agent symbols file) - $(CAT) $^ > $@ - - # The individual symbol files is generated when the respective lib is built - $(JDK_JDWP_AGENT_EXPORT_SYMBOLS_SRC): $(BUILD_LIBDT_SOCKET) $(BUILD_LIBJDWP) - - TARGETS += $(JDK_JDWP_AGENT_EXPORT_SYMBOL_FILE) -endif