RFR 8202210: jlink uses little-endian for big-endian cross-compilation targets

Magnus Ihse Bursie magnus.ihse.bursie at oracle.com
Wed Apr 25 09:14:51 UTC 2018


On 2018-04-25 11:06, Aleksey Shipilev wrote:
> Hi,
>
> I was doing the exercise of cross-compiling from x86_64 to most OpenJDK arches, and we have
> discovered the bug with endianness. Right now, compiling big-endian s390x target on little-endian
> x86_64 host produces the modules blob that cannot be read on real s390x.
>
> It seems to be a simple overlook in image building, and we should pass target-cpu endianness to
> jlink. During the build, jlink is called twice: first for the interim image build, then for the
> final image build. In cross-compilation, it seems only the final image build should take target-cpu
> endianness.
>
> (Aside: what is our backporting policy for build system bugs? Would love to make the jdk10 backport
> for this)
The rules are the same as for all backports. Build system is no different.

>
> Bug:
>    https://bugs.openjdk.java.net/browse/JDK-8202210
>
> Fix:
>
> diff -r 5d2da44780ac make/Images.gmk
> --- a/make/Images.gmk	Wed Apr 25 10:38:07 2018 +0200
> +++ b/make/Images.gmk	Wed Apr 25 10:55:04 2018 +0200
> @@ -117,7 +117,7 @@
>
>   JLINK_TOOL := $(JLINK) -J-Djlink.debug=true \
>       --module-path $(IMAGES_OUTPUTDIR)/jmods \
> -    --endian $(OPENJDK_BUILD_CPU_ENDIAN) \
> +    --endian $(OPENJDK_TARGET_CPU_ENDIAN) \
>       --release-info $(BASE_RELEASE_FILE) \
>       --order-resources=$(call CommaList, $(JLINK_ORDER_RESOURCES)) \
>       --dedup-legal-notices=error-if-not-same-content \
>
> Testing: x86_64 build, s390x cross-compiled build
Looks good to me.

/Magnus
>
> Thanks,
> -Aleksey
>



More information about the build-dev mailing list