RFR: 8307858: [REDO] JDK-8307194 Add make target for optionally building a complete set of all JDK and hotspot libjvm static libraries [v9]
Jiangli Zhou
jiangli at openjdk.org
Mon Jun 12 02:18:57 UTC 2023
> Original description for JDK-8307194 change:
> -----
> This PR is branched from the makefile changes for https://bugs.openjdk.org/browse/JDK-8303796 and contains the following for handling the JDK/hotspot static libraries:
>
> - Build hotspot libjvm.a and JDK static libraries for static-libs-image/static-libs-bundles targets; This change does not affect the graal-builder-image target
>
> - 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 JDK .a libraries; That's to avoid linker failures caused by duplicate symbols
> - For libjli.a: Not include inflate.o inftrees.o inffast.o zadler32.o zcrc32.o zutil.o (compiled from zlib sources) if zlib is built as JDK bundled
> - For libawt_xawt.a and libawt_head.a: Not include systemScale.o, since it's provided in libawt.a
>
> - 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
> -----
>
> Updates to address build failures reported on macosx-<cpu> platforms:
>
> - For gcc/clang, when building a static library first partially link (using the `-r` linking option) all object files into one object. The output object file from the partial linking is then passed to `ar` to create the static library.
>
> The original change for JDK-8307194 used @argument_file for all platforms when dealing with long arguments to `ar`, which caused failures on macosx-<cpu> builds. On darwin (https://www.unix.com/man-page/osx/1/ar/), `ar` does not support @argument_file. The updated change avoids using @argument_file for `ar`.
>
> The partial linking change is done in make/common/NativeCompilation.gmk. The flag related change is done in make/autoconf/flags-ldflags.m4 mainly.
Jiangli Zhou has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 22 commits:
- Merge branch 'master' into JDK-8307858
- Merge branch 'master' into JDK-8307858
- - Use $1_ENABLE_PARTIAL_LINKING for checking if partial linking should be enabled, as suggested by @erikj79.
- Merge branch 'master' into JDK-8307858
- Need '$(if $$($1_LINK_OBJS_RELATIVE), $$(CD) $$(OUTPUTDIR) ; )' for AR command if relative path is used.
- Merge branch 'master' into JDK-8307858
- Address comments/suggestions from @erikj79:
- Only do partial linking step for building static libraries with clang on linux.
- On macosx, workaround the long argument issue for 'AR' with relative path.
Tested building jdk-image and static-libs-image on linux-x64 (for both gcc and clang) and macosx-x64 (clang) manually.
- Update make/common/NativeCompilation.gmk
Thanks you!
Co-authored-by: Erik Joelsson <37597443+erikj79 at users.noreply.github.com>
- - Add $$($1_LD) $$($1_SYSROOT_LDFLAGS) to $1_VARDEPS if $(TOOLCHAIN_TYPE) is gcc or clang, as suggested by @erikj79.
- Update make/common/NativeCompilation.gmk
Co-authored-by: Erik Joelsson <37597443+erikj79 at users.noreply.github.com>
- ... and 12 more: https://git.openjdk.org/jdk/compare/16c3d53b...af271e2c
-------------
Changes: https://git.openjdk.org/jdk/pull/14064/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=14064&range=08
Stats: 224 lines in 10 files changed: 173 ins; 34 del; 17 mod
Patch: https://git.openjdk.org/jdk/pull/14064.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/14064/head:pull/14064
PR: https://git.openjdk.org/jdk/pull/14064
More information about the core-libs-dev
mailing list