# HG changeset patch # User sgehwolf # Date 1537885415 -7200 # Tue Sep 25 16:23:35 2018 +0200 # Node ID 5044428520866481f438bfd1375da75adbc89243 # Parent a3df1579a8647b06559f41d345da7bea162b26e9 8073139: PPC64: User-visible arch directory and os.arch value on ppc64le cause issues with Java tooling Reviewed-by: erikj, goetz, dholmes diff --git a/make/defs.make b/make/defs.make --- openjdk/hotspot/make/defs.make +++ openjdk/hotspot/make/defs.make @@ -285,7 +285,7 @@ ifneq ($(OSNAME),windows) # Use uname output for SRCARCH, but deal with platform differences. If ARCH # is not explicitly listed below, it is treated as x86. - SRCARCH ?= $(ARCH/$(filter sparc sparc64 ia64 amd64 x86_64 ppc ppc64 zero aarch64,$(ARCH))) + SRCARCH ?= $(ARCH/$(filter sparc sparc64 ia64 amd64 x86_64 ppc ppc64 ppc64le zero aarch64,$(ARCH))) ARCH/ = x86 ARCH/sparc = sparc ARCH/sparc64= sparc @@ -293,6 +293,7 @@ ifneq ($(OSNAME),windows) ARCH/amd64 = x86 ARCH/x86_64 = x86 ARCH/ppc64 = ppc + ARCH/ppc64le= ppc ARCH/ppc = ppc ARCH/zero = zero ARCH/aarch64 = aarch64 @@ -316,7 +317,12 @@ endif endif - # LIBARCH is 1:1 mapping from BUILDARCH + # LIBARCH is 1:1 mapping from BUILDARCH, except for ARCH=ppc64le + ifeq ($(ARCH),ppc64le) + LIBARCH ?= ppc64le + else + LIBARCH ?= $(LIBARCH/$(BUILDARCH)) + endif LIBARCH ?= $(LIBARCH/$(BUILDARCH)) LIBARCH/i486 = i386 LIBARCH/amd64 = amd64 diff --git a/src/os/linux/vm/os_linux.cpp b/src/os/linux/vm/os_linux.cpp --- openjdk/hotspot/src/os/linux/vm/os_linux.cpp +++ openjdk/hotspot/src/os/linux/vm/os_linux.cpp @@ -1956,7 +1956,7 @@ {EM_SPARCV9, EM_SPARCV9, ELFCLASS64, ELFDATA2MSB, (char*)"Sparc v9 64"}, {EM_PPC, EM_PPC, ELFCLASS32, ELFDATA2MSB, (char*)"Power PC 32"}, #if defined(VM_LITTLE_ENDIAN) - {EM_PPC64, EM_PPC64, ELFCLASS64, ELFDATA2LSB, (char*)"Power PC 64"}, + {EM_PPC64, EM_PPC64, ELFCLASS64, ELFDATA2LSB, (char*)"Power PC 64 LE"}, #else {EM_PPC64, EM_PPC64, ELFCLASS64, ELFDATA2MSB, (char*)"Power PC 64"}, #endif diff --git a/src/share/tools/hsdis/Makefile b/src/share/tools/hsdis/Makefile --- openjdk/hotspot/src/share/tools/hsdis/Makefile +++ openjdk/hotspot/src/share/tools/hsdis/Makefile @@ -97,6 +97,7 @@ CFLAGS/sparcv9 += -m64 CFLAGS/amd64 += -m64 CFLAGS/ppc64 += -m64 +CFLAGS/ppc64le += -m64 -DABI_ELFv2 else ARCH=$(ARCH1:amd64=i386) CFLAGS/i386 += -m32 diff --git a/src/share/tools/hsdis/hsdis-demo.c b/src/share/tools/hsdis/hsdis-demo.c --- openjdk/hotspot/src/share/tools/hsdis/hsdis-demo.c +++ openjdk/hotspot/src/share/tools/hsdis/hsdis-demo.c @@ -88,7 +88,7 @@ printf("...And now for something completely different:\n"); void *start = (void*) &main; void *end = (void*) &end_of_file; -#if defined(__ia64) || defined(__powerpc__) +#if defined(__ia64) || (defined(__powerpc__) && !defined(ABI_ELFv2)) /* On IA64 and PPC function pointers are pointers to function descriptors */ start = *((void**)start); end = *((void**)end); diff --git a/src/share/tools/hsdis/hsdis.c b/src/share/tools/hsdis/hsdis.c --- openjdk/hotspot/src/share/tools/hsdis/hsdis.c +++ openjdk/hotspot/src/share/tools/hsdis/hsdis.c @@ -461,7 +461,7 @@ static const char* native_arch_name() { #ifdef LIBARCH_sparcv9 res = "sparc:v9b"; #endif -#ifdef LIBARCH_ppc64 +#if defined(LIBARCH_ppc64) || defined(LIBARCH_ppc64le) res = "powerpc:common64"; #endif #else diff --git a/src/share/vm/runtime/vm_version.cpp b/src/share/vm/runtime/vm_version.cpp --- openjdk/hotspot/src/share/vm/runtime/vm_version.cpp +++ openjdk/hotspot/src/share/vm/runtime/vm_version.cpp @@ -187,11 +187,16 @@ const char* Abstract_VM_Version::jre_release_version() { #ifndef CPU #ifdef ZERO #define CPU ZERO_LIBARCH +#elif defined(PPC64) +#if defined(VM_LITTLE_ENDIAN) +#define CPU "ppc64le" +#else +#define CPU "ppc64" +#endif #else #define CPU IA32_ONLY("x86") \ IA64_ONLY("ia64") \ AMD64_ONLY("amd64") \ - PPC64_ONLY("ppc64") \ AARCH64_ONLY("aarch64") \ SPARC_ONLY("sparc") #endif // ZERO diff --git a/test/test_env.sh b/test/test_env.sh --- openjdk/hotspot/test/test_env.sh +++ openjdk/hotspot/test/test_env.sh @@ -185,6 +185,15 @@ if [ $? = 0 ] then VM_CPU="ppc" + if [ $VM_BITS = "64" ] + then + VM_CPU="ppc64" + grep "ppc64le" vm_version.out > ${NULL} + if [ $? = 0 ] + then + VM_CPU="ppc64le" + fi + fi fi grep "ia64" vm_version.out > ${NULL} if [ $? = 0 ]