Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scope libatomic allowance to MIPS on Python 3.13 #411

Merged
merged 1 commit into from
Dec 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
10 changes: 8 additions & 2 deletions cpython-unix/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@
"pthread",
"rt",
"util",
"atomic",
}
MACOS_ALLOW_SYSTEM_LIBRARIES = {"dl", "m", "pthread"}
MACOS_ALLOW_FRAMEWORKS = {"CoreFoundation"}
Expand Down Expand Up @@ -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
Expand All @@ -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))
Expand Down
8 changes: 5 additions & 3 deletions src/validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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] = &[
Expand Down Expand Up @@ -223,8 +222,11 @@ static ELF_ALLOWED_LIBRARIES_BY_TRIPLE: Lazy<HashMap<&'static str, Vec<&'static
vec!["ld-linux-armhf.so.3", "libgcc_s.so.1"],
),
("i686-unknown-linux-gnu", vec!["ld-linux-x86-64.so.2"]),
("mips-unknown-linux-gnu", vec!["ld.so.1"]),
("mipsel-unknown-linux-gnu", vec!["ld.so.1"]),
("mips-unknown-linux-gnu", vec!["ld.so.1", "libatomic.so.1"]),
(
"mipsel-unknown-linux-gnu",
vec!["ld.so.1", "libatomic.so.1"],
),
("mips64el-unknown-linux-gnuabi64", vec![]),
("ppc64le-unknown-linux-gnu", vec!["ld64.so.1", "ld64.so.2"]),
("s390x-unknown-linux-gnu", vec!["ld64.so.1"]),
Expand Down
Loading