8270517: Add Zero support for LoongArch

Reviewed-by: dholmes, erikj, shade
This commit is contained in:
Ao Qi 2021-07-15 08:26:05 +00:00 committed by Aleksey Shipilev
parent 7a89ffeddd
commit e92e2fd4e0
3 changed files with 22 additions and 1 deletions

View File

@ -102,6 +102,15 @@ if [ "x$OUT" = x ]; then
fi
fi
# Test and fix LoongArch64.
if [ "x$OUT" = x ]; then
if [ `uname -s` = Linux ]; then
if [ `uname -m` = loongarch64 ]; then
OUT=loongarch64-unknown-linux-gnu
fi
fi
fi
# Test and fix cpu on macos-aarch64, uname -p reports arm, buildsys expects aarch64
echo $OUT | grep arm-apple-darwin > /dev/null 2> /dev/null
if test $? != 0; then

View File

@ -72,6 +72,12 @@ AC_DEFUN([PLATFORM_EXTRACT_VARS_FROM_CPU],
VAR_CPU_BITS=64
VAR_CPU_ENDIAN=little
;;
loongarch64)
VAR_CPU=loongarch64
VAR_CPU_ARCH=loongarch
VAR_CPU_BITS=64
VAR_CPU_ENDIAN=little
;;
m68k)
VAR_CPU=m68k
VAR_CPU_ARCH=m68k

View File

@ -1668,6 +1668,9 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen) {
#ifndef EM_RISCV
#define EM_RISCV 243 /* RISC-V */
#endif
#ifndef EM_LOONGARCH
#define EM_LOONGARCH 258 /* LoongArch */
#endif
static const arch_t arch_array[]={
{EM_386, EM_386, ELFCLASS32, ELFDATA2LSB, (char*)"IA 32"},
@ -1695,6 +1698,7 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen) {
{EM_68K, EM_68K, ELFCLASS32, ELFDATA2MSB, (char*)"M68k"},
{EM_AARCH64, EM_AARCH64, ELFCLASS64, ELFDATA2LSB, (char*)"AARCH64"},
{EM_RISCV, EM_RISCV, ELFCLASS64, ELFDATA2LSB, (char*)"RISC-V"},
{EM_LOONGARCH, EM_LOONGARCH, ELFCLASS64, ELFDATA2LSB, (char*)"LoongArch"},
};
#if (defined IA32)
@ -1731,9 +1735,11 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen) {
static Elf32_Half running_arch_code=EM_SH;
#elif (defined RISCV)
static Elf32_Half running_arch_code=EM_RISCV;
#elif (defined LOONGARCH)
static Elf32_Half running_arch_code=EM_LOONGARCH;
#else
#error Method os::dll_load requires that one of following is defined:\
AARCH64, ALPHA, ARM, AMD64, IA32, IA64, M68K, MIPS, MIPSEL, PARISC, __powerpc__, __powerpc64__, RISCV, S390, SH, __sparc
AARCH64, ALPHA, ARM, AMD64, IA32, IA64, LOONGARCH, M68K, MIPS, MIPSEL, PARISC, __powerpc__, __powerpc64__, RISCV, S390, SH, __sparc
#endif
// Identify compatibility class for VM's architecture and library's architecture