8073139: PPC64: User-visible arch directory and os.arch value on ppc64le cause issues with Java tooling

Set LIBARCH to ppc64le, make SA and hsdis work, have os.arch return ppc64le on PowerPC64 LE

Co-authored-by: Andrew Hughes <gnu.andrew@redhat.com>
Reviewed-by: dholmes, ihse
This commit is contained in:
Alexander Smundak 2015-12-13 22:32:16 -05:00
parent 2c980f2f84
commit 74f0500a47
10 changed files with 37 additions and 16 deletions

View File

@ -49,7 +49,7 @@
#include "sun_jvm_hotspot_debugger_sparc_SPARCThreadContext.h"
#endif
#ifdef ppc64
#if defined(ppc64) || defined(ppc64le)
#include "sun_jvm_hotspot_debugger_ppc64_PPC64ThreadContext.h"
#endif
@ -352,7 +352,7 @@ JNIEXPORT jbyteArray JNICALL Java_sun_jvm_hotspot_debugger_linux_LinuxDebuggerLo
return (err == PS_OK)? array : 0;
}
#if defined(i386) || defined(amd64) || defined(sparc) || defined(sparcv9) | defined(ppc64) || defined(aarch64)
#if defined(i386) || defined(amd64) || defined(sparc) || defined(sparcv9) | defined(ppc64) || defined(ppc64le) || defined(aarch64)
JNIEXPORT jlongArray JNICALL Java_sun_jvm_hotspot_debugger_linux_LinuxDebuggerLocal_getThreadIntegerRegisterSet0
(JNIEnv *env, jobject this_obj, jint lwp_id) {
@ -380,7 +380,7 @@ JNIEXPORT jlongArray JNICALL Java_sun_jvm_hotspot_debugger_linux_LinuxDebuggerLo
#if defined(sparc) || defined(sparcv9)
#define NPRGREG sun_jvm_hotspot_debugger_sparc_SPARCThreadContext_NPRGREG
#endif
#ifdef ppc64
#if defined(ppc64) || defined(ppc64le)
#define NPRGREG sun_jvm_hotspot_debugger_ppc64_PPC64ThreadContext_NPRGREG
#endif
@ -489,7 +489,7 @@ JNIEXPORT jlongArray JNICALL Java_sun_jvm_hotspot_debugger_linux_LinuxDebuggerLo
}
#endif /* aarch64 */
#ifdef ppc64
#if defined(ppc64) || defined(ppc64le)
#define REG_INDEX(reg) sun_jvm_hotspot_debugger_ppc64_PPC64ThreadContext_##reg
regs[REG_INDEX(LR)] = gregs.link;

View File

@ -68,7 +68,7 @@ combination of ptrace and /proc calls.
*************************************************************************************/
#if defined(sparc) || defined(sparcv9) || defined(ppc64)
#if defined(sparc) || defined(sparcv9) || defined(ppc64) || defined(ppc64le)
#include <asm/ptrace.h>
#define user_regs_struct pt_regs
#endif

View File

@ -54,7 +54,7 @@ public class PlatformInfo {
public static boolean knownCPU(String cpu) {
final String[] KNOWN =
new String[] {"i386", "x86", "x86_64", "amd64", "sparc", "sparcv9", "ppc64", "aarch64"};
new String[] {"i386", "x86", "x86_64", "amd64", "sparc", "sparcv9", "ppc64", "ppc64le", "aarch64"};
for(String s : KNOWN) {
if(s.equals(cpu))
@ -98,6 +98,9 @@ public class PlatformInfo {
if (cpu.equals("x86_64"))
return "amd64";
if (cpu.equals("ppc64le"))
return "ppc64";
return cpu;
}

View File

@ -277,7 +277,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 aarch64 zero,$(ARCH)))
SRCARCH ?= $(ARCH/$(filter sparc sparc64 ia64 amd64 x86_64 ppc ppc64 ppc64le aarch64 zero,$(ARCH)))
ARCH/ = x86
ARCH/sparc = sparc
ARCH/sparc64= sparc
@ -285,6 +285,7 @@ ifneq ($(OSNAME),windows)
ARCH/amd64 = x86
ARCH/x86_64 = x86
ARCH/ppc64 = ppc
ARCH/ppc64le= ppc
ARCH/ppc = ppc
ARCH/aarch64= aarch64
ARCH/zero = zero
@ -309,8 +310,13 @@ ifneq ($(OSNAME),windows)
endif
endif
# LIBARCH is 1:1 mapping from BUILDARCH
LIBARCH ?= $(LIBARCH/$(BUILDARCH))
# LIBARCH is 1:1 mapping from BUILDARCH, except for ARCH=ppc64le
ifeq ($(ARCH),ppc64le)
LIBARCH ?= ppc64le
else
LIBARCH ?= $(LIBARCH/$(BUILDARCH))
endif
LIBARCH/i486 = i386
LIBARCH/amd64 = amd64
LIBARCH/sparc = sparc

View File

@ -1733,7 +1733,7 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen) {
#if defined(VM_LITTLE_ENDIAN)
{EM_PPC64, EM_PPC64, ELFCLASS64, ELFDATA2LSB, (char*)"Power PC 64"},
#else
{EM_PPC64, EM_PPC64, ELFCLASS64, ELFDATA2MSB, (char*)"Power PC 64"},
{EM_PPC64, EM_PPC64, ELFCLASS64, ELFDATA2MSB, (char*)"Power PC 64 LE"},
#endif
{EM_ARM, EM_ARM, ELFCLASS32, ELFDATA2LSB, (char*)"ARM"},
{EM_S390, EM_S390, ELFCLASSNONE, ELFDATA2MSB, (char*)"IBM System/390"},
@ -2177,6 +2177,8 @@ void os::pd_print_cpu_info(outputStream* st, char* buf, size_t buflen) {
const char* search_string = "model name";
#elif defined(SPARC)
const char* search_string = "cpu";
#elif defined(PPC64)
const char* search_string = "cpu";
#else
const char* search_string = "Processor";
#endif

View File

@ -70,12 +70,12 @@ CONFIGURE_ARGS= --host=$(MINGW) --target=$(MINGW)
else #linux
CPU = $(shell uname -m)
ARCH1=$(CPU:x86_64=amd64)
ARCH2=$(ARCH1:i686=i386)
ARCH=$(ARCH2:ppc64le=ppc64)
ARCH=$(ARCH1:i686=i386)
ifdef LP64
CFLAGS/sparcv9 += -m64
CFLAGS/amd64 += -m64
CFLAGS/ppc64 += -m64
CFLAGS/ppc64le += -m64 -DABI_ELFv2
else
ARCH=$(ARCH1:amd64=i386)
CFLAGS/i386 += -m32

View File

@ -66,7 +66,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);

View File

@ -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
#ifdef LIBARCH_aarch64

View File

@ -170,14 +170,19 @@ 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
#endif //
#endif
const char *Abstract_VM_Version::vm_platform_string() {

View File

@ -192,6 +192,11 @@ then
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}