From 6debfc58566f035d51a79714e30a8cf1eea42f84 Mon Sep 17 00:00:00 2001 From: Zanie Blue Date: Fri, 6 Dec 2024 14:06:42 -0600 Subject: [PATCH] Scope `libatomic` allowance to MIPS on Python 3.13 --- cpython-unix/build.py | 10 ++++++++-- src/validation.rs | 8 +++++--- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/cpython-unix/build.py b/cpython-unix/build.py index a0aaa470..1c1963bb 100755 --- a/cpython-unix/build.py +++ b/cpython-unix/build.py @@ -59,7 +59,6 @@ "pthread", "rt", "util", - "atomic", } MACOS_ALLOW_SYSTEM_LIBRARIES = {"dl", "m", "pthread"} MACOS_ALLOW_FRAMEWORKS = {"CoreFoundation"} @@ -543,6 +542,13 @@ def python_build_info( bi["object_file_format"] = object_file_format + # Determine allowed libaries on Linux + mips = target_triple.split("-")[0] in {"mips", "mipsel"} + linux_allowed_system_libraries = LINUX_ALLOW_SYSTEM_LIBRARIES.copy() + if mips and version == "3.13": + # See https://github.com/indygreg/python-build-standalone/issues/410 + linux_allowed_system_libraries.add("atomic") + # Add in core linking annotations. libs = extra_metadata["python_config_vars"].get("LIBS", "").split() skip = False @@ -554,7 +560,7 @@ def python_build_info( if lib.startswith("-l"): lib = lib[2:] - if platform == "linux64" and lib not in LINUX_ALLOW_SYSTEM_LIBRARIES: + if platform == "linux64" and lib not in linux_allowed_system_libraries: raise Exception("unexpected library in LIBS (%s): %s" % (libs, lib)) elif platform == "macos" and lib not in MACOS_ALLOW_SYSTEM_LIBRARIES: raise Exception("unexpected library in LIBS (%s): %s" % (libs, lib)) diff --git a/src/validation.rs b/src/validation.rs index 128d78e6..2d498635 100644 --- a/src/validation.rs +++ b/src/validation.rs @@ -68,7 +68,6 @@ const ELF_ALLOWED_LIBRARIES: &[&str] = &[ "libpthread.so.0", "librt.so.1", "libutil.so.1", - "libatomic.so.1", ]; const PE_ALLOWED_LIBRARIES: &[&str] = &[ @@ -223,8 +222,11 @@ static ELF_ALLOWED_LIBRARIES_BY_TRIPLE: Lazy