Skip to content

Commit 6debfc5

Browse files
committed
Scope libatomic allowance to MIPS on Python 3.13
1 parent 16b70b8 commit 6debfc5

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

cpython-unix/build.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@
5959
"pthread",
6060
"rt",
6161
"util",
62-
"atomic",
6362
}
6463
MACOS_ALLOW_SYSTEM_LIBRARIES = {"dl", "m", "pthread"}
6564
MACOS_ALLOW_FRAMEWORKS = {"CoreFoundation"}
@@ -543,6 +542,13 @@ def python_build_info(
543542

544543
bi["object_file_format"] = object_file_format
545544

545+
# Determine allowed libaries on Linux
546+
mips = target_triple.split("-")[0] in {"mips", "mipsel"}
547+
linux_allowed_system_libraries = LINUX_ALLOW_SYSTEM_LIBRARIES.copy()
548+
if mips and version == "3.13":
549+
# See https://github.com/indygreg/python-build-standalone/issues/410
550+
linux_allowed_system_libraries.add("atomic")
551+
546552
# Add in core linking annotations.
547553
libs = extra_metadata["python_config_vars"].get("LIBS", "").split()
548554
skip = False
@@ -554,7 +560,7 @@ def python_build_info(
554560
if lib.startswith("-l"):
555561
lib = lib[2:]
556562

557-
if platform == "linux64" and lib not in LINUX_ALLOW_SYSTEM_LIBRARIES:
563+
if platform == "linux64" and lib not in linux_allowed_system_libraries:
558564
raise Exception("unexpected library in LIBS (%s): %s" % (libs, lib))
559565
elif platform == "macos" and lib not in MACOS_ALLOW_SYSTEM_LIBRARIES:
560566
raise Exception("unexpected library in LIBS (%s): %s" % (libs, lib))

src/validation.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ const ELF_ALLOWED_LIBRARIES: &[&str] = &[
6868
"libpthread.so.0",
6969
"librt.so.1",
7070
"libutil.so.1",
71-
"libatomic.so.1",
7271
];
7372

7473
const PE_ALLOWED_LIBRARIES: &[&str] = &[
@@ -223,8 +222,11 @@ static ELF_ALLOWED_LIBRARIES_BY_TRIPLE: Lazy<HashMap<&'static str, Vec<&'static
223222
vec!["ld-linux-armhf.so.3", "libgcc_s.so.1"],
224223
),
225224
("i686-unknown-linux-gnu", vec!["ld-linux-x86-64.so.2"]),
226-
("mips-unknown-linux-gnu", vec!["ld.so.1"]),
227-
("mipsel-unknown-linux-gnu", vec!["ld.so.1"]),
225+
("mips-unknown-linux-gnu", vec!["ld.so.1", "libatomic.so.1"]),
226+
(
227+
"mipsel-unknown-linux-gnu",
228+
vec!["ld.so.1", "libatomic.so.1"],
229+
),
228230
("mips64el-unknown-linux-gnuabi64", vec![]),
229231
("ppc64le-unknown-linux-gnu", vec!["ld64.so.1", "ld64.so.2"]),
230232
("s390x-unknown-linux-gnu", vec!["ld64.so.1"]),

0 commit comments

Comments
 (0)