From bb28b0d2292c0f45decfaac0fb2f4c4284e9c666 Mon Sep 17 00:00:00 2001 From: Magnus Ihse Bursie Date: Fri, 30 Aug 2024 08:58:07 +0000 Subject: [PATCH] 8338404: Cross-compilation to different endianness fails after JDK-8318913 Reviewed-by: erikj, fbredberg --- make/CreateJmods.gmk | 17 +++++++++++++++-- make/InterimImage.gmk | 8 +++++--- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/make/CreateJmods.gmk b/make/CreateJmods.gmk index fd36554358b..86bc3b8335e 100644 --- a/make/CreateJmods.gmk +++ b/make/CreateJmods.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2014, 2023, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2014, 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 @@ -229,8 +229,21 @@ ifeq ($(INTERIM_JMOD), true) # Interim JMODs are not shipped anywhere, so there is no reason # to compress them at all. JMOD_FLAGS += --compress zip-0 + + JMOD_TARGET_OS := $(OPENJDK_BUILD_OS) + ifeq ($(JMOD_TARGET_OS), macosx) + JMOD_TARGET_OS := macos + endif + + JMOD_TARGET_CPU := $(OPENJDK_BUILD_CPU) + ifeq ($(JMOD_TARGET_CPU), x86_64) + JMOD_TARGET_CPU := amd64 + endif + + JMOD_TARGET_PLATFORM := $(JMOD_TARGET_OS)-$(JMOD_TARGET_CPU) else JMOD_FLAGS += --compress $(JMOD_COMPRESS) + JMOD_TARGET_PLATFORM := $(OPENJDK_MODULE_TARGET_PLATFORM) endif # Create jmods in the support dir and then move them into place to keep the @@ -242,7 +255,7 @@ $(eval $(call SetupExecute, create_$(JMOD_FILE), \ SUPPORT_DIR := $(JMODS_SUPPORT_DIR), \ PRE_COMMAND := $(RM) $(JMODS_DIR)/$(JMOD_FILE) $(JMODS_SUPPORT_DIR)/$(JMOD_FILE), \ COMMAND := $(JMOD) $(JMOD_SMALL_FLAGS) create --module-version $(VERSION_SHORT) \ - --target-platform '$(OPENJDK_MODULE_TARGET_PLATFORM)' \ + --target-platform '$(JMOD_TARGET_PLATFORM)' \ --module-path $(JMODS_DIR) $(JMOD_FLAGS) \ --date $(SOURCE_DATE_ISO_8601) \ $(JMODS_SUPPORT_DIR)/$(JMOD_FILE), \ diff --git a/make/InterimImage.gmk b/make/InterimImage.gmk index bb4b1fc6fd3..7e381dbe688 100644 --- a/make/InterimImage.gmk +++ b/make/InterimImage.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2016, 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,10 +46,12 @@ $(INTERIM_IMAGE_DIR)/$(JIMAGE_TARGET_FILE): $(JMODS) \ $(call DependOnVariable, INTERIM_MODULES_LIST) $(call LogWarn, Creating interim jimage) $(RM) -r $(INTERIM_IMAGE_DIR) - $(JLINK_TOOL) \ + $(call MakeDir, $(INTERIM_IMAGE_DIR)) + $(call ExecuteWithLog, $(INTERIM_IMAGE_DIR)/jlink, \ + $(JLINK_TOOL) \ --output $(INTERIM_IMAGE_DIR) \ --disable-plugin generate-jli-classes \ - --add-modules $(INTERIM_MODULES_LIST) + --add-modules $(INTERIM_MODULES_LIST)) $(TOUCH) $@ TARGETS += $(INTERIM_IMAGE_DIR)/$(JIMAGE_TARGET_FILE)