Skip to content

Commit 6809c44

Browse files
committed
Review cleanup
1 parent 1ab2419 commit 6809c44

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

cpython-unix/build.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -88,18 +88,20 @@ def add_target_env(env, build_platform, target_triple, build_env):
8888
extra_host_cflags = []
8989
extra_host_ldflags = []
9090

91-
if build_platform == "linux_x86_64":
91+
if build_platform.startswith("linux_"):
9292
machine = platform.machine()
9393

9494
if machine == "aarch64":
9595
env["BUILD_TRIPLE"] = "aarch64-unknown-linux-gnu"
96-
else:
96+
elif machine == "x86_64":
9797
env["BUILD_TRIPLE"] = "x86_64-unknown-linux-gnu"
9898
env["TARGET_TRIPLE"] = (
9999
target_triple.replace("x86_64_v2-", "x86_64-")
100100
.replace("x86_64_v3-", "x86_64-")
101101
.replace("x86_64_v4-", "x86_64-")
102102
)
103+
else:
104+
raise Exception("unhandled Linux machine value: %s" % machine)
103105

104106
# This will make x86_64_v2, etc count as cross-compiling. This is
105107
# semantically correct, since the current machine may not support
@@ -109,10 +111,6 @@ def add_target_env(env, build_platform, target_triple, build_env):
109111
):
110112
env["CROSS_COMPILING"] = "1"
111113

112-
elif build_platform == "linux_aarch64":
113-
env["BUILD_TRIPLE"] = "aarch64-unknown-linux-gnu"
114-
env["TARGET_TRIPLE"] = "aarch64-unknown-linux-gnu"
115-
116114
elif build_platform.startswith("macos_"):
117115
machine = platform.machine()
118116

@@ -196,6 +194,8 @@ def add_target_env(env, build_platform, target_triple, build_env):
196194

197195
extra_host_cflags.extend(["-isysroot", host_sdk_path])
198196
extra_host_ldflags.extend(["-isysroot", host_sdk_path])
197+
else:
198+
raise Exception("unhandled build platform: %s" % build_platform)
199199

200200
env["EXTRA_HOST_CFLAGS"] = " ".join(extra_host_cflags)
201201
env["EXTRA_HOST_LDFLAGS"] = " ".join(extra_host_ldflags)
@@ -505,7 +505,7 @@ def python_build_info(
505505
binary_suffix = ""
506506

507507
if platform in ("linux_x86_64", "linux_aarch64"):
508-
arch = "aarch64" if platform == "linux_aarch64" else "x86_64"
508+
arch = platform.removeprefix("linux_")
509509

510510
bi["core"]["static_lib"] = (
511511
"install/lib/python{version}/config-{version}{binary_suffix}-{arch}-linux-gnu/libpython{version}{binary_suffix}.a".format(

cpython-unix/targets.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@ aarch64-unknown-linux-gnu:
202202
# Blocked on:
203203
# BOLT-ERROR: Cannot relax adr in non-simple function
204204
# trampoline_code_table/1. Use --strict option to override
205+
# See https://github.com/llvm/llvm-project/issues/146541
205206
# bolt_capable: true
206207

207208
arm64-apple-tvos:

docs/running.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ Common configurations include:
143143
Profile guided optimization.
144144

145145
Starting with CPython 3.12, BOLT is also applied alongside traditional
146-
PGO on platforms supporting BOLT. (Currently just Linux aarch64 and x86-64.)
146+
PGO on platforms supporting BOLT. (Currently just Linux x86-64.)
147147

148148
``lto``
149149
Link-time optimization.

0 commit comments

Comments
 (0)