On Wed, 3 May 2023 02:09:22 GMT, Jiangli Zhou <jian...@openjdk.org> wrote:

> This PR is branched from the makefile changes for 
> https://bugs.openjdk.org/browse/JDK-8303796 and contains the following for 
> handling the JDK/VM static libraries:
> 
> - Create libjvm.a together with other JDK static libraries when building 
> 'static-libs-image' (or 'static-libs-bundles') target, include it in 
> 'images/static-libs/lib';
> - For libjvm.a specifically, exclude operator_new.o;
> - Filter out "external" .o files (those are the .o files included from a 
> different JDK library and needed when creating the .so shared library only) 
> from .a libraries; That's to avoid linker errors due to the duplicate symbols 
> problems from the related .o files;
> - Handle long arguments case for static build in 
> make/common/NativeCompilation.gmk;
> - Address @erikj79's comment in 
> https://github.com/openjdk/jdk/pull/13709#discussion_r1180750185 for 
> LIBJLI_STATIC_EXCLUDE_OBJS;

make/StaticLibsImage.gmk line 61:

> 59:   $(eval TARGETS += $$(COPY_STATIC_LIBS_libjvm)) \
> 60: )
> 61: 

Won't this fail if we were building more than one variant? Perhaps only put 
`$(JVM_VARIANT_MAIN)` in the static image to avoid problems?

make/modules/java.base/lib/CoreLibraries.gmk line 168:

> 166:   # The duplicate objects in different static libraries cause linking
> 167:   # errors due to duplicate symbols.
> 168:   LIBJLI_STATIC_EXCLUDE_OBJS := $(subst .c,.o,$(LIBJLI_EXTRA_FILE_LIST))

Should probably use `$(OBJ_SUFFIX)` instead of `.o`.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/13768#discussion_r1183706646
PR Review Comment: https://git.openjdk.org/jdk/pull/13768#discussion_r1183702610

Reply via email to