mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-08-05 21:37:15 +02:00
73 lines
2.4 KiB
Diff
73 lines
2.4 KiB
Diff
diff --git a/config.h.in b/config.h.in
|
|
index 8c98c2f..64a045e 100644
|
|
--- a/config.h.in
|
|
+++ b/config.h.in
|
|
@@ -466,6 +466,9 @@
|
|
/* Define if the host is an Itanium */
|
|
#undef HOSTARCHITECTURE_IA64
|
|
|
|
+/* Define if the host is a LoongArch (64-bit) */
|
|
+#undef HOSTARCHITECTURE_LOONGARCH64
|
|
+
|
|
/* Define if the host is a Motorola 68000 */
|
|
#undef HOSTARCHITECTURE_M68K
|
|
|
|
diff --git a/configure b/configure
|
|
index 5bc938b..454f223 100755
|
|
--- a/configure
|
|
+++ b/configure
|
|
@@ -23512,6 +23512,12 @@ printf "%s\n" "#define HOSTARCHITECTURE_RISCV32 1" >>confdefs.h
|
|
|
|
printf "%s\n" "#define HOSTARCHITECTURE_RISCV64 1" >>confdefs.h
|
|
|
|
+ polyarch=interpret
|
|
+ ;;
|
|
+ loongarch64)
|
|
+
|
|
+printf "%s\n" "#define HOSTARCHITECTURE_LOONGARCH64 1" >>confdefs.h
|
|
+
|
|
polyarch=interpret
|
|
;;
|
|
*) as_fn_error $? "Poly/ML is not supported for this architecture" "$LINENO" 5 ;;
|
|
diff --git a/configure.ac b/configure.ac
|
|
index e48afb7..fc1d3ed 100644
|
|
--- a/configure.ac
|
|
+++ b/configure.ac
|
|
@@ -452,6 +452,10 @@ case "${host_cpu}" in
|
|
AC_DEFINE([HOSTARCHITECTURE_RISCV64], [1], [Define if the host is a RISC-V (64-bit)])
|
|
polyarch=interpret
|
|
;;
|
|
+ loongarch64)
|
|
+ AC_DEFINE([HOSTARCHITECTURE_LOONGARCH64], [1], [Define if the host is a LoongArch (64-bit)])
|
|
+ polyarch=interpret
|
|
+ ;;
|
|
*) AC_MSG_ERROR([Poly/ML is not supported for this architecture]) ;;
|
|
esac
|
|
|
|
diff --git a/libpolyml/elfexport.cpp b/libpolyml/elfexport.cpp
|
|
index 13a2c43..ec16594 100644
|
|
--- a/libpolyml/elfexport.cpp
|
|
+++ b/libpolyml/elfexport.cpp
|
|
@@ -286,6 +286,21 @@
|
|
# endif
|
|
# define HOST_E_FLAGS (HOST_E_FLAGS_FLOAT_ABI | HOST_E_FLAGS_RVE)
|
|
# define USE_RELA 1
|
|
+#elif defined(HOSTARCHITECTURE_LOONGARCH64)
|
|
+# define HOST_E_MACHINE EM_LOONGARCH
|
|
+# define HOST_DIRECT_DATA_RELOC R_LARCH_64
|
|
+# define HOST_DIRECT_FPTR_RELOC R_LARCH_64
|
|
+# if defined(__loongarch_soft_float)
|
|
+# define HOST_E_FLAGS_FLOAT_ABI EF_LARCH_ABI_SOFT_FLOAT
|
|
+# elif defined(__loongarch_single_float)
|
|
+# define HOST_E_FLAGS_FLOAT_ABI EF_LARCH_ABI_SINGLE_FLOAT
|
|
+# elif defined(__loongarch_double_float)
|
|
+# define HOST_E_FLAGS_FLOAT_ABI EF_LARCH_ABI_DOUBLE_FLOAT
|
|
+# else
|
|
+# error "Unknown LoongArch float ABI"
|
|
+# endif
|
|
+# define HOST_E_FLAGS (HOST_E_FLAGS_FLOAT_ABI | EF_LARCH_OBJABI_V1)
|
|
+# define USE_RELA 1
|
|
#else
|
|
# error "No support for exporting on this architecture"
|
|
#endif
|