From 75c2622906afba5a53d48fde72dbdef8d81ba05a Mon Sep 17 00:00:00 2001 From: André Draszik Date: Wed, 22 Aug 2018 13:01:42 +0100 Subject: openjdk-8: add aarch32 port 8u172b11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Similar to the aarch64 build, we import the specific aarch32 port when building for ARMv7. We also add all the necessary patches to: * compile using gcc v8 * compile against musl This was tested on: * QEMU with cortex A7 emulation (using glibc) * real hardware (using musl) Signed-off-by: André Draszik Signed-off-by: Richard Leitner --- .../openjdk/openjdk-8-release-172b11-aarch32.inc | 58 +++ .../openjdk/openjdk-8-release-172b11-aarch64.inc | 2 + .../openjdk/openjdk-8-release-172b11-common.inc | 36 +- recipes-core/openjdk/openjdk-8-release-172b11.inc | 7 +- recipes-core/openjdk/openjdk-8_172b11.bb | 2 + recipes-core/openjdk/openjre-8_172b11.bb | 2 + ...hotspot-aarch32-fix-missing-return-values.patch | 53 +++ .../hotspot-remaining-musl-fixes-aarch32.patch | 35 ++ ...l-0005-hotspot-disable-agent-build-common.patch | 55 +++ ...5-hotspot-disable-agent-build-pt2-aarch32.patch | 51 +++ ...musl-0005-hotspot-disable-agent-build-pt2.patch | 51 +++ .../musl-0005-hotspot-disable-agent-build.patch | 88 ---- ...os_linux-remove-glibc-dependencies-common.patch | 62 +++ ...linux-remove-glibc-dependencies-pt2-aarch.patch | 36 ++ ...ot-os_linux-remove-glibc-dependencies-pt2.patch | 34 ++ ...otspot-os_linux-remove-glibc-dependencies.patch | 75 ---- .../openjdk8-fix-shark-build-common.patch | 416 +++++++++++++++++++ .../openjdk8-fix-shark-build-pt2-aarch32.patch | 11 + .../openjdk8-fix-shark-build-pt2.patch | 38 ++ .../openjdk8-fix-shark-build.patch | 454 --------------------- 20 files changed, 942 insertions(+), 624 deletions(-) create mode 100644 recipes-core/openjdk/openjdk-8-release-172b11-aarch32.inc create mode 100644 recipes-core/openjdk/patches-openjdk-8/0001-hotspot-aarch32-fix-missing-return-values.patch create mode 100644 recipes-core/openjdk/patches-openjdk-8/hotspot-remaining-musl-fixes-aarch32.patch create mode 100644 recipes-core/openjdk/patches-openjdk-8/musl-0005-hotspot-disable-agent-build-common.patch create mode 100644 recipes-core/openjdk/patches-openjdk-8/musl-0005-hotspot-disable-agent-build-pt2-aarch32.patch create mode 100644 recipes-core/openjdk/patches-openjdk-8/musl-0005-hotspot-disable-agent-build-pt2.patch delete mode 100644 recipes-core/openjdk/patches-openjdk-8/musl-0005-hotspot-disable-agent-build.patch create mode 100644 recipes-core/openjdk/patches-openjdk-8/musl-0006-hotspot-os_linux-remove-glibc-dependencies-common.patch create mode 100644 recipes-core/openjdk/patches-openjdk-8/musl-0006-hotspot-os_linux-remove-glibc-dependencies-pt2-aarch.patch create mode 100644 recipes-core/openjdk/patches-openjdk-8/musl-0006-hotspot-os_linux-remove-glibc-dependencies-pt2.patch delete mode 100644 recipes-core/openjdk/patches-openjdk-8/musl-0006-hotspot-os_linux-remove-glibc-dependencies.patch create mode 100644 recipes-core/openjdk/patches-openjdk-8/openjdk8-fix-shark-build-common.patch create mode 100644 recipes-core/openjdk/patches-openjdk-8/openjdk8-fix-shark-build-pt2-aarch32.patch create mode 100644 recipes-core/openjdk/patches-openjdk-8/openjdk8-fix-shark-build-pt2.patch delete mode 100644 recipes-core/openjdk/patches-openjdk-8/openjdk8-fix-shark-build.patch diff --git a/recipes-core/openjdk/openjdk-8-release-172b11-aarch32.inc b/recipes-core/openjdk/openjdk-8-release-172b11-aarch32.inc new file mode 100644 index 0000000..9cc2083 --- /dev/null +++ b/recipes-core/openjdk/openjdk-8-release-172b11-aarch32.inc @@ -0,0 +1,58 @@ +require openjdk-8-release-172b11-common.inc + +COMPATIBLE_HOST = "^$" +COMPATIBLE_HOST_armv7a = "arm" +COMPATIBLE_HOST_armv7ve = "arm" + +CORBA_CHANGESET_arm = "jdk8u172-b11-aarch32-180511" +SRC_URI[corba.md5sum] = "557b94847d8fade14c048cb0a96ed035" +SRC_URI[corba.sha256sum] = "366fa9aaf11d75f74e8c6bdf9cab9214cf66b0eac1ca40f2789b3ba442929708" + +HOTSPOT_CHANGESET_arm = "jdk8u172-b11-aarch32-180511" +SRC_URI[hotspot.md5sum] = "37d796794234f38fa71339ba78368b80" +SRC_URI[hotspot.sha256sum] = "5f89f8ba9a099a2d84b4ca6bd49553ce4efe1b29d55de9134809b7b59b6c9ce3" + +JAXP_CHANGESET_arm = "jdk8u172-b11-aarch32-180511" +SRC_URI[jaxp.md5sum] = "2dc311a7c0d6483226cdc5e501b1f8d0" +SRC_URI[jaxp.sha256sum] = "f62db09a41213b5b5d1886c1aeabe43def09235de1d60af518213b9acea4fdca" + +JAXWS_CHANGESET_arm = "jdk8u172-b11-aarch32-180511" +SRC_URI[jaxws.md5sum] = "fbd81e288d1ee5df631f213c130f21bb" +SRC_URI[jaxws.sha256sum] = "bac66e848ee48c6fef6130db4bb6879dbd64c550c1f42e4676ab6a2c3ee4fab8" + +JDK_CHANGESET_arm = "jdk8u172-b11-aarch32-180511" +SRC_URI[jdk.md5sum] = "b8003e6f1714617461f3eb7ee8b1efee" +SRC_URI[jdk.sha256sum] = "0a7eef6fef2b457bef3bd1d24031234bbb9d74a5fca2f65e1603278cd9d393a0" + +LANGTOOLS_CHANGESET_arm = "jdk8u172-b11-aarch32-180511" +SRC_URI[langtools.md5sum] = "e38f50b0113b3a956ac4917720655e93" +SRC_URI[langtools.sha256sum] = "9ca88fcfe5a07861de693ff3b38d03f063a7937576cd93116ea6b4a4bd7894d5" + +NASHORN_CHANGESET_arm = "jdk8u172-b11-aarch32-180511" +SRC_URI[nashorn.md5sum] = "c191cc92996fcb271254fc0a4f3eb7c9" +SRC_URI[nashorn.sha256sum] = "853bb3162fefa989fa0c31848cb990d8e5698ccd8a2a336dbf98bde35eb5241d" + +OPENJDK_CHANGESET_arm = "jdk8u172-b11-aarch32-180511" +SRC_URI[openjdk.md5sum] = "25398ccf25633a878dca54a8d606e48e" +SRC_URI[openjdk.sha256sum] = "8c8e515ebcceded4b90187b4bdaf129b63ae6e64ddfe4f05a60df0694235b9e7" + +PACKAGECONFIG_append_armv7a = " client" +PACKAGECONFIG_append_armv7ve = " client" + +do_install_append() { + if [ -d ${D}${JDK_HOME} ] ; then + sed -e 's,^\(-server ERROR$\),# \1,' \ + -e 's,^-client IGNORE,-client ERROR,' \ + -e 's,ALIASED_TO -server,ALIASED_TO -client,' \ + -i ${D}${JDK_HOME}/jre/lib/${JDK_ARCH}/jvm.cfg + fi + if [ -d ${D}${JRE_HOME} ] ; then + sed -e 's,^\(-server ERROR$\),# \1,' \ + -e 's,^-client IGNORE,-client ERROR,' \ + -e 's,ALIASED_TO -server,ALIASED_TO -client,' \ + -i ${D}${JRE_HOME}/lib/${JDK_ARCH}/jvm.cfg + fi +} + +JDK_ARCH_armv7a = "aarch32" +JDK_ARCH_armv7ve = "aarch32" diff --git a/recipes-core/openjdk/openjdk-8-release-172b11-aarch64.inc b/recipes-core/openjdk/openjdk-8-release-172b11-aarch64.inc index dddae6a..f0f4655 100644 --- a/recipes-core/openjdk/openjdk-8-release-172b11-aarch64.inc +++ b/recipes-core/openjdk/openjdk-8-release-172b11-aarch64.inc @@ -1,5 +1,7 @@ require openjdk-8-release-172b11-common.inc +COMPATIBLE_HOST = "aarch64" + CORBA_CHANGESET_aarch64 = "3a04a7c080af" SRC_URI[corba.md5sum] = "758b29d6cf714fd894df8674afd78e17" SRC_URI[corba.sha256sum] = "564113dbeadc57ac5831ccc056e0b920adbd3b74558cf750aa899f5de25ceb5e" diff --git a/recipes-core/openjdk/openjdk-8-release-172b11-common.inc b/recipes-core/openjdk/openjdk-8-release-172b11-common.inc index 8e94a4f..0cda4bb 100644 --- a/recipes-core/openjdk/openjdk-8-release-172b11-common.inc +++ b/recipes-core/openjdk/openjdk-8-release-172b11-common.inc @@ -33,30 +33,52 @@ HOTSPOT_UB_PATCH_prepend_aarch64 = "\ file://0012-hotspot-aarch64-fix-undefined-behaviour-gcc-v8-fix.patch \ file://0013-hotspot-aarch64-Fix-further-functions-with-a-missing.patch \ " +HOTSPOT_UB_PATCH_append_armv7a = " file://0001-hotspot-aarch32-fix-missing-return-values.patch" +HOTSPOT_UB_PATCH_append_armv7ve = " file://0001-hotspot-aarch32-fix-missing-return-values.patch" # some patches extracted from http://cr.openjdk.java.net/~rkennke/shark-build-hotspot/webrev.01/hotspot.patch # reported via http://mail.openjdk.java.net/pipermail/build-dev/2015-January/013972.html # by Roman Kennke (rkennke at redhat.com) LIBPNG_NEON_PATCH = "file://openjdk8-fix-libpng-neon-build.patch;striplevel=0" LIBPNG_NEON_PATCH_aarch64 = "" + PATCHES_URI_append_class-target = "\ file://openjdk8-restrict-to-staging-dir.patch;striplevel=0 \ - file://openjdk8-fix-shark-build.patch;striplevel=0 \ + file://openjdk8-fix-shark-build-common.patch;striplevel=0 \ + ${FIX_SHARK_BUILD_PT2_PATCH} \ file://openjdk8-fix-shark-stdc++11.patch;striplevel=0 \ file://openjdk8-fix-assembler-flag-handling-in-makefile.patch;striplevel=0 \ file://openjdk8-fix-adlc-flags.patch;striplevel=0 \ file://openjdk8-add-missing-linker-flags.patch;striplevel=0 \ " +FIX_SHARK_BUILD_PT2_PATCH = "file://openjdk8-fix-shark-build-pt2.patch;striplevel=0" +FIX_SHARK_BUILD_PT2_PATCH_armv7a = "file://openjdk8-fix-shark-build-pt2-aarch32.patch;striplevel=0" +FIX_SHARK_BUILD_PT2_PATCH_armv7ve = "file://openjdk8-fix-shark-build-pt2-aarch32.patch;striplevel=0" + PATCHES_URI_append_libc-musl = "\ - file://musl-0001-hotspot-stop-using-obsolete-isnanf.patch \ + ${OBSOLETE_ISNANF_PATCH} \ file://musl-0002-jdk-give-a-much-bigger-buffer-to-getmntent_r.patch \ file://musl-0003-jdk-fix-libjvm-load-on-musl-set-LD_LIBRARY_PATH.patch \ file://musl-0004-jdk-remove-sysctl.h-include-musl-build-fix.patch \ - file://musl-0005-hotspot-disable-agent-build.patch \ - file://musl-0006-hotspot-os_linux-remove-glibc-dependencies.patch \ + file://musl-0005-hotspot-disable-agent-build-common.patch \ + ${DISABLE_AGENT_BUILD_PT2} \ + file://musl-0006-hotspot-os_linux-remove-glibc-dependencies-common.patch \ + ${REMOVE_GLIBC_DEPENDENCIES_PT2} \ file://musl-0007-hotspot-os_linux_x86-remove-glibc-dependencies-fpu_c.patch \ file://musl-0008-jdk-musl-build-fix-use-SIGRTMAX-rather-than-__SIGRTM.patch \ file://musl-0009-jdk-musl-has-gethostby_r.patch \ " +OBSOLETE_ISNANF_PATCH = "file://musl-0001-hotspot-stop-using-obsolete-isnanf.patch" +OBSOLETE_ISNANF_PATCH_armv7a = "" +OBSOLETE_ISNANF_PATCH_armv7ve = "" +DISABLE_AGENT_BUILD_PT2 = "file://musl-0005-hotspot-disable-agent-build-pt2.patch" +DISABLE_AGENT_BUILD_PT2_armv7a = "file://musl-0005-hotspot-disable-agent-build-pt2-aarch32.patch" +DISABLE_AGENT_BUILD_PT2_armv7ve = "file://musl-0005-hotspot-disable-agent-build-pt2-aarch32.patch" +REMOVE_GLIBC_DEPENDENCIES_PT2 = "file://musl-0006-hotspot-os_linux-remove-glibc-dependencies-pt2.patch" +REMOVE_GLIBC_DEPENDENCIES_PT2_armv7a = "file://musl-0006-hotspot-os_linux-remove-glibc-dependencies-pt2-aarch.patch" +REMOVE_GLIBC_DEPENDENCIES_PT2_armv7ve = "file://musl-0006-hotspot-os_linux-remove-glibc-dependencies-pt2-aarch.patch" + +PATCHES_URI_append_libc-musl_armv7a = " file://hotspot-remaining-musl-fixes-aarch32.patch" +PATCHES_URI_append_libc-musl_armv7ve = " file://hotspot-remaining-musl-fixes-aarch32.patch" PATCHES_URI_append_libc-musl_aarch64 = " file://hotspot-remaining-musl-fixes-aarch64.patch" # Name of the directory containing the compiled output @@ -72,10 +94,14 @@ BUILD_CFLAGS_append = " -Wno-error=deprecated-declarations" TARGET_CFLAGS_append = " -Wno-error=deprecated-declarations" # Enable zero mode for arm based builds, as normal hotspot fails to build -PACKAGECONFIG_append_arm = " zero" +PACKAGECONFIG_append_armv4 = " zero" +PACKAGECONFIG_append_armv5 = " zero" +PACKAGECONFIG_append_armv6 = " zero" OPENJDK_ARCH_PORT = "jdk8u" OPENJDK_ARCH_PORT_aarch64 = "aarch64-port" +OPENJDK_ARCH_PORT_armv7a = "aarch32-port" +OPENJDK_ARCH_PORT_armv7ve = "aarch32-port" OPENJDK_HG_U = "jdk8u" OPENJDK_HG_URL = "http://hg.openjdk.java.net/${OPENJDK_ARCH_PORT}/${OPENJDK_HG_U}" diff --git a/recipes-core/openjdk/openjdk-8-release-172b11.inc b/recipes-core/openjdk/openjdk-8-release-172b11.inc index fdf7b39..b308e50 100644 --- a/recipes-core/openjdk/openjdk-8-release-172b11.inc +++ b/recipes-core/openjdk/openjdk-8-release-172b11.inc @@ -1,7 +1,10 @@ require openjdk-8-release-172b11-common.inc -# We do not yet work for aarch64. -COMPATIBLE_HOST = "^(?!aarch64).*" +# We do not yet work for aarch64, and we make sure +# to use the aarch32 port for ARMv7. +COMPATIBLE_HOST = "^(?!(aarch64)).*$" +COMPATIBLE_HOST_armv7a = "^$" +COMPATIBLE_HOST_armv7ve = "^$" CORBA_CHANGESET = "875a75c440cd" SRC_URI[corba.md5sum] = "66242dd6e749f39a5ef6add34f5ecb2f" diff --git a/recipes-core/openjdk/openjdk-8_172b11.bb b/recipes-core/openjdk/openjdk-8_172b11.bb index 9c2a7a1..c1c6e1e 100644 --- a/recipes-core/openjdk/openjdk-8_172b11.bb +++ b/recipes-core/openjdk/openjdk-8_172b11.bb @@ -1,5 +1,7 @@ INC_FILE_SUFFIX = "" INC_FILE_SUFFIX_aarch64 = "-aarch64" +INC_FILE_SUFFIX_armv7a = "-aarch32" +INC_FILE_SUFFIX_armv7ve = "-aarch32" require openjdk-8-release-${PV}${INC_FILE_SUFFIX}.inc require openjdk-8-cross.inc diff --git a/recipes-core/openjdk/openjre-8_172b11.bb b/recipes-core/openjdk/openjre-8_172b11.bb index 220dc01..dd29691 100644 --- a/recipes-core/openjdk/openjre-8_172b11.bb +++ b/recipes-core/openjdk/openjre-8_172b11.bb @@ -1,5 +1,7 @@ INC_FILE_SUFFIX = "" INC_FILE_SUFFIX_aarch64 = "-aarch64" +INC_FILE_SUFFIX_armv7a = "-aarch32" +INC_FILE_SUFFIX_armv7ve = "-aarch32" require openjdk-8-release-${PV}${INC_FILE_SUFFIX}.inc require openjdk-8-cross.inc diff --git a/recipes-core/openjdk/patches-openjdk-8/0001-hotspot-aarch32-fix-missing-return-values.patch b/recipes-core/openjdk/patches-openjdk-8/0001-hotspot-aarch32-fix-missing-return-values.patch new file mode 100644 index 0000000..bedc448 --- /dev/null +++ b/recipes-core/openjdk/patches-openjdk-8/0001-hotspot-aarch32-fix-missing-return-values.patch @@ -0,0 +1,53 @@ +From 658adc5b6567e9a6df56beabb8d226a9b4d8e762 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Andr=C3=A9=20Draszik?= +Date: Thu, 16 Aug 2018 02:27:44 +0100 +Subject: [PATCH] hotspot/aarch32: fix missing return values +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: André Draszik +--- + hotspot/src/cpu/aarch32/vm/c1_LIRAssembler_aarch32.cpp | 3 +++ + hotspot/src/cpu/aarch32/vm/relocInfo_aarch32.cpp | 1 + + 2 files changed, 4 insertions(+) + +diff --git a/hotspot/src/cpu/aarch32/vm/c1_LIRAssembler_aarch32.cpp b/hotspot/src/cpu/aarch32/vm/c1_LIRAssembler_aarch32.cpp +index cd291bf2..4ba98c68 100644 +--- a/hotspot/src/cpu/aarch32/vm/c1_LIRAssembler_aarch32.cpp ++++ b/hotspot/src/cpu/aarch32/vm/c1_LIRAssembler_aarch32.cpp +@@ -158,16 +158,19 @@ static Register as_reg(LIR_Opr op) { + Address LIR_Assembler::as_Address(LIR_Address* addr) { + // as_Address(LIR_Address*, Address::InsnDataType) should be used instead + ShouldNotCallThis(); ++ return Address(); + } + + Address LIR_Assembler::as_Address_hi(LIR_Address* addr) { + // as_Address_hi(LIR_Address*, Address::InsnDataType) should be used instead + ShouldNotCallThis(); ++ return Address(); + } + + Address LIR_Assembler::as_Address_lo(LIR_Address* addr) { + // as_Address_lo(LIR_Address*, Address::InsnDataType) should be used instead + ShouldNotCallThis(); ++ return Address(); + } + + Address LIR_Assembler::as_Address(LIR_Address* addr, Register tmp, Address::InsnDataType type) { +diff --git a/hotspot/src/cpu/aarch32/vm/relocInfo_aarch32.cpp b/hotspot/src/cpu/aarch32/vm/relocInfo_aarch32.cpp +index 979d53c9..c0b1a4c7 100644 +--- a/hotspot/src/cpu/aarch32/vm/relocInfo_aarch32.cpp ++++ b/hotspot/src/cpu/aarch32/vm/relocInfo_aarch32.cpp +@@ -87,6 +87,7 @@ address Relocation::pd_call_destination(address orig_addr) { + } + + ShouldNotReachHere(); ++ return NULL; + } + + void Relocation::pd_set_call_destination(address x) { +-- +2.18.0 + diff --git a/recipes-core/openjdk/patches-openjdk-8/hotspot-remaining-musl-fixes-aarch32.patch b/recipes-core/openjdk/patches-openjdk-8/hotspot-remaining-musl-fixes-aarch32.patch new file mode 100644 index 0000000..1140887 --- /dev/null +++ b/recipes-core/openjdk/patches-openjdk-8/hotspot-remaining-musl-fixes-aarch32.patch @@ -0,0 +1,35 @@ +From 4bab4a4468a59e303e8d05a409a07a24c2342452 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Andr=C3=A9=20Draszik?= +Date: Mon, 20 Aug 2018 12:38:38 +0100 +Subject: [PATCH] hotspot: remaining musl fixes (aarch32) +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +* fpu_control.h doesn't exist in musl +| hotspot/src/os_cpu/linux_aarch32/vm/os_linux_aarch32.cpp:78:11: fatal error: fpu_control.h: No such file or directory +| # include +| ^~~~~~~~~~~~~~~ +| compilation terminated. + +Upstream-Status: Inappropriate [OE specific] +Signed-off-by: André Draszik +--- + hotspot/src/os_cpu/linux_aarch32/vm/os_linux_aarch32.cpp | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/hotspot/src/os_cpu/linux_aarch32/vm/os_linux_aarch32.cpp b/hotspot/src/os_cpu/linux_aarch32/vm/os_linux_aarch32.cpp +index 052a423c..93a315e4 100644 +--- a/hotspot/src/os_cpu/linux_aarch32/vm/os_linux_aarch32.cpp ++++ b/hotspot/src/os_cpu/linux_aarch32/vm/os_linux_aarch32.cpp +@@ -75,7 +75,6 @@ + # include + # include + # include +-# include + + #define REG_FP 29 + #define SPELL_REG_SP "sp" +-- +2.11.0 + diff --git a/recipes-core/openjdk/patches-openjdk-8/musl-0005-hotspot-disable-agent-build-common.patch b/recipes-core/openjdk/patches-openjdk-8/musl-0005-hotspot-disable-agent-build-common.patch new file mode 100644 index 0000000..9126495 --- /dev/null +++ b/recipes-core/openjdk/patches-openjdk-8/musl-0005-hotspot-disable-agent-build-common.patch @@ -0,0 +1,55 @@ +From 19b1d6b4dc64a1c44a8f90776a489eee5c76463d Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Andr=C3=A9=20Draszik?= +Date: Tue, 27 Feb 2018 15:12:08 +0000 +Subject: [PATCH] hotspot: disable agent build (common) +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +the agent needs thread_db, which doesn't exist in musl + +Upstream-Status: Inappropriate [musl specific] +Signed-off-by: André Draszik +--- + hotspot/make/linux/makefiles/defs.make | 4 ++++ + hotspot/make/linux/makefiles/sa.make | 2 +- + 2 files changed, 5 insertions(+), 1 deletion(-) + +diff --git a/hotspot/make/linux/makefiles/defs.make b/hotspot/make/linux/makefiles/defs.make +index 3af5878a..d10bab95 100644 +--- a/hotspot/make/linux/makefiles/defs.make ++++ b/hotspot/make/linux/makefiles/defs.make +@@ -286,6 +286,7 @@ ifeq ($(JVM_VARIANT_MINIMAL1),true) + endif + endif + ++ifeq (0,1) + # Serviceability Binaries + # No SA Support for PPC, IA64, ARM or zero + ADD_SA_BINARIES/x86 = $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.$(LIBRARY_SUFFIX) \ +@@ -305,6 +306,9 @@ ADD_SA_BINARIES/ppc = + ADD_SA_BINARIES/ia64 = + ADD_SA_BINARIES/arm = + ADD_SA_BINARIES/zero = ++else ++ADD_SA_BINARIES/$(HS_ARCH) = ++endif + + -include $(HS_ALT_MAKE)/linux/makefiles/defs.make + +diff --git a/hotspot/make/linux/makefiles/sa.make b/hotspot/make/linux/makefiles/sa.make +index 66a7b945..61cc7244 100644 +--- a/hotspot/make/linux/makefiles/sa.make ++++ b/hotspot/make/linux/makefiles/sa.make +@@ -62,7 +62,7 @@ SA_PROPERTIES = $(SA_CLASSDIR)/sa.properties + + all: + if [ -d $(AGENT_DIR) -a "$(SRCARCH)" != "ia64" \ +- -a "$(SRCARCH)" != "zero" ] ; then \ ++ -a "$(SRCARCH)" != "zero" ] && [ 0 -eq 1 ] ; then \ + $(MAKE) -f sa.make $(GENERATED)/sa-jdi.jar; \ + fi + +-- +2.16.2 + diff --git a/recipes-core/openjdk/patches-openjdk-8/musl-0005-hotspot-disable-agent-build-pt2-aarch32.patch b/recipes-core/openjdk/patches-openjdk-8/musl-0005-hotspot-disable-agent-build-pt2-aarch32.patch new file mode 100644 index 0000000..cb893e5 --- /dev/null +++ b/recipes-core/openjdk/patches-openjdk-8/musl-0005-hotspot-disable-agent-build-pt2-aarch32.patch @@ -0,0 +1,51 @@ +From 5fa42493fd2dafb3bf9cf5a8a2be57e743eeafb8 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Andr=C3=A9=20Draszik?= +Date: Wed, 15 Aug 2018 13:50:04 +0100 +Subject: [PATCH] hotspot: disable agent build (pt2: aarch32) +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +the agent needs thread_db, which doesn't exist in musl + +Upstream-Status: Inappropriate [musl specific] +Signed-off-by: André Draszik +--- + common/autoconf/jdk-options.m4 | 2 +- + hotspot/make/linux/makefiles/saproc.make | 2 ++ + 2 files changed, 3 insertions(+), 1 deletion(-) + +diff --git a/common/autoconf/jdk-options.m4 b/common/autoconf/jdk-options.m4 +index 56fa4198..4675f0b5 100644 +--- a/common/autoconf/jdk-options.m4 ++++ b/common/autoconf/jdk-options.m4 +@@ -151,7 +151,7 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_JVM_VARIANTS], + AC_SUBST(JVM_VARIANT_ZEROSHARK) + AC_SUBST(JVM_VARIANT_CORE) + +- INCLUDE_SA=true ++ INCLUDE_SA=false + if test "x$JVM_VARIANT_ZERO" = xtrue; then + INCLUDE_SA=false + fi +diff --git a/hotspot/make/linux/makefiles/saproc.make b/hotspot/make/linux/makefiles/saproc.make +index ea52011e..f87d2cdb 100644 +--- a/hotspot/make/linux/makefiles/saproc.make ++++ b/hotspot/make/linux/makefiles/saproc.make +@@ -62,11 +62,13 @@ endif + # if $(AGENT_DIR) does not exist, we don't build SA + # also, we don't build SA on Itanium or zero. + ++ifeq (0,1) + ifneq ($(wildcard $(AGENT_DIR)),) + ifneq ($(filter-out aarch32 ia64 zero,$(SRCARCH)),) + BUILDLIBSAPROC = $(LIBSAPROC) + endif + endif ++endif + + ifneq ($(ALT_SASRCDIR),) + ALT_SAINCDIR=-I$(ALT_SASRCDIR) -DALT_SASRCDIR +-- +2.18.0 + diff --git a/recipes-core/openjdk/patches-openjdk-8/musl-0005-hotspot-disable-agent-build-pt2.patch b/recipes-core/openjdk/patches-openjdk-8/musl-0005-hotspot-disable-agent-build-pt2.patch new file mode 100644 index 0000000..4b0b0f0 --- /dev/null +++ b/recipes-core/openjdk/patches-openjdk-8/musl-0005-hotspot-disable-agent-build-pt2.patch @@ -0,0 +1,51 @@ +From 19b1d6b4dc64a1c44a8f90776a489eee5c76463d Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Andr=C3=A9=20Draszik?= +Date: Tue, 27 Feb 2018 15:12:08 +0000 +Subject: [PATCH] hotspot: disable agent build (pt2) +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +the agent needs thread_db, which doesn't exist in musl + +Upstream-Status: Inappropriate [musl specific] +Signed-off-by: André Draszik +--- + common/autoconf/jdk-options.m4 | 2 +- + hotspot/make/linux/makefiles/saproc.make | 2 ++ + 2 files changed, 3 insertions(+), 1 deletion(-) + +diff --git a/common/autoconf/jdk-options.m4 b/common/autoconf/jdk-options.m4 +index a8f71705..036963ac 100644 +--- a/common/autoconf/jdk-options.m4 ++++ b/common/autoconf/jdk-options.m4 +@@ -151,7 +151,7 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_JVM_VARIANTS], + AC_SUBST(JVM_VARIANT_ZEROSHARK) + AC_SUBST(JVM_VARIANT_CORE) + +- INCLUDE_SA=true ++ INCLUDE_SA=false + if test "x$JVM_VARIANT_ZERO" = xtrue ; then + INCLUDE_SA=false + fi +diff --git a/hotspot/make/linux/makefiles/saproc.make b/hotspot/make/linux/makefiles/saproc.make +index 6579c8e1..8f29004c 100644 +--- a/hotspot/make/linux/makefiles/saproc.make ++++ b/hotspot/make/linux/makefiles/saproc.make +@@ -62,11 +62,13 @@ endif + # if $(AGENT_DIR) does not exist, we don't build SA + # also, we don't build SA on Itanium or zero. + ++ifeq (0,1) + ifneq ($(wildcard $(AGENT_DIR)),) + ifneq ($(filter-out ia64 zero,$(SRCARCH)),) + BUILDLIBSAPROC = $(LIBSAPROC) + endif + endif ++endif + + ifneq ($(ALT_SASRCDIR),) + ALT_SAINCDIR=-I$(ALT_SASRCDIR) -DALT_SASRCDIR +-- +2.16.2 + diff --git a/recipes-core/openjdk/patches-openjdk-8/musl-0005-hotspot-disable-agent-build.patch b/recipes-core/openjdk/patches-openjdk-8/musl-0005-hotspot-disable-agent-build.patch deleted file mode 100644 index 24342b5..0000000 --- a/recipes-core/openjdk/patches-openjdk-8/musl-0005-hotspot-disable-agent-build.patch +++ /dev/null @@ -1,88 +0,0 @@ -From 19b1d6b4dc64a1c44a8f90776a489eee5c76463d Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Andr=C3=A9=20Draszik?= -Date: Tue, 27 Feb 2018 15:12:08 +0000 -Subject: [PATCH 5/9] hotspot: disable agent build -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -the agent needs thread_db, which doesn't exist in musl - -Upstream-Status: Inappropriate [musl specific] -Signed-off-by: André Draszik ---- - common/autoconf/jdk-options.m4 | 2 +- - hotspot/make/linux/makefiles/defs.make | 4 ++++ - hotspot/make/linux/makefiles/sa.make | 2 +- - hotspot/make/linux/makefiles/saproc.make | 2 ++ - 4 files changed, 8 insertions(+), 2 deletions(-) - -diff --git a/common/autoconf/jdk-options.m4 b/common/autoconf/jdk-options.m4 -index a8f71705..036963ac 100644 ---- a/common/autoconf/jdk-options.m4 -+++ b/common/autoconf/jdk-options.m4 -@@ -151,7 +151,7 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_JVM_VARIANTS], - AC_SUBST(JVM_VARIANT_ZEROSHARK) - AC_SUBST(JVM_VARIANT_CORE) - -- INCLUDE_SA=true -+ INCLUDE_SA=false - if test "x$JVM_VARIANT_ZERO" = xtrue ; then - INCLUDE_SA=false - fi -diff --git a/hotspot/make/linux/makefiles/defs.make b/hotspot/make/linux/makefiles/defs.make -index 3af5878a..d10bab95 100644 ---- a/hotspot/make/linux/makefiles/defs.make -+++ b/hotspot/make/linux/makefiles/defs.make -@@ -286,6 +286,7 @@ ifeq ($(JVM_VARIANT_MINIMAL1),true) - endif - endif - -+ifeq (0,1) - # Serviceability Binaries - # No SA Support for PPC, IA64, ARM or zero - ADD_SA_BINARIES/x86 = $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.$(LIBRARY_SUFFIX) \ -@@ -305,6 +306,9 @@ ADD_SA_BINARIES/ppc = - ADD_SA_BINARIES/ia64 = - ADD_SA_BINARIES/arm = - ADD_SA_BINARIES/zero = -+else -+ADD_SA_BINARIES/$(HS_ARCH) = -+endif - - -include $(HS_ALT_MAKE)/linux/makefiles/defs.make - -diff --git a/hotspot/make/linux/makefiles/sa.make b/hotspot/make/linux/makefiles/sa.make -index 66a7b945..61cc7244 100644 ---- a/hotspot/make/linux/makefiles/sa.make -+++ b/hotspot/make/linux/makefiles/sa.make -@@ -62,7 +62,7 @@ SA_PROPERTIES = $(SA_CLASSDIR)/sa.properties - - all: - if [ -d $(AGENT_DIR) -a "$(SRCARCH)" != "ia64" \ -- -a "$(SRCARCH)" != "zero" ] ; then \ -+ -a "$(SRCARCH)" != "zero" ] && [ 0 -eq 1 ] ; then \ - $(MAKE) -f sa.make $(GENERATED)/sa-jdi.jar; \ - fi - -diff --git a/hotspot/make/linux/makefiles/saproc.make b/hotspot/make/linux/makefiles/saproc.make -index 6579c8e1..8f29004c 100644 ---- a/hotspot/make/linux/makefiles/saproc.make -+++ b/hotspot/make/linux/makefiles/saproc.make -@@ -62,11 +62,13 @@ endif - # if $(AGENT_DIR) does not exist, we don't build SA - # also, we don't build SA on Itanium or zero. - -+ifeq (0,1) - ifneq ($(wildcard $(AGENT_DIR)),) - ifneq ($(filter-out ia64 zero,$(SRCARCH)),) - BUILDLIBSAPROC = $(LIBSAPROC) - endif - endif -+endif - - ifneq ($(ALT_SASRCDIR),) - ALT_SAINCDIR=-I$(ALT_SASRCDIR) -DALT_SASRCDIR --- -2.16.2 - diff --git a/recipes-core/openjdk/patches-openjdk-8/musl-0006-hotspot-os_linux-remove-glibc-dependencies-common.patch b/recipes-core/openjdk/patches-openjdk-8/musl-0006-hotspot-os_linux-remove-glibc-dependencies-common.patch new file mode 100644 index 0000000..74cd422 --- /dev/null +++ b/recipes-core/openjdk/patches-openjdk-8/musl-0006-hotspot-os_linux-remove-glibc-dependencies-common.patch @@ -0,0 +1,62 @@ +From a02a9fbc3f1fed181504bdb5b0a16863247f92fc Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Andr=C3=A9=20Draszik?= +Date: Fri, 2 Mar 2018 10:11:51 +0000 +Subject: [PATCH] hotspot: os_linux: remove glibc dependencies (common) +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +* dlvsym() is a GNU extension and doesn't exist in musl + | hotspot/src/os/linux/vm/os_linux.cpp:2846:13: error: 'dlvsym' was not declared in this scope + | void *f = dlvsym(handle, name, "libnuma_1.1"); + | ^~~~~~ + | hotspot/src/os/linux/vm/os_linux.cpp:2846:13: note: suggested alternative: 'dlsym' + | void *f = dlvsym(handle, name, "libnuma_1.1"); + | ^~~~~~ + | dlsym + +Upstream-Status: Inappropriate [musl specific] +Signed-off-by: André Draszik +--- + hotspot/src/os/linux/vm/os_linux.cpp | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/hotspot/src/os/linux/vm/os_linux.cpp b/hotspot/src/os/linux/vm/os_linux.cpp +index 044a70a6..3137796a 100644 +--- a/hotspot/src/os/linux/vm/os_linux.cpp ++++ b/hotspot/src/os/linux/vm/os_linux.cpp +@@ -530,6 +529,13 @@ void os::Linux::hotspot_sigmask(Thread* thread) { + // detecting pthread library + + void os::Linux::libpthread_init() { ++#if 1 ++ // Hard code supported musl compatible settings (taken from alpine linux) ++ os::Linux::set_glibc_version("glibc 2.9"); ++ os::Linux::set_libpthread_version("NPTL"); ++ os::Linux::set_is_NPTL(); ++ os::Linux::set_is_floating_stack(); ++#else + // Save glibc and pthread version strings. Note that _CS_GNU_LIBC_VERSION + // and _CS_GNU_LIBPTHREAD_VERSION are supported in glibc >= 2.3.2. Use a + // generic name for earlier versions. +@@ -588,6 +594,7 @@ void os::Linux::libpthread_init() { + if (os::Linux::is_NPTL() || os::Linux::supports_variable_stack_size()) { + os::Linux::set_is_floating_stack(); + } ++#endif + } + + ///////////////////////////////////////////////////////////////////////////// +@@ -2814,6 +2821,9 @@ int os::Linux::sched_getcpu_syscall(void) { + return (retval == -1) ? retval : cpu; + } + ++// musl doesn't have dlvsym() ++#define dlvsym(h,s,v) dlsym(h,s) ++ + // Something to do with the numa-aware allocator needs these symbols + extern "C" JNIEXPORT void numa_warn(int number, char *where, ...) { } + extern "C" JNIEXPORT void numa_error(char *where) { } +-- +2.16.2 + diff --git a/recipes-core/openjdk/patches-openjdk-8/musl-0006-hotspot-os_linux-remove-glibc-dependencies-pt2-aarch.patch b/recipes-core/openjdk/patches-openjdk-8/musl-0006-hotspot-os_linux-remove-glibc-dependencies-pt2-aarch.patch new file mode 100644 index 0000000..512af52 --- /dev/null +++ b/recipes-core/openjdk/patches-openjdk-8/musl-0006-hotspot-os_linux-remove-glibc-dependencies-pt2-aarch.patch @@ -0,0 +1,36 @@ +From 2915f7f56b99fa130942acb4289c9b5310075adc Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Andr=C3=A9=20Draszik?= +Date: Fri, 2 Mar 2018 10:11:51 +0000 +Subject: [PATCH] hotspot: os_linux: remove glibc dependencies (pt2: aarch32) +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +* gnu/libc-version.h doesn't exist in musl + | hotspot/src/os/linux/vm/os_linux.cpp:97:11: fatal error: gnu/libc-version.h: No such file or directory + | # include + | ^~~~~~~~~~~~~~~~~~~~ + +Upstream-Status: Inappropriate [musl specific] +Signed-off-by: André Draszik +--- + hotspot/src/os/linux/vm/os_linux.cpp | 3 --- + 1 file changed, 3 deletions(-) + +diff --git a/hotspot/src/os/linux/vm/os_linux.cpp b/hotspot/src/os/linux/vm/os_linux.cpp +index 8656357d..555b3a15 100644 +--- a/hotspot/src/os/linux/vm/os_linux.cpp ++++ b/hotspot/src/os/linux/vm/os_linux.cpp +@@ -94,9 +94,6 @@ + # include + # include + # include +-#ifndef __UCLIBC__ +-# include +-#endif + # include + # include + # include +-- +2.18.0 + diff --git a/recipes-core/openjdk/patches-openjdk-8/musl-0006-hotspot-os_linux-remove-glibc-dependencies-pt2.patch b/recipes-core/openjdk/patches-openjdk-8/musl-0006-hotspot-os_linux-remove-glibc-dependencies-pt2.patch new file mode 100644 index 0000000..91a653c --- /dev/null +++ b/recipes-core/openjdk/patches-openjdk-8/musl-0006-hotspot-os_linux-remove-glibc-dependencies-pt2.patch @@ -0,0 +1,34 @@ +From a02a9fbc3f1fed181504bdb5b0a16863247f92fc Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Andr=C3=A9=20Draszik?= +Date: Fri, 2 Mar 2018 10:11:51 +0000 +Subject: [PATCH] hotspot: os_linux: remove glibc dependencies (common) +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +* gnu/libc-version.h doesn't exist in musl + | hotspot/src/os/linux/vm/os_linux.cpp:97:11: fatal error: gnu/libc-version.h: No such file or directory + | # include + | ^~~~~~~~~~~~~~~~~~~~ + +Upstream-Status: Inappropriate [musl specific] +Signed-off-by: André Draszik +--- + hotspot/src/os/linux/vm/os_linux.cpp | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/hotspot/src/os/linux/vm/os_linux.cpp b/hotspot/src/os/linux/vm/os_linux.cpp +index 044a70a6..3137796a 100644 +--- a/hotspot/src/os/linux/vm/os_linux.cpp ++++ b/hotspot/src/os/linux/vm/os_linux.cpp +@@ -94,7 +94,6 @@ + # include + # include + # include +-# include + # include + # include + # include +-- +2.16.2 + diff --git a/recipes-core/openjdk/patches-openjdk-8/musl-0006-hotspot-os_linux-remove-glibc-dependencies.patch b/recipes-core/openjdk/patches-openjdk-8/musl-0006-hotspot-os_linux-remove-glibc-dependencies.patch deleted file mode 100644 index 4abd558..0000000 --- a/recipes-core/openjdk/patches-openjdk-8/musl-0006-hotspot-os_linux-remove-glibc-dependencies.patch +++ /dev/null @@ -1,75 +0,0 @@ -From a02a9fbc3f1fed181504bdb5b0a16863247f92fc Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Andr=C3=A9=20Draszik?= -Date: Fri, 2 Mar 2018 10:11:51 +0000 -Subject: [PATCH 6/9] hotspot: os_linux: remove glibc dependencies -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -* gnu/libc-version.h doesn't exist in musl - | hotspot/src/os/linux/vm/os_linux.cpp:97:11: fatal error: gnu/libc-version.h: No such file or directory - | # include - | ^~~~~~~~~~~~~~~~~~~~ - -* dlvsym() is a GNU extension and doesn't exist in musl - | hotspot/src/os/linux/vm/os_linux.cpp:2846:13: error: 'dlvsym' was not declared in this scope - | void *f = dlvsym(handle, name, "libnuma_1.1"); - | ^~~~~~ - | hotspot/src/os/linux/vm/os_linux.cpp:2846:13: note: suggested alternative: 'dlsym' - | void *f = dlvsym(handle, name, "libnuma_1.1"); - | ^~~~~~ - | dlsym - -Upstream-Status: Inappropriate [musl specific] -Signed-off-by: André Draszik ---- - hotspot/src/os/linux/vm/os_linux.cpp | 12 +++++++++++- - 1 file changed, 11 insertions(+), 1 deletion(-) - -diff --git a/hotspot/src/os/linux/vm/os_linux.cpp b/hotspot/src/os/linux/vm/os_linux.cpp -index 044a70a6..3137796a 100644 ---- a/hotspot/src/os/linux/vm/os_linux.cpp -+++ b/hotspot/src/os/linux/vm/os_linux.cpp -@@ -94,7 +94,6 @@ - # include - # include - # include --# include - # include - # include - # include -@@ -530,6 +529,13 @@ void os::Linux::hotspot_sigmask(Thread* thread) { - // detecting pthread library - - void os::Linux::libpthread_init() { -+#if 1 -+ // Hard code supported musl compatible settings (taken from alpine linux) -+ os::Linux::set_glibc_version("glibc 2.9"); -+ os::Linux::set_libpthread_version("NPTL"); -+ os::Linux::set_is_NPTL(); -+ os::Linux::set_is_floating_stack(); -+#else - // Save glibc and pthread version strings. Note that _CS_GNU_LIBC_VERSION - // and _CS_GNU_LIBPTHREAD_VERSION are supported in glibc >= 2.3.2. Use a - // generic name for earlier versions. -@@ -588,6 +594,7 @@ void os::Linux::libpthread_init() { - if (os::Linux::is_NPTL() || os::Linux::supports_variable_stack_size()) { - os::Linux::set_is_floating_stack(); - } -+#endif - } - - ///////////////////////////////////////////////////////////////////////////// -@@ -2814,6 +2821,9 @@ int os::Linux::sched_getcpu_syscall(void) { - return (retval == -1) ? retval : cpu; - } - -+// musl doesn't have dlvsym() -+#define dlvsym(h,s,v) dlsym(h,s) -+ - // Something to do with the numa-aware allocator needs these symbols - extern "C" JNIEXPORT void numa_warn(int number, char *where, ...) { } - extern "C" JNIEXPORT void numa_error(char *where) { } --- -2.16.2 - diff --git a/recipes-core/openjdk/patches-openjdk-8/openjdk8-fix-shark-build-common.patch b/recipes-core/openjdk/patches-openjdk-8/openjdk8-fix-shark-build-common.patch new file mode 100644 index 0000000..ece7f14 --- /dev/null +++ b/recipes-core/openjdk/patches-openjdk-8/openjdk8-fix-shark-build-common.patch @@ -0,0 +1,416 @@ +--- hotspot/make/Makefile.orig ++++ hotspot/make/Makefile +@@ -525,7 +525,7 @@ $(EXPORT_INCLUDE_DIR)/%: $(SHARK_BUILD + # Unix + $(EXPORT_JRE_LIB_ARCH_DIR)/%.$(LIBRARY_SUFFIX): $(SHARK_BUILD_DIR)/%.$(LIBRARY_SUFFIX) + $(install-file) +-$(EXPORT_JRE_LIB_ARCH_DIR)/%.debuginfo): $(SHARK_BUILD_DIR)/%.debuginfo ++$(EXPORT_JRE_LIB_ARCH_DIR)/%.debuginfo: $(SHARK_BUILD_DIR)/%.debuginfo + $(install-file) + $(EXPORT_JRE_LIB_ARCH_DIR)/%.diz: $(SHARK_BUILD_DIR)/%.diz + $(install-file) +--- hotspot/src/share/vm/ci/ciTypeFlow.cpp.orig ++++ hotspot/src/share/vm/ci/ciTypeFlow.cpp +@@ -35,8 +35,10 @@ + #include "interpreter/bytecode.hpp" + #include "interpreter/bytecodes.hpp" + #include "memory/allocation.inline.hpp" ++#ifdef COMPILER2 + #include "opto/compile.hpp" + #include "opto/node.hpp" ++#endif + #include "runtime/deoptimization.hpp" + #include "utilities/growableArray.hpp" + +@@ -2648,6 +2650,7 @@ void ciTypeFlow::df_flow_types(Block* st + assert (!blk->has_pre_order(), ""); + blk->set_next_pre_order(); + ++#ifdef COMPILER2 + if (_next_pre_order >= (int)Compile::current()->max_node_limit() / 2) { + // Too many basic blocks. Bail out. + // This can happen when try/finally constructs are nested to depth N, +@@ -2657,6 +2660,7 @@ void ciTypeFlow::df_flow_types(Block* st + record_failure("too many basic blocks"); + return; + } ++#endif + if (do_flow) { + flow_block(blk, temp_vector, temp_set); + if (failing()) return; // Watch for bailouts. +--- hotspot/src/share/vm/classfile/systemDictionary.cpp.orig ++++ hotspot/src/share/vm/classfile/systemDictionary.cpp +@@ -2289,6 +2289,7 @@ methodHandle SystemDictionary::find_meth + spe = NULL; + // Must create lots of stuff here, but outside of the SystemDictionary lock. + m = Method::make_method_handle_intrinsic(iid, signature, CHECK_(empty)); ++#ifndef SHARK + if (!Arguments::is_interpreter_only()) { + // Generate a compiled form of the MH intrinsic. + AdapterHandlerLibrary::create_native_wrapper(m); +@@ -2298,6 +2299,7 @@ methodHandle SystemDictionary::find_meth + "out of space in CodeCache for method handle intrinsic", empty); + } + } ++#endif + // Now grab the lock. We might have to throw away the new method, + // if a racing thread has managed to install one at the same time. + { +@@ -2311,9 +2313,11 @@ methodHandle SystemDictionary::find_meth + } + + assert(spe != NULL && spe->method() != NULL, ""); ++#ifndef SHARK + assert(Arguments::is_interpreter_only() || (spe->method()->has_compiled_code() && + spe->method()->code()->entry_point() == spe->method()->from_compiled_entry()), + "MH intrinsic invariant"); ++#endif + return spe->method(); + } + +--- hotspot/src/share/vm/runtime/handles.inline.hpp.orig ++++ hotspot/src/share/vm/runtime/handles.inline.hpp +@@ -51,6 +51,12 @@ inline Handle::Handle(Thread* thread, oo + } + #endif // ASSERT + ++#ifdef SHARK ++#define assert_on_stack(expr) (void)(expr) ++#else ++#define assert_on_stack(expr) assert((expr), "not on stack?") ++#endif ++ + // Constructors for metadata handles + #define DEF_METADATA_HANDLE_FN(name, type) \ + inline name##Handle::name##Handle(type* obj) : _value(obj), _thread(NULL) { \ +@@ -79,7 +85,7 @@ inline name##Handle::name##Handle(const + } else { \ + _thread = Thread::current(); \ + } \ +- assert (_thread->is_in_stack((address)this), "not on stack?"); \ ++ assert_on_stack (_thread->is_in_stack((address)this)); \ + _thread->metadata_handles()->push((Metadata*)_value); \ + } else { \ + _thread = NULL; \ +--- hotspot/src/share/vm/shark/sharkEntry.hpp.orig ++++ hotspot/src/share/vm/shark/sharkEntry.hpp +@@ -27,6 +27,7 @@ + #define SHARE_VM_SHARK_SHARKENTRY_HPP + + #include "shark/llvmHeaders.hpp" ++#include "entry_zero.hpp" + + class SharkContext; + +--- hotspot/src/share/vm/shark/llvmHeaders.hpp.orig ++++ hotspot/src/share/vm/shark/llvmHeaders.hpp +@@ -35,7 +35,11 @@ + #undef DEBUG + #endif + ++#if SHARK_LLVM_VERSION <= 34 + #include ++#else ++#include ++#endif + #include + + // includes specific to each version +--- common/autoconf/libraries.m4.orig ++++ common/autoconf/libraries.m4 +@@ -834,8 +834,9 @@ AC_DEFUN_ONCE([LIB_SETUP_STATIC_LINK_LIB + fi + fi + done +- llvm_version=$("${LLVM_CONFIG}" --version | sed 's/\.//; s/svn.*//') ++ llvm_version=$("${LLVM_CONFIG}" --version | sed 's/\.//; s/svn.*//; s/\..*$//') + LLVM_CFLAGS="${LLVM_CFLAGS} -DSHARK_LLVM_VERSION=${llvm_version}" ++ AS_IF([test $llvm_version -ge 34], [LLVM_CFLAGS="${LLVM_CFLAGS} -std=gnu++11"]) + + unset LLVM_LDFLAGS + for flag in $("${LLVM_CONFIG}" --ldflags); do +@@ -848,7 +849,7 @@ AC_DEFUN_ONCE([LIB_SETUP_STATIC_LINK_LIB + done + + unset LLVM_LIBS +- for flag in $("${LLVM_CONFIG}" --libs ${llvm_components}); do ++ for flag in $("${LLVM_CONFIG}" --libs --system-libs ${llvm_components}); do + if echo "${flag}" | grep -q '^-l'; then + if test "${LLVM_LIBS}" != ""; then + LLVM_LIBS="${LLVM_LIBS} " +--- hotspot/src/share/vm/shark/sharkIntrinsics.cpp.orig ++++ hotspot/src/share/vm/shark/sharkIntrinsics.cpp +@@ -265,7 +265,11 @@ void SharkIntrinsics::do_Unsafe_compareA + "addr"); + + // Perform the operation ++#if SHARK_LLVM_VERSION <= 34 + Value *result = builder()->CreateAtomicCmpXchg(addr, e, x, llvm::SequentiallyConsistent); ++#else ++ Value *result = builder()->CreateAtomicCmpXchg(addr, e, x, llvm::SequentiallyConsistent, llvm::SequentiallyConsistent); ++ #endif + // Push the result + state()->push( + SharkValue::create_jint( +--- hotspot/src/share/vm/shark/sharkRuntime.cpp.orig ++++ hotspot/src/share/vm/shark/sharkRuntime.cpp +@@ -32,6 +32,7 @@ + #ifdef TARGET_ARCH_zero + # include "stack_zero.inline.hpp" + #endif ++#include "memory/oopFactory.hpp" + + using namespace llvm; + +--- hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp.orig ++++ hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp +@@ -1732,7 +1732,11 @@ void SharkTopLevelBlock::do_new() { + heap_object = builder()->CreateIntToPtr( + old_top, SharkType::oop_type(), "heap_object"); + ++#if SHARK_LLVM_VERSION <= 34 + Value *check = builder()->CreateAtomicCmpXchg(top_addr, old_top, new_top, llvm::SequentiallyConsistent); ++#else ++ Value *check = builder()->CreateAtomicCmpXchg(top_addr, old_top, new_top, llvm::SequentiallyConsistent, llvm::SequentiallyConsistent); ++#endif + builder()->CreateCondBr( + builder()->CreateICmpEQ(old_top, check), + initialize, retry); +@@ -1933,7 +1937,11 @@ void SharkTopLevelBlock::acquire_lock(Va + + Value *lock = builder()->CreatePtrToInt( + monitor_header_addr, SharkType::intptr_type()); ++#if SHARK_LLVM_VERSION <= 34 + Value *check = builder()->CreateAtomicCmpXchg(mark_addr, disp, lock, llvm::Acquire); ++#else ++ Value *check = builder()->CreateAtomicCmpXchg(mark_addr, disp, lock, llvm::Acquire, llvm::Acquire); ++#endif + builder()->CreateCondBr( + builder()->CreateICmpEQ(disp, check), + acquired_fast, try_recursive); +@@ -2018,7 +2026,11 @@ void SharkTopLevelBlock::release_lock(in + PointerType::getUnqual(SharkType::intptr_type()), + "mark_addr"); + ++#if SHARK_LLVM_VERSION <= 34 + Value *check = builder()->CreateAtomicCmpXchg(mark_addr, lock, disp, llvm::Release); ++#else ++ Value *check = builder()->CreateAtomicCmpXchg(mark_addr, lock, disp, llvm::Release, llvm::Monotonic); ++#endif + builder()->CreateCondBr( + builder()->CreateICmpEQ(lock, check), + released_fast, slow_path); +--- hotspot/src/cpu/zero/vm/interpreter_zero.cpp.orig ++++ hotspot/src/cpu/zero/vm/interpreter_zero.cpp +@@ -49,7 +49,7 @@ + #ifdef COMPILER1 + #include "c1/c1_Runtime1.hpp" + #endif +-#ifdef CC_INTERP ++#if defined(CC_INTERP) || defined(SHARK) + #include "interpreter/cppInterpreter.hpp" + #endif + +--- hotspot/src/share/vm/shark/sharkCompiler.hpp.orig ++++ hotspot/src/share/vm/shark/sharkCompiler.hpp +@@ -40,6 +40,8 @@ class SharkCompiler : public AbstractCom + // Creation + SharkCompiler(); + ++ void init_llvm(); ++ + // Name of this compiler + const char *name() { return "shark"; } + +--- hotspot/src/share/vm/shark/sharkCompiler.cpp.orig ++++ hotspot/src/share/vm/shark/sharkCompiler.cpp +@@ -61,11 +61,25 @@ SharkCompiler::SharkCompiler() + : AbstractCompiler() { + // Create the lock to protect the memory manager and execution engine + _execution_engine_lock = new Monitor(Mutex::leaf, "SharkExecutionEngineLock"); +- MutexLocker locker(execution_engine_lock()); ++ { ++ MutexLocker locker(execution_engine_lock()); ++ init_llvm(); ++ } ++ // All done ++ set_state(initialized); ++} + ++void SharkCompiler::init_llvm() { ++ // with llvm 3.5, Multi-threading can only be enabled/disabled with the ++ // compile time define LLVM_ENABLE_THREADS ++#if SHARK_LLVM_VERSION <= 34 + // Make LLVM safe for multithreading + if (!llvm_start_multithreaded()) + fatal("llvm_start_multithreaded() failed"); ++#else ++ if (!llvm_is_multithreaded()) ++ fatal("llvm_is_multithreaded() tells no multithreading support in llvm"); ++#endif + + // Initialize the native target + InitializeNativeTarget(); +@@ -83,7 +97,7 @@ SharkCompiler::SharkCompiler() + // Finetune LLVM for the current host CPU. + StringMap Features; + bool gotCpuFeatures = llvm::sys::getHostCPUFeatures(Features); +- std::string cpu("-mcpu=" + llvm::sys::getHostCPUName()); ++ std::string cpu("-mcpu=" + std::string(llvm::sys::getHostCPUName())); + + std::vector args; + args.push_back(""); // program name +@@ -112,6 +126,9 @@ SharkCompiler::SharkCompiler() + builder.setMAttrs(MAttrs); + builder.setJITMemoryManager(memory_manager()); + builder.setEngineKind(EngineKind::JIT); ++#if SHARK_LLVM_VERSION > 34 ++ builder.setUseMCJIT(true); ++#endif + builder.setErrorStr(&ErrorMsg); + if (! fnmatch(SharkOptimizationLevel, "None", 0)) { + tty->print_cr("Shark optimization level set to: None"); +@@ -133,10 +150,11 @@ SharkCompiler::SharkCompiler() + exit(1); + } + ++#if SHARK_LLVM_VERSION > 34 ++ _native_context->execution_engine(_execution_engine); ++ _normal_context->execution_engine(_execution_engine); ++#endif + execution_engine()->addModule(_native_context->module()); +- +- // All done +- set_state(initialized); + } + + void SharkCompiler::initialize() { +@@ -165,7 +183,7 @@ void SharkCompiler::compile_method(ciEnv + } + + // Create the recorders +- Arena arena; ++ Arena arena(mtCompiler); + env->set_oop_recorder(new OopRecorder(&arena)); + OopMapSet oopmaps; + env->set_debug_info(new DebugInformationRecorder(env->oop_recorder())); +@@ -268,7 +286,12 @@ void SharkCompiler::generate_native_code + + if (SharkVerifyFunction != NULL) { + if (!fnmatch(SharkVerifyFunction, name, 0)) { ++#if SHARK_LLVM_VERSION <= 34 + verifyFunction(*function); ++#else ++ LLVMValueRef F = wrap(function); ++ LLVMVerifyFunction(F, LLVMAbortProcessAction); ++#endif + } + } + +@@ -298,7 +321,11 @@ void SharkCompiler::generate_native_code + #endif + #endif // !NDEBUG + memory_manager()->set_entry_for_function(function, entry); ++#if SHARK_LLVM_VERSION <= 34 + code = (address) execution_engine()->getPointerToFunction(function); ++#else ++ code = (address) execution_engine()->getFunctionAddress(name); ++#endif + } + assert(code != NULL, "code must be != NULL"); + entry->set_entry_point(code); +--- hotspot/src/share/vm/shark/sharkContext.cpp.orig ++++ hotspot/src/share/vm/shark/sharkContext.cpp +@@ -34,8 +34,13 @@ + using namespace llvm; + + SharkContext::SharkContext(const char* name) +- : LLVMContext(), +- _free_queue(NULL) { ++ : LLVMContext() ++ , _free_queue(0) ++#if SHARK_LLVM_VERSION > 34 ++ , _ee(0) ++ , func_mod_map() ++#endif ++{ + // Create a module to build our functions into + _module = new Module(name, *this); + +--- hotspot/src/share/vm/shark/sharkContext.hpp.orig ++++ hotspot/src/share/vm/shark/sharkContext.hpp +@@ -29,6 +29,8 @@ + #include "shark/llvmHeaders.hpp" + #include "shark/sharkCompiler.hpp" + ++#include ++ + // The LLVMContext class allows multiple instances of LLVM to operate + // independently of each other in a multithreaded context. We extend + // this here to store things in Shark that are LLVMContext-specific. +@@ -41,12 +43,28 @@ class SharkContext : public llvm::LLVMCo + + private: + llvm::Module* _module; ++#if SHARK_LLVM_VERSION > 34 ++ llvm::ExecutionEngine *_ee; ++ std::map func_mod_map; ++#endif + + public: + llvm::Module* module() const { + return _module; + } + ++#if SHARK_LLVM_VERSION > 34 ++ llvm::ExecutionEngine *execution_engine(llvm::ExecutionEngine *ee) { ++ llvm::ExecutionEngine *oee = _ee; ++ _ee = ee; ++ return oee; ++ } ++ ++ llvm::ExecutionEngine *execution_engine() const { ++ return _ee; ++ } ++#endif ++ + // Get this thread's SharkContext + public: + static SharkContext& current() { +@@ -55,12 +73,35 @@ class SharkContext : public llvm::LLVMCo + + // Module accessors + public: +- void add_function(llvm::Function* function) const { ++ void add_function(llvm::Function* function) { ++#if SHARK_LLVM_VERSION <= 34 + module()->getFunctionList().push_back(function); ++#else ++ // shark compiles modules, not functions ++ std::map::iterator i = func_mod_map.find(function->getName().str()); ++ if(func_mod_map.end() == i) { ++ llvm::Module *mod4fun = new llvm::Module(function->getName(), *this); ++ func_mod_map.insert(std::pair(function->getName().str(), mod4fun)); ++ mod4fun->getFunctionList().push_back(function); ++ _ee->addModule(mod4fun); ++ } ++#endif + } + llvm::Constant* get_external(const char* name, + llvm::FunctionType* sig) { ++ // XXX see whether we need additional module map, too ++#if SHARK_LLVM_VERSION <= 34 + return module()->getOrInsertFunction(name, sig); ++#else ++ // shark compiles modules, not functions ++ std::map::iterator i = func_mod_map.find(name); ++ if(func_mod_map.end() == i) { ++ llvm::Module *mod4fun = new llvm::Module(name, *this); ++ func_mod_map.insert(std::pair(name, mod4fun)); ++ mod4fun->getOrInsertFunction(name, sig); ++ _ee->addModule(mod4fun); ++ } ++#endif + } + + // Basic types diff --git a/recipes-core/openjdk/patches-openjdk-8/openjdk8-fix-shark-build-pt2-aarch32.patch b/recipes-core/openjdk/patches-openjdk-8/openjdk8-fix-shark-build-pt2-aarch32.patch new file mode 100644 index 0000000..b09745c --- /dev/null +++ b/recipes-core/openjdk/patches-openjdk-8/openjdk8-fix-shark-build-pt2-aarch32.patch @@ -0,0 +1,11 @@ +--- hotspot/src/cpu/zero/vm/entry_zero.hpp ++++ hotspot/src/cpu/zero/vm/entry_zero.hpp +@@ -26,6 +26,8 @@ + #ifndef CPU_ZERO_VM_ENTRY_ZERO_HPP + #define CPU_ZERO_VM_ENTRY_ZERO_HPP + ++#include "utilities/globalDefinitions.hpp" ++#include "utilities/exceptions.hpp" + #include "interpreter/cppInterpreter.hpp" + + class ZeroEntry { diff --git a/recipes-core/openjdk/patches-openjdk-8/openjdk8-fix-shark-build-pt2.patch b/recipes-core/openjdk/patches-openjdk-8/openjdk8-fix-shark-build-pt2.patch new file mode 100644 index 0000000..018640b --- /dev/null +++ b/recipes-core/openjdk/patches-openjdk-8/openjdk8-fix-shark-build-pt2.patch @@ -0,0 +1,38 @@ +--- hotspot/src/cpu/zero/vm/entry_zero.hpp.orig ++++ hotspot/src/cpu/zero/vm/entry_zero.hpp +@@ -26,6 +26,10 @@ + #ifndef CPU_ZERO_VM_ENTRY_ZERO_HPP + #define CPU_ZERO_VM_ENTRY_ZERO_HPP + ++#include "utilities/globalDefinitions.hpp" ++#include "utilities/exceptions.hpp" ++#include "interpreter/cppInterpreter.hpp" ++ + class ZeroEntry { + public: + ZeroEntry() { +--- hotspot/src/share/vm/interpreter/cppInterpreterGenerator.hpp.orig ++++ hotspot/src/share/vm/interpreter/cppInterpreterGenerator.hpp +@@ -30,6 +30,10 @@ + + #ifdef CC_INTERP + ++#ifdef TARGET_ARCH_zero ++#include "entry_zero.hpp" ++#endif ++ + class CppInterpreterGenerator: public AbstractInterpreterGenerator { + protected: + // shared code sequences +--- hotspot/src/cpu/zero/vm/nativeInst_zero.cpp.orig ++++ hotspot/src/cpu/zero/vm/nativeInst_zero.cpp +@@ -26,6 +26,9 @@ + #include "precompiled.hpp" + #include "assembler_zero.inline.hpp" + #include "memory/resourceArea.hpp" ++#ifdef CC_INTERP ++#include "entry_zero.hpp" ++#endif + #include "nativeInst_zero.hpp" + #include "oops/oop.inline.hpp" + #include "runtime/handles.hpp" diff --git a/recipes-core/openjdk/patches-openjdk-8/openjdk8-fix-shark-build.patch b/recipes-core/openjdk/patches-openjdk-8/openjdk8-fix-shark-build.patch deleted file mode 100644 index f241361..0000000 --- a/recipes-core/openjdk/patches-openjdk-8/openjdk8-fix-shark-build.patch +++ /dev/null @@ -1,454 +0,0 @@ ---- hotspot/make/Makefile.orig -+++ hotspot/make/Makefile -@@ -525,7 +525,7 @@ $(EXPORT_INCLUDE_DIR)/%: $(SHARK_BUILD - # Unix - $(EXPORT_JRE_LIB_ARCH_DIR)/%.$(LIBRARY_SUFFIX): $(SHARK_BUILD_DIR)/%.$(LIBRARY_SUFFIX) - $(install-file) --$(EXPORT_JRE_LIB_ARCH_DIR)/%.debuginfo): $(SHARK_BUILD_DIR)/%.debuginfo -+$(EXPORT_JRE_LIB_ARCH_DIR)/%.debuginfo: $(SHARK_BUILD_DIR)/%.debuginfo - $(install-file) - $(EXPORT_JRE_LIB_ARCH_DIR)/%.diz: $(SHARK_BUILD_DIR)/%.diz - $(install-file) ---- hotspot/src/share/vm/ci/ciTypeFlow.cpp.orig -+++ hotspot/src/share/vm/ci/ciTypeFlow.cpp -@@ -35,8 +35,10 @@ - #include "interpreter/bytecode.hpp" - #include "interpreter/bytecodes.hpp" - #include "memory/allocation.inline.hpp" -+#ifdef COMPILER2 - #include "opto/compile.hpp" - #include "opto/node.hpp" -+#endif - #include "runtime/deoptimization.hpp" - #include "utilities/growableArray.hpp" - -@@ -2648,6 +2650,7 @@ void ciTypeFlow::df_flow_types(Block* st - assert (!blk->has_pre_order(), ""); - blk->set_next_pre_order(); - -+#ifdef COMPILER2 - if (_next_pre_order >= (int)Compile::current()->max_node_limit() / 2) { - // Too many basic blocks. Bail out. - // This can happen when try/finally constructs are nested to depth N, -@@ -2657,6 +2660,7 @@ void ciTypeFlow::df_flow_types(Block* st - record_failure("too many basic blocks"); - return; - } -+#endif - if (do_flow) { - flow_block(blk, temp_vector, temp_set); - if (failing()) return; // Watch for bailouts. ---- hotspot/src/share/vm/classfile/systemDictionary.cpp.orig -+++ hotspot/src/share/vm/classfile/systemDictionary.cpp -@@ -2289,6 +2289,7 @@ methodHandle SystemDictionary::find_meth - spe = NULL; - // Must create lots of stuff here, but outside of the SystemDictionary lock. - m = Method::make_method_handle_intrinsic(iid, signature, CHECK_(empty)); -+#ifndef SHARK - if (!Arguments::is_interpreter_only()) { - // Generate a compiled form of the MH intrinsic. - AdapterHandlerLibrary::create_native_wrapper(m); -@@ -2298,6 +2299,7 @@ methodHandle SystemDictionary::find_meth - "out of space in CodeCache for method handle intrinsic", empty); - } - } -+#endif - // Now grab the lock. We might have to throw away the new method, - // if a racing thread has managed to install one at the same time. - { -@@ -2311,9 +2313,11 @@ methodHandle SystemDictionary::find_meth - } - - assert(spe != NULL && spe->method() != NULL, ""); -+#ifndef SHARK - assert(Arguments::is_interpreter_only() || (spe->method()->has_compiled_code() && - spe->method()->code()->entry_point() == spe->method()->from_compiled_entry()), - "MH intrinsic invariant"); -+#endif - return spe->method(); - } - ---- hotspot/src/share/vm/runtime/handles.inline.hpp.orig -+++ hotspot/src/share/vm/runtime/handles.inline.hpp -@@ -51,6 +51,12 @@ inline Handle::Handle(Thread* thread, oo - } - #endif // ASSERT - -+#ifdef SHARK -+#define assert_on_stack(expr) (void)(expr) -+#else -+#define assert_on_stack(expr) assert((expr), "not on stack?") -+#endif -+ - // Constructors for metadata handles - #define DEF_METADATA_HANDLE_FN(name, type) \ - inline name##Handle::name##Handle(type* obj) : _value(obj), _thread(NULL) { \ -@@ -79,7 +85,7 @@ inline name##Handle::name##Handle(const - } else { \ - _thread = Thread::current(); \ - } \ -- assert (_thread->is_in_stack((address)this), "not on stack?"); \ -+ assert_on_stack (_thread->is_in_stack((address)this)); \ - _thread->metadata_handles()->push((Metadata*)_value); \ - } else { \ - _thread = NULL; \ ---- hotspot/src/cpu/zero/vm/entry_zero.hpp.orig -+++ hotspot/src/cpu/zero/vm/entry_zero.hpp -@@ -26,6 +26,10 @@ - #ifndef CPU_ZERO_VM_ENTRY_ZERO_HPP - #define CPU_ZERO_VM_ENTRY_ZERO_HPP - -+#include "utilities/globalDefinitions.hpp" -+#include "utilities/exceptions.hpp" -+#include "interpreter/cppInterpreter.hpp" -+ - class ZeroEntry { - public: - ZeroEntry() { ---- hotspot/src/share/vm/shark/sharkEntry.hpp.orig -+++ hotspot/src/share/vm/shark/sharkEntry.hpp -@@ -27,6 +27,7 @@ - #define SHARE_VM_SHARK_SHARKENTRY_HPP - - #include "shark/llvmHeaders.hpp" -+#include "entry_zero.hpp" - - class SharkContext; - ---- hotspot/src/share/vm/interpreter/cppInterpreterGenerator.hpp.orig -+++ hotspot/src/share/vm/interpreter/cppInterpreterGenerator.hpp -@@ -30,6 +30,10 @@ - - #ifdef CC_INTERP - -+#ifdef TARGET_ARCH_zero -+#include "entry_zero.hpp" -+#endif -+ - class CppInterpreterGenerator: public AbstractInterpreterGenerator { - protected: - // shared code sequences ---- hotspot/src/cpu/zero/vm/nativeInst_zero.cpp.orig -+++ hotspot/src/cpu/zero/vm/nativeInst_zero.cpp -@@ -26,6 +26,9 @@ - #include "precompiled.hpp" - #include "assembler_zero.inline.hpp" - #include "memory/resourceArea.hpp" -+#ifdef CC_INTERP -+#include "entry_zero.hpp" -+#endif - #include "nativeInst_zero.hpp" - #include "oops/oop.inline.hpp" - #include "runtime/handles.hpp" ---- hotspot/src/share/vm/shark/llvmHeaders.hpp.orig -+++ hotspot/src/share/vm/shark/llvmHeaders.hpp -@@ -35,7 +35,11 @@ - #undef DEBUG - #endif - -+#if SHARK_LLVM_VERSION <= 34 - #include -+#else -+#include -+#endif - #include - - // includes specific to each version ---- common/autoconf/libraries.m4.orig -+++ common/autoconf/libraries.m4 -@@ -834,8 +834,9 @@ AC_DEFUN_ONCE([LIB_SETUP_STATIC_LINK_LIB - fi - fi - done -- llvm_version=$("${LLVM_CONFIG}" --version | sed 's/\.//; s/svn.*//') -+ llvm_version=$("${LLVM_CONFIG}" --version | sed 's/\.//; s/svn.*//; s/\..*$//') - LLVM_CFLAGS="${LLVM_CFLAGS} -DSHARK_LLVM_VERSION=${llvm_version}" -+ AS_IF([test $llvm_version -ge 34], [LLVM_CFLAGS="${LLVM_CFLAGS} -std=gnu++11"]) - - unset LLVM_LDFLAGS - for flag in $("${LLVM_CONFIG}" --ldflags); do -@@ -848,7 +849,7 @@ AC_DEFUN_ONCE([LIB_SETUP_STATIC_LINK_LIB - done - - unset LLVM_LIBS -- for flag in $("${LLVM_CONFIG}" --libs ${llvm_components}); do -+ for flag in $("${LLVM_CONFIG}" --libs --system-libs ${llvm_components}); do - if echo "${flag}" | grep -q '^-l'; then - if test "${LLVM_LIBS}" != ""; then - LLVM_LIBS="${LLVM_LIBS} " ---- hotspot/src/share/vm/shark/sharkIntrinsics.cpp.orig -+++ hotspot/src/share/vm/shark/sharkIntrinsics.cpp -@@ -265,7 +265,11 @@ void SharkIntrinsics::do_Unsafe_compareA - "addr"); - - // Perform the operation -+#if SHARK_LLVM_VERSION <= 34 - Value *result = builder()->CreateAtomicCmpXchg(addr, e, x, llvm::SequentiallyConsistent); -+#else -+ Value *result = builder()->CreateAtomicCmpXchg(addr, e, x, llvm::SequentiallyConsistent, llvm::SequentiallyConsistent); -+ #endif - // Push the result - state()->push( - SharkValue::create_jint( ---- hotspot/src/share/vm/shark/sharkRuntime.cpp.orig -+++ hotspot/src/share/vm/shark/sharkRuntime.cpp -@@ -32,6 +32,7 @@ - #ifdef TARGET_ARCH_zero - # include "stack_zero.inline.hpp" - #endif -+#include "memory/oopFactory.hpp" - - using namespace llvm; - ---- hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp.orig -+++ hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp -@@ -1732,7 +1732,11 @@ void SharkTopLevelBlock::do_new() { - heap_object = builder()->CreateIntToPtr( - old_top, SharkType::oop_type(), "heap_object"); - -+#if SHARK_LLVM_VERSION <= 34 - Value *check = builder()->CreateAtomicCmpXchg(top_addr, old_top, new_top, llvm::SequentiallyConsistent); -+#else -+ Value *check = builder()->CreateAtomicCmpXchg(top_addr, old_top, new_top, llvm::SequentiallyConsistent, llvm::SequentiallyConsistent); -+#endif - builder()->CreateCondBr( - builder()->CreateICmpEQ(old_top, check), - initialize, retry); -@@ -1933,7 +1937,11 @@ void SharkTopLevelBlock::acquire_lock(Va - - Value *lock = builder()->CreatePtrToInt( - monitor_header_addr, SharkType::intptr_type()); -+#if SHARK_LLVM_VERSION <= 34 - Value *check = builder()->CreateAtomicCmpXchg(mark_addr, disp, lock, llvm::Acquire); -+#else -+ Value *check = builder()->CreateAtomicCmpXchg(mark_addr, disp, lock, llvm::Acquire, llvm::Acquire); -+#endif - builder()->CreateCondBr( - builder()->CreateICmpEQ(disp, check), - acquired_fast, try_recursive); -@@ -2018,7 +2026,11 @@ void SharkTopLevelBlock::release_lock(in - PointerType::getUnqual(SharkType::intptr_type()), - "mark_addr"); - -+#if SHARK_LLVM_VERSION <= 34 - Value *check = builder()->CreateAtomicCmpXchg(mark_addr, lock, disp, llvm::Release); -+#else -+ Value *check = builder()->CreateAtomicCmpXchg(mark_addr, lock, disp, llvm::Release, llvm::Monotonic); -+#endif - builder()->CreateCondBr( - builder()->CreateICmpEQ(lock, check), - released_fast, slow_path); ---- hotspot/src/cpu/zero/vm/interpreter_zero.cpp.orig -+++ hotspot/src/cpu/zero/vm/interpreter_zero.cpp -@@ -49,7 +49,7 @@ - #ifdef COMPILER1 - #include "c1/c1_Runtime1.hpp" - #endif --#ifdef CC_INTERP -+#if defined(CC_INTERP) || defined(SHARK) - #include "interpreter/cppInterpreter.hpp" - #endif - ---- hotspot/src/share/vm/shark/sharkCompiler.hpp.orig -+++ hotspot/src/share/vm/shark/sharkCompiler.hpp -@@ -40,6 +40,8 @@ class SharkCompiler : public AbstractCom - // Creation - SharkCompiler(); - -+ void init_llvm(); -+ - // Name of this compiler - const char *name() { return "shark"; } - ---- hotspot/src/share/vm/shark/sharkCompiler.cpp.orig -+++ hotspot/src/share/vm/shark/sharkCompiler.cpp -@@ -61,11 +61,25 @@ SharkCompiler::SharkCompiler() - : AbstractCompiler() { - // Create the lock to protect the memory manager and execution engine - _execution_engine_lock = new Monitor(Mutex::leaf, "SharkExecutionEngineLock"); -- MutexLocker locker(execution_engine_lock()); -+ { -+ MutexLocker locker(execution_engine_lock()); -+ init_llvm(); -+ } -+ // All done -+ set_state(initialized); -+} - -+void SharkCompiler::init_llvm() { -+ // with llvm 3.5, Multi-threading can only be enabled/disabled with the -+ // compile time define LLVM_ENABLE_THREADS -+#if SHARK_LLVM_VERSION <= 34 - // Make LLVM safe for multithreading - if (!llvm_start_multithreaded()) - fatal("llvm_start_multithreaded() failed"); -+#else -+ if (!llvm_is_multithreaded()) -+ fatal("llvm_is_multithreaded() tells no multithreading support in llvm"); -+#endif - - // Initialize the native target - InitializeNativeTarget(); -@@ -83,7 +97,7 @@ SharkCompiler::SharkCompiler() - // Finetune LLVM for the current host CPU. - StringMap Features; - bool gotCpuFeatures = llvm::sys::getHostCPUFeatures(Features); -- std::string cpu("-mcpu=" + llvm::sys::getHostCPUName()); -+ std::string cpu("-mcpu=" + std::string(llvm::sys::getHostCPUName())); - - std::vector args; - args.push_back(""); // program name -@@ -112,6 +126,9 @@ SharkCompiler::SharkCompiler() - builder.setMAttrs(MAttrs); - builder.setJITMemoryManager(memory_manager()); - builder.setEngineKind(EngineKind::JIT); -+#if SHARK_LLVM_VERSION > 34 -+ builder.setUseMCJIT(true); -+#endif - builder.setErrorStr(&ErrorMsg); - if (! fnmatch(SharkOptimizationLevel, "None", 0)) { - tty->print_cr("Shark optimization level set to: None"); -@@ -133,10 +150,11 @@ SharkCompiler::SharkCompiler() - exit(1); - } - -+#if SHARK_LLVM_VERSION > 34 -+ _native_context->execution_engine(_execution_engine); -+ _normal_context->execution_engine(_execution_engine); -+#endif - execution_engine()->addModule(_native_context->module()); -- -- // All done -- set_state(initialized); - } - - void SharkCompiler::initialize() { -@@ -165,7 +183,7 @@ void SharkCompiler::compile_method(ciEnv - } - - // Create the recorders -- Arena arena; -+ Arena arena(mtCompiler); - env->set_oop_recorder(new OopRecorder(&arena)); - OopMapSet oopmaps; - env->set_debug_info(new DebugInformationRecorder(env->oop_recorder())); -@@ -268,7 +286,12 @@ void SharkCompiler::generate_native_code - - if (SharkVerifyFunction != NULL) { - if (!fnmatch(SharkVerifyFunction, name, 0)) { -+#if SHARK_LLVM_VERSION <= 34 - verifyFunction(*function); -+#else -+ LLVMValueRef F = wrap(function); -+ LLVMVerifyFunction(F, LLVMAbortProcessAction); -+#endif - } - } - -@@ -298,7 +321,11 @@ void SharkCompiler::generate_native_code - #endif - #endif // !NDEBUG - memory_manager()->set_entry_for_function(function, entry); -+#if SHARK_LLVM_VERSION <= 34 - code = (address) execution_engine()->getPointerToFunction(function); -+#else -+ code = (address) execution_engine()->getFunctionAddress(name); -+#endif - } - assert(code != NULL, "code must be != NULL"); - entry->set_entry_point(code); ---- hotspot/src/share/vm/shark/sharkContext.cpp.orig -+++ hotspot/src/share/vm/shark/sharkContext.cpp -@@ -34,8 +34,13 @@ - using namespace llvm; - - SharkContext::SharkContext(const char* name) -- : LLVMContext(), -- _free_queue(NULL) { -+ : LLVMContext() -+ , _free_queue(0) -+#if SHARK_LLVM_VERSION > 34 -+ , _ee(0) -+ , func_mod_map() -+#endif -+{ - // Create a module to build our functions into - _module = new Module(name, *this); - ---- hotspot/src/share/vm/shark/sharkContext.hpp.orig -+++ hotspot/src/share/vm/shark/sharkContext.hpp -@@ -29,6 +29,8 @@ - #include "shark/llvmHeaders.hpp" - #include "shark/sharkCompiler.hpp" - -+#include -+ - // The LLVMContext class allows multiple instances of LLVM to operate - // independently of each other in a multithreaded context. We extend - // this here to store things in Shark that are LLVMContext-specific. -@@ -41,12 +43,28 @@ class SharkContext : public llvm::LLVMCo - - private: - llvm::Module* _module; -+#if SHARK_LLVM_VERSION > 34 -+ llvm::ExecutionEngine *_ee; -+ std::map func_mod_map; -+#endif - - public: - llvm::Module* module() const { - return _module; - } - -+#if SHARK_LLVM_VERSION > 34 -+ llvm::ExecutionEngine *execution_engine(llvm::ExecutionEngine *ee) { -+ llvm::ExecutionEngine *oee = _ee; -+ _ee = ee; -+ return oee; -+ } -+ -+ llvm::ExecutionEngine *execution_engine() const { -+ return _ee; -+ } -+#endif -+ - // Get this thread's SharkContext - public: - static SharkContext& current() { -@@ -55,12 +73,35 @@ class SharkContext : public llvm::LLVMCo - - // Module accessors - public: -- void add_function(llvm::Function* function) const { -+ void add_function(llvm::Function* function) { -+#if SHARK_LLVM_VERSION <= 34 - module()->getFunctionList().push_back(function); -+#else -+ // shark compiles modules, not functions -+ std::map::iterator i = func_mod_map.find(function->getName().str()); -+ if(func_mod_map.end() == i) { -+ llvm::Module *mod4fun = new llvm::Module(function->getName(), *this); -+ func_mod_map.insert(std::pair(function->getName().str(), mod4fun)); -+ mod4fun->getFunctionList().push_back(function); -+ _ee->addModule(mod4fun); -+ } -+#endif - } - llvm::Constant* get_external(const char* name, - llvm::FunctionType* sig) { -+ // XXX see whether we need additional module map, too -+#if SHARK_LLVM_VERSION <= 34 - return module()->getOrInsertFunction(name, sig); -+#else -+ // shark compiles modules, not functions -+ std::map::iterator i = func_mod_map.find(name); -+ if(func_mod_map.end() == i) { -+ llvm::Module *mod4fun = new llvm::Module(name, *this); -+ func_mod_map.insert(std::pair(name, mod4fun)); -+ mod4fun->getOrInsertFunction(name, sig); -+ _ee->addModule(mod4fun); -+ } -+#endif - } - - // Basic types -- cgit v1.2.3-54-g00ecf