Skip to content

8270517: Add Zero support for LoongArch #413

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions common/autoconf/build-aux/config.guess
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,13 @@ 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

echo $OUT
28 changes: 26 additions & 2 deletions common/autoconf/generated-configure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1017,6 +1017,7 @@ infodir
docdir
oldincludedir
includedir
runstatedir
localstatedir
sharedstatedir
sysconfdir
Expand Down Expand Up @@ -1262,6 +1263,7 @@ datadir='${datarootdir}'
sysconfdir='${prefix}/etc'
sharedstatedir='${prefix}/com'
localstatedir='${prefix}/var'
runstatedir='${localstatedir}/run'
includedir='${prefix}/include'
oldincludedir='/usr/include'
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
Expand Down Expand Up @@ -1514,6 +1516,15 @@ do
| -silent | --silent | --silen | --sile | --sil)
silent=yes ;;

-runstatedir | --runstatedir | --runstatedi | --runstated \
| --runstate | --runstat | --runsta | --runst | --runs \
| --run | --ru | --r)
ac_prev=runstatedir ;;
-runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
| --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
| --run=* | --ru=* | --r=*)
runstatedir=$ac_optarg ;;

-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
ac_prev=sbindir ;;
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
Expand Down Expand Up @@ -1651,7 +1662,7 @@ fi
for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
datadir sysconfdir sharedstatedir localstatedir includedir \
oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
libdir localedir mandir
libdir localedir mandir runstatedir
do
eval ac_val=\$$ac_var
# Remove trailing slashes.
Expand Down Expand Up @@ -1804,6 +1815,7 @@ Fine tuning of the installation directories:
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
--runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run]
--libdir=DIR object code libraries [EPREFIX/lib]
--includedir=DIR C header files [PREFIX/include]
--oldincludedir=DIR C header files for non-gcc [/usr/include]
Expand Down Expand Up @@ -4428,7 +4440,7 @@ VS_TOOLSET_SUPPORTED_2022=true
#CUSTOM_AUTOCONF_INCLUDE

# Do not change or remove the following line, it is needed for consistency checks:
DATE_WHEN_GENERATED=1694011184
DATE_WHEN_GENERATED=1704508692

###############################################################################
#
Expand Down Expand Up @@ -13918,6 +13930,12 @@ test -n "$target_alias" &&
VAR_CPU_BITS=64
VAR_CPU_ENDIAN=big
;;
loongarch64)
VAR_CPU=loongarch64
VAR_CPU_ARCH=loongarch
VAR_CPU_BITS=64
VAR_CPU_ENDIAN=little
;;
*)
as_fn_error $? "unsupported cpu $build_cpu" "$LINENO" 5
;;
Expand Down Expand Up @@ -14056,6 +14074,12 @@ $as_echo "$OPENJDK_BUILD_OS-$OPENJDK_BUILD_CPU" >&6; }
VAR_CPU_BITS=64
VAR_CPU_ENDIAN=big
;;
loongarch64)
VAR_CPU=loongarch64
VAR_CPU_ARCH=loongarch
VAR_CPU_BITS=64
VAR_CPU_ENDIAN=little
;;
*)
as_fn_error $? "unsupported cpu $host_cpu" "$LINENO" 5
;;
Expand Down
6 changes: 6 additions & 0 deletions common/autoconf/platform.m4
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,12 @@ AC_DEFUN([PLATFORM_EXTRACT_VARS_FROM_CPU],
VAR_CPU_BITS=64
VAR_CPU_ENDIAN=big
;;
loongarch64)
VAR_CPU=loongarch64
VAR_CPU_ARCH=loongarch
VAR_CPU_BITS=64
VAR_CPU_ENDIAN=little
;;
*)
AC_MSG_ERROR([unsupported cpu $1])
;;
Expand Down
8 changes: 7 additions & 1 deletion hotspot/src/os/linux/vm/os_linux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1949,6 +1949,9 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen)
#ifndef EM_AARCH64
#define EM_AARCH64 183 /* ARM AARCH64 */
#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"},
Expand All @@ -1972,6 +1975,7 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen)
{EM_PARISC, EM_PARISC, ELFCLASS32, ELFDATA2MSB, (char*)"PARISC"},
{EM_68K, EM_68K, ELFCLASS32, ELFDATA2MSB, (char*)"M68k"},
{EM_AARCH64, EM_AARCH64, ELFCLASS64, ELFDATA2LSB, (char*)"AARCH64"},
{EM_LOONGARCH, EM_LOONGARCH, ELFCLASS64, ELFDATA2LSB, (char*)"LoongArch"},
};

#if (defined IA32)
Expand Down Expand Up @@ -2004,9 +2008,11 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen)
static Elf32_Half running_arch_code=EM_68K;
#elif (defined AARCH64)
static Elf32_Half running_arch_code=EM_AARCH64;
#elif (defined LOONGARCH)
static Elf32_Half running_arch_code=EM_LOONGARCH;
#else
#error Method os::dll_load requires that one of following is defined:\
IA32, AMD64, IA64, __sparc, __powerpc__, ARM, S390, ALPHA, MIPS, MIPSEL, PARISC, M68K, AARCH64
IA32, AMD64, IA64, __sparc, __powerpc__, ARM, S390, ALPHA, MIPS, MIPSEL, PARISC, M68K, AARCH64, LOONGARCH
#endif

// Identify compatability class for VM's architecture and library's architecture
Expand Down