Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
Add loongarch64 support
  • Loading branch information
xiangzhai committed Apr 21, 2023
commit 77a90716a44d7d501cc9955c3ec3adf23ab30d19
2 changes: 1 addition & 1 deletion Lib/test/test_sysconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ def test_triplet_in_ext_suffix(self):
import platform, re
machine = platform.machine()
suffix = sysconfig.get_config_var('EXT_SUFFIX')
if re.match('(aarch64|arm|mips|ppc|powerpc|s390|sparc)', machine):
if re.match('(aarch64|arm|loongarch64|mips|ppc|powerpc|s390|sparc)', machine):
Copy link
Copy Markdown
Member

@youknowone youknowone Apr 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We generally don't edit this file ourselves because it mostly came from CPython.
But I understand this is necessary to correctly support the architecture.
Not to lose the changes when we update this file to new version,
Adding a comment is useful.

Suggested change
if re.match('(aarch64|arm|loongarch64|mips|ppc|powerpc|s390|sparc)', machine):
# XXX: RUSTPYTHON; loongarch64 is locally added in github #4914
if re.match('(aarch64|arm|loongarch64|mips|ppc|powerpc|s390|sparc)', machine):

And also, I found the related CPython patch doesn't include this change. Is it necessary in RustPython?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your careful review!

It is not necessary in RustPython.

Fixed.

self.assertTrue('linux' in suffix, suffix)
if re.match('(i[3-6]86|x86_64)$', machine):
if ctypes.sizeof(ctypes.c_char_p()) == 4:
Expand Down
14 changes: 13 additions & 1 deletion stdlib/src/mmap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,21 @@ mod mmap {
#[pyattr]
use libc::{
MADV_DODUMP, MADV_DOFORK, MADV_DONTDUMP, MADV_DONTFORK, MADV_HUGEPAGE, MADV_HWPOISON,
MADV_MERGEABLE, MADV_NOHUGEPAGE, MADV_REMOVE, MADV_SOFT_OFFLINE, MADV_UNMERGEABLE,
MADV_MERGEABLE, MADV_NOHUGEPAGE, MADV_REMOVE, MADV_UNMERGEABLE,
};

#[cfg(any(target_os = "android",
all(target_os = "linux", any(
target_arch = "aarch64",
target_arch = "arm",
target_arch = "powerpc",
target_arch = "powerpc64",
target_arch = "s390x",
target_arch = "x86",
target_arch = "x86_64",
target_arch = "sparc64"))))]
use libc::MADV_SOFT_OFFLINE;

#[cfg(all(target_os = "linux", target_arch = "x86_64", target_env = "gnu"))]
#[pyattr]
use libc::{MAP_DENYWRITE, MAP_EXECUTABLE, MAP_POPULATE};
Expand Down
2 changes: 2 additions & 0 deletions stdlib/src/socket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,7 @@ mod _socket {
any(
target_arch = "aarch64",
target_arch = "i686",
target_arch = "loongarch64",
target_arch = "mips",
target_arch = "powerpc",
target_arch = "powerpc64",
Expand Down Expand Up @@ -359,6 +360,7 @@ mod _socket {
any(
target_arch = "aarch64",
target_arch = "i686",
target_arch = "loongarch64",
target_arch = "mips",
target_arch = "powerpc",
target_arch = "powerpc64",
Expand Down