Skip to content

Commit e92e2fd

Browse files
theaoqishipilev
authored andcommittedJul 15, 2021
8270517: Add Zero support for LoongArch
Reviewed-by: dholmes, erikj, shade
1 parent 7a89ffe commit e92e2fd

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed
 

‎make/autoconf/build-aux/config.guess

+9
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,15 @@ if [ "x$OUT" = x ]; then
102102
fi
103103
fi
104104

105+
# Test and fix LoongArch64.
106+
if [ "x$OUT" = x ]; then
107+
if [ `uname -s` = Linux ]; then
108+
if [ `uname -m` = loongarch64 ]; then
109+
OUT=loongarch64-unknown-linux-gnu
110+
fi
111+
fi
112+
fi
113+
105114
# Test and fix cpu on macos-aarch64, uname -p reports arm, buildsys expects aarch64
106115
echo $OUT | grep arm-apple-darwin > /dev/null 2> /dev/null
107116
if test $? != 0; then

‎make/autoconf/platform.m4

+6
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,12 @@ AC_DEFUN([PLATFORM_EXTRACT_VARS_FROM_CPU],
7272
VAR_CPU_BITS=64
7373
VAR_CPU_ENDIAN=little
7474
;;
75+
loongarch64)
76+
VAR_CPU=loongarch64
77+
VAR_CPU_ARCH=loongarch
78+
VAR_CPU_BITS=64
79+
VAR_CPU_ENDIAN=little
80+
;;
7581
m68k)
7682
VAR_CPU=m68k
7783
VAR_CPU_ARCH=m68k

‎src/hotspot/os/linux/os_linux.cpp

+7-1
Original file line numberDiff line numberDiff line change
@@ -1668,6 +1668,9 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen) {
16681668
#ifndef EM_RISCV
16691669
#define EM_RISCV 243 /* RISC-V */
16701670
#endif
1671+
#ifndef EM_LOONGARCH
1672+
#define EM_LOONGARCH 258 /* LoongArch */
1673+
#endif
16711674

16721675
static const arch_t arch_array[]={
16731676
{EM_386, EM_386, ELFCLASS32, ELFDATA2LSB, (char*)"IA 32"},
@@ -1695,6 +1698,7 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen) {
16951698
{EM_68K, EM_68K, ELFCLASS32, ELFDATA2MSB, (char*)"M68k"},
16961699
{EM_AARCH64, EM_AARCH64, ELFCLASS64, ELFDATA2LSB, (char*)"AARCH64"},
16971700
{EM_RISCV, EM_RISCV, ELFCLASS64, ELFDATA2LSB, (char*)"RISC-V"},
1701+
{EM_LOONGARCH, EM_LOONGARCH, ELFCLASS64, ELFDATA2LSB, (char*)"LoongArch"},
16981702
};
16991703

17001704
#if (defined IA32)
@@ -1731,9 +1735,11 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen) {
17311735
static Elf32_Half running_arch_code=EM_SH;
17321736
#elif (defined RISCV)
17331737
static Elf32_Half running_arch_code=EM_RISCV;
1738+
#elif (defined LOONGARCH)
1739+
static Elf32_Half running_arch_code=EM_LOONGARCH;
17341740
#else
17351741
#error Method os::dll_load requires that one of following is defined:\
1736-
AARCH64, ALPHA, ARM, AMD64, IA32, IA64, M68K, MIPS, MIPSEL, PARISC, __powerpc__, __powerpc64__, RISCV, S390, SH, __sparc
1742+
AARCH64, ALPHA, ARM, AMD64, IA32, IA64, LOONGARCH, M68K, MIPS, MIPSEL, PARISC, __powerpc__, __powerpc64__, RISCV, S390, SH, __sparc
17371743
#endif
17381744

17391745
// Identify compatibility class for VM's architecture and library's architecture

1 commit comments

Comments
 (1)

openjdk-notifier[bot] commented on Jul 15, 2021

@openjdk-notifier[bot]
Please sign in to comment.