From 6e5e9832e2e8b509f8199b58465a79ad618e78bc Mon Sep 17 00:00:00 2001 From: sgehwolf Date: Tue, 25 Sep 2018 16:23:35 +0200 Subject: [PATCH] 8073139: PPC64: User-visible arch directory and os.arch value on ppc64le cause issues with Java tooling Reviewed-by: erikj, goetz, dholmes --- make/defs.make | 10 ++++++++-- src/os/linux/vm/os_linux.cpp | 2 +- src/share/tools/hsdis/Makefile | 1 + src/share/tools/hsdis/hsdis-demo.c | 2 +- src/share/tools/hsdis/hsdis.c | 2 +- src/share/vm/runtime/vm_version.cpp | 7 ++++++- test/test_env.sh | 9 +++++++++ 7 files changed, 27 insertions(+), 6 deletions(-) diff --git a/make/defs.make b/make/defs.make index b5a41239c..1e97a4cb8 100644 --- a/make/defs.make +++ b/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,$(ARCH))) + SRCARCH ?= $(ARCH/$(filter sparc sparc64 ia64 amd64 x86_64 ppc ppc64 ppc64le zero,$(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 @@ -316,7 +317,12 @@ ifneq ($(OSNAME),windows) 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 index d297445dc..387ff0364 100644 --- a/src/os/linux/vm/os_linux.cpp +++ b/src/os/linux/vm/os_linux.cpp @@ -1956,7 +1956,7 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen) {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 index 35e96d8a3..0d1b60894 100644 --- a/src/share/tools/hsdis/Makefile +++ b/src/share/tools/hsdis/Makefile @@ -97,6 +97,7 @@ ifdef LP64 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 index 3037a4b7b..0ab3018ed 100644 --- a/src/share/tools/hsdis/hsdis-demo.c +++ b/src/share/tools/hsdis/hsdis-demo.c @@ -88,7 +88,7 @@ int main(int ac, char** av) { 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 index 430de855b..7bef1040f 100644 --- a/src/share/tools/hsdis/hsdis.c +++ b/src/share/tools/hsdis/hsdis.c @@ -488,7 +488,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 if (res == NULL) diff --git a/src/share/vm/runtime/vm_version.cpp b/src/share/vm/runtime/vm_version.cpp index e93a01c51..25f319f0b 100644 --- a/src/share/vm/runtime/vm_version.cpp +++ b/src/share/vm/runtime/vm_version.cpp @@ -184,11 +184,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") \ SPARC_ONLY("sparc") #endif // ZERO #endif diff --git a/test/test_env.sh b/test/test_env.sh index 27c653bf1..e76796e71 100644 --- a/test/test_env.sh +++ b/test/test_env.sh @@ -185,6 +185,15 @@ grep "ppc" vm_version.out > ${NULL} 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 ] -- GitLab