Skip to content

Commit 8111a2e

Browse files
committed
fix(aarch64): disable FMV — half that file cannot compile on a macOS host
`cpu_model/aarch64.c` 的后半是函数多版本(FMV),按宿主分支 include 一个 `.inc`。Apple 那支拉系统头: aarch64/fmv/apple.inc:1:10: fatal error: 'TargetConditionals.h' file not found 而本包的 `include_dirs` 刻意不含任何来自机器的路径(见该段的 ⭐⭐ NOTHING FROM THE MACHINE)。⚠️ 本机 Linux 编得过,CI 的 macOS 那格才炸 —— 典型的「一台宿主看不见」的形状。 ⭐ 本包**不需要** FMV:要的只是 `__aarch64_have_lse_atomics`,它定义在 `#if !defined(DISABLE_AARCH64_FMV)` **之外**。upstream 自己带这个开关 (`COMPILER_RT_DISABLE_AARCH64_FMV`),所以这是走它给的门,不是绕过。 实测关掉后 aarch64 仍产出 ARM aarch64 静态 ELF,10 个 __aarch64_* 符号 已定义、0 个未定义。
1 parent 997cf28 commit 8111a2e

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

mcpp.toml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,21 @@ sources = [
181181
# 从未被编过。upstream 把它列在 `aarch64_SOURCES` 里,与本节同一批。
182182
"llvm/compiler-rt/lib/builtins/cpu_model/aarch64.c",
183183
]
184+
# ⚠️ FMV 关掉,而它不是可选的清理 —— 那半个文件在 macOS 宿主上根本编不过。
185+
#
186+
# `cpu_model/aarch64.c` 的后半是函数多版本(FMV)的实现,按宿主分支 include
187+
# 一个 `.inc`。Apple 那支拉的是系统头:
188+
#
189+
# aarch64/fmv/apple.inc:1:10: fatal error: 'TargetConditionals.h' file not found
190+
#
191+
# 而本包的 `include_dirs` 刻意不含任何来自机器的路径 —— 见该段的
192+
# ⭐⭐ NOTHING FROM THE MACHINE。⚠️ 本机 Linux 上编得过,CI 的 macOS 那格才炸,
193+
# 是典型的「一台宿主看不见」的形状。
194+
#
195+
# ⭐ 而本包**不需要** FMV:要的只是 `__aarch64_have_lse_atomics`,
196+
# 它定义在 `#if !defined(DISABLE_AARCH64_FMV)` 之外。upstream 自己也有这个
197+
# 开关(`COMPILER_RT_DISABLE_AARCH64_FMV`),所以这是走它给的门,不是绕过。
198+
cflags = ["-DDISABLE_AARCH64_FMV=1"]
184199

185200
[dependencies]
186201
openkal-musl = "0.3.3"

0 commit comments

Comments
 (0)