Merge pull request #229183 from jackyliu16/loongarch-support-cpython

cpython: add loongarch triplets
This commit is contained in:
Weijia Wang 2023-05-01 13:33:42 +03:00 committed by GitHub
commit 2ff0cf4ffb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 53 additions and 0 deletions

View file

@ -288,6 +288,9 @@ in with passthru; stdenv.mkDerivation {
./3.8/0001-On-all-posix-systems-not-just-Darwin-set-LDSHARED-if.patch
# Use sysconfigdata to find headers. Fixes cross-compilation of extension modules.
./3.7/fix-finding-headers-when-cross-compiling.patch
] ++ optionals stdenv.hostPlatform.isLoongArch64 [
# https://github.com/python/cpython/issues/90656
./loongarch-support.patch
];
postPatch = ''

View file

@ -0,0 +1,50 @@
diff --git a/configure b/configure
index 8133d47f61..334c98e208 100755
--- a/configure
+++ b/configure
@@ -6215,6 +6215,20 @@ cat > conftest.c <<EOF
# else
# error unknown platform triplet
# endif
+# elif defined(__loongarch__)
+# if defined(__loongarch_lp64)
+# if defined(__loongarch_soft_float)
+ loongarch64-linux-gnusf
+# elif defined(__loongarch_single_float)
+ loongarch64-linux-gnuf32
+# elif defined(__loongarch_double_float)
+ loongarch64-linux-gnu
+# else
+# error unknown platform triplet
+# endif
+# else
+# error unknown platform triplet
+# endif
# else
# error unknown platform triplet
# endif
diff --git a/configure.ac b/configure.ac
index 3f20d8980d..acde94a181 100644
--- a/configure.ac
+++ b/configure.ac
@@ -959,6 +959,20 @@ cat > conftest.c <<EOF
hppa-linux-gnu
# elif defined(__ia64__)
ia64-linux-gnu
+# elif defined(__loongarch__)
+# if defined(__loongarch_lp64)
+# if defined(__loongarch_soft_float)
+ loongarch64-linux-gnusf
+# elif defined(__loongarch_single_float)
+ loongarch64-linux-gnuf32
+# elif defined(__loongarch_double_float)
+ loongarch64-linux-gnu
+# else
+# error unknown platform triplet
+# endif
+# else
+# error unknown platform triplet
+# endif
# elif defined(__m68k__) && !defined(__mcoldfire__)
m68k-linux-gnu
# elif defined(__mips_hard_float) && defined(__mips_isa_rev) && (__mips_isa_rev >=6) && defined(_MIPSEL)