Skip to content

Commit 997cf28

Browse files
committed
feat(aarch64): supply the 125 outline-atomics helpers, because this package is that compiler-rt
`--target aarch64-linux-musl` 链接失败: ld.lld: error: undefined symbol: __aarch64_swp4_acq ld.lld: error: undefined symbol: __aarch64_cas8_acq_rel ⭐ **`--rtlib=compiler-rt` 让 clang 在 aarch64 上开启 `+outline-atomics`, 而它是对的** —— 那些 `__aarch64_*` 辅助函数本来就住在 compiler-rt 里, 只是本包没产出它们。特性被开启而无人实现,于是缺符号。 ⚠️ 引用来自 `openkal-linux/src/memory.o` 与 `openkal-musl/port/src/okm_fd.o` —— 两个对这件事一无所知、只是用了原子操作的包。**缺的是这份运行时该有的 东西**,所以修在这里,而不是让引擎去关掉那个特性。 ── ⭐ 把宏从命令行移进文件,而不是复制 125 份实现 ──────── upstream 用 CMake 把 `aarch64/lse.S` 编 125 遍,每遍给不同的 `-DL_<pat> -DSIZE=<n> -DMODEL=<m>`(6 模式 × 5 尺寸 × 5 模型, 非 cas 的 16 字节档不存在)。`sources` 是 glob,传不了 per-file 定义。 于是每个组合成为一个**只声明宏、再 include 共享正文**的小文件: #define L_cas #define SIZE 1 #define MODEL 1 #include "../../llvm/compiler-rt/lib/builtins/assembly.h" #include "../../llvm/compiler-rt/lib/builtins/aarch64/lse.S" 正文是 upstream 的、未经修改、留在原处 —— `git diff` 对着一份新 checkout 仍然为空。 ── ⚠️ 途中两处「以为做完了其实没有」 ────────────────── **① `#include "assembly.h"` 解析不到。** upstream 靠 `INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}"` 供给;生成的文件在 别的目录,汇编器于是把 `HIDDEN(...)` 读成指令: error: unrecognized instruction mnemonic 解法是让生成文件**自己按相对自身的路径 include 那个头** —— 不需要任何 flag,而 flag 正是「任何再包含这个目录的人都得重复一遍」的那种东西。 **② `__aarch64_have_lse_atomics` 未定义。** 125 个辅助函数每个都读它 —— 运行时决定走 LSE 指令还是 load/store-exclusive 循环。它在 `cpu_model/aarch64.c`,而 `[build]` 段的 glob 是 `builtins/*.c`, **不含子目录**,所以这个文件从未被编过。 ── 实测 ──────────────────────────────────────────── 已定义的 __aarch64_* 符号 10 未定义 0 产物中的 LSE 指令 8 处 ← 特性真的在工作 file ELF 64-bit LSB executable, ARM aarch64, statically linked ⭐ 这是**真正支持**,不是关掉特性绕过去。mcpp 引擎零改动。 来源:mcpp-community/mcpp#492 (comment)。
1 parent 4fa597e commit 997cf28

126 files changed

Lines changed: 2690 additions & 1 deletion

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Generated. One of the 130 instantiations of compiler-rt's `aarch64/lse.S`.
2+
//
3+
// Upstream's CMake compiles that one file 130 times with different defines
4+
// (6 patterns x 5 sizes x 5 models, minus the non-cas 16-byte cases). A
5+
// manifest expressing its sources as a glob cannot pass per-file defines, so
6+
// each combination becomes a file that states its own and includes the shared
7+
// body. The body is upstream's and unmodified.
8+
#define L_cas
9+
#define SIZE 16
10+
#define MODEL 1
11+
// ⚠️ `assembly.h` FIRST, BY A PATH RELATIVE TO THIS FILE.
12+
//
13+
// `lse.S` opens with `#include "assembly.h"`, which upstream resolves by
14+
// compiling it with `-I` pointing at `builtins/`. This file lives elsewhere, so
15+
// that include would not resolve and the assembler would meet `HIDDEN(...)` as
16+
// an instruction: `error: unrecognized instruction mnemonic`. Including the
17+
// header here, by a path relative to this file, needs no flag at all — and a
18+
// flag is what would have to be repeated by anything else that ever includes
19+
// this directory.
20+
#include "../../llvm/compiler-rt/lib/builtins/assembly.h"
21+
#include "../../llvm/compiler-rt/lib/builtins/aarch64/lse.S"
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Generated. One of the 130 instantiations of compiler-rt's `aarch64/lse.S`.
2+
//
3+
// Upstream's CMake compiles that one file 130 times with different defines
4+
// (6 patterns x 5 sizes x 5 models, minus the non-cas 16-byte cases). A
5+
// manifest expressing its sources as a glob cannot pass per-file defines, so
6+
// each combination becomes a file that states its own and includes the shared
7+
// body. The body is upstream's and unmodified.
8+
#define L_cas
9+
#define SIZE 16
10+
#define MODEL 2
11+
// ⚠️ `assembly.h` FIRST, BY A PATH RELATIVE TO THIS FILE.
12+
//
13+
// `lse.S` opens with `#include "assembly.h"`, which upstream resolves by
14+
// compiling it with `-I` pointing at `builtins/`. This file lives elsewhere, so
15+
// that include would not resolve and the assembler would meet `HIDDEN(...)` as
16+
// an instruction: `error: unrecognized instruction mnemonic`. Including the
17+
// header here, by a path relative to this file, needs no flag at all — and a
18+
// flag is what would have to be repeated by anything else that ever includes
19+
// this directory.
20+
#include "../../llvm/compiler-rt/lib/builtins/assembly.h"
21+
#include "../../llvm/compiler-rt/lib/builtins/aarch64/lse.S"
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Generated. One of the 130 instantiations of compiler-rt's `aarch64/lse.S`.
2+
//
3+
// Upstream's CMake compiles that one file 130 times with different defines
4+
// (6 patterns x 5 sizes x 5 models, minus the non-cas 16-byte cases). A
5+
// manifest expressing its sources as a glob cannot pass per-file defines, so
6+
// each combination becomes a file that states its own and includes the shared
7+
// body. The body is upstream's and unmodified.
8+
#define L_cas
9+
#define SIZE 16
10+
#define MODEL 3
11+
// ⚠️ `assembly.h` FIRST, BY A PATH RELATIVE TO THIS FILE.
12+
//
13+
// `lse.S` opens with `#include "assembly.h"`, which upstream resolves by
14+
// compiling it with `-I` pointing at `builtins/`. This file lives elsewhere, so
15+
// that include would not resolve and the assembler would meet `HIDDEN(...)` as
16+
// an instruction: `error: unrecognized instruction mnemonic`. Including the
17+
// header here, by a path relative to this file, needs no flag at all — and a
18+
// flag is what would have to be repeated by anything else that ever includes
19+
// this directory.
20+
#include "../../llvm/compiler-rt/lib/builtins/assembly.h"
21+
#include "../../llvm/compiler-rt/lib/builtins/aarch64/lse.S"
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Generated. One of the 130 instantiations of compiler-rt's `aarch64/lse.S`.
2+
//
3+
// Upstream's CMake compiles that one file 130 times with different defines
4+
// (6 patterns x 5 sizes x 5 models, minus the non-cas 16-byte cases). A
5+
// manifest expressing its sources as a glob cannot pass per-file defines, so
6+
// each combination becomes a file that states its own and includes the shared
7+
// body. The body is upstream's and unmodified.
8+
#define L_cas
9+
#define SIZE 16
10+
#define MODEL 4
11+
// ⚠️ `assembly.h` FIRST, BY A PATH RELATIVE TO THIS FILE.
12+
//
13+
// `lse.S` opens with `#include "assembly.h"`, which upstream resolves by
14+
// compiling it with `-I` pointing at `builtins/`. This file lives elsewhere, so
15+
// that include would not resolve and the assembler would meet `HIDDEN(...)` as
16+
// an instruction: `error: unrecognized instruction mnemonic`. Including the
17+
// header here, by a path relative to this file, needs no flag at all — and a
18+
// flag is what would have to be repeated by anything else that ever includes
19+
// this directory.
20+
#include "../../llvm/compiler-rt/lib/builtins/assembly.h"
21+
#include "../../llvm/compiler-rt/lib/builtins/aarch64/lse.S"
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Generated. One of the 130 instantiations of compiler-rt's `aarch64/lse.S`.
2+
//
3+
// Upstream's CMake compiles that one file 130 times with different defines
4+
// (6 patterns x 5 sizes x 5 models, minus the non-cas 16-byte cases). A
5+
// manifest expressing its sources as a glob cannot pass per-file defines, so
6+
// each combination becomes a file that states its own and includes the shared
7+
// body. The body is upstream's and unmodified.
8+
#define L_cas
9+
#define SIZE 16
10+
#define MODEL 5
11+
// ⚠️ `assembly.h` FIRST, BY A PATH RELATIVE TO THIS FILE.
12+
//
13+
// `lse.S` opens with `#include "assembly.h"`, which upstream resolves by
14+
// compiling it with `-I` pointing at `builtins/`. This file lives elsewhere, so
15+
// that include would not resolve and the assembler would meet `HIDDEN(...)` as
16+
// an instruction: `error: unrecognized instruction mnemonic`. Including the
17+
// header here, by a path relative to this file, needs no flag at all — and a
18+
// flag is what would have to be repeated by anything else that ever includes
19+
// this directory.
20+
#include "../../llvm/compiler-rt/lib/builtins/assembly.h"
21+
#include "../../llvm/compiler-rt/lib/builtins/aarch64/lse.S"
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Generated. One of the 130 instantiations of compiler-rt's `aarch64/lse.S`.
2+
//
3+
// Upstream's CMake compiles that one file 130 times with different defines
4+
// (6 patterns x 5 sizes x 5 models, minus the non-cas 16-byte cases). A
5+
// manifest expressing its sources as a glob cannot pass per-file defines, so
6+
// each combination becomes a file that states its own and includes the shared
7+
// body. The body is upstream's and unmodified.
8+
#define L_cas
9+
#define SIZE 1
10+
#define MODEL 1
11+
// ⚠️ `assembly.h` FIRST, BY A PATH RELATIVE TO THIS FILE.
12+
//
13+
// `lse.S` opens with `#include "assembly.h"`, which upstream resolves by
14+
// compiling it with `-I` pointing at `builtins/`. This file lives elsewhere, so
15+
// that include would not resolve and the assembler would meet `HIDDEN(...)` as
16+
// an instruction: `error: unrecognized instruction mnemonic`. Including the
17+
// header here, by a path relative to this file, needs no flag at all — and a
18+
// flag is what would have to be repeated by anything else that ever includes
19+
// this directory.
20+
#include "../../llvm/compiler-rt/lib/builtins/assembly.h"
21+
#include "../../llvm/compiler-rt/lib/builtins/aarch64/lse.S"
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Generated. One of the 130 instantiations of compiler-rt's `aarch64/lse.S`.
2+
//
3+
// Upstream's CMake compiles that one file 130 times with different defines
4+
// (6 patterns x 5 sizes x 5 models, minus the non-cas 16-byte cases). A
5+
// manifest expressing its sources as a glob cannot pass per-file defines, so
6+
// each combination becomes a file that states its own and includes the shared
7+
// body. The body is upstream's and unmodified.
8+
#define L_cas
9+
#define SIZE 1
10+
#define MODEL 2
11+
// ⚠️ `assembly.h` FIRST, BY A PATH RELATIVE TO THIS FILE.
12+
//
13+
// `lse.S` opens with `#include "assembly.h"`, which upstream resolves by
14+
// compiling it with `-I` pointing at `builtins/`. This file lives elsewhere, so
15+
// that include would not resolve and the assembler would meet `HIDDEN(...)` as
16+
// an instruction: `error: unrecognized instruction mnemonic`. Including the
17+
// header here, by a path relative to this file, needs no flag at all — and a
18+
// flag is what would have to be repeated by anything else that ever includes
19+
// this directory.
20+
#include "../../llvm/compiler-rt/lib/builtins/assembly.h"
21+
#include "../../llvm/compiler-rt/lib/builtins/aarch64/lse.S"
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Generated. One of the 130 instantiations of compiler-rt's `aarch64/lse.S`.
2+
//
3+
// Upstream's CMake compiles that one file 130 times with different defines
4+
// (6 patterns x 5 sizes x 5 models, minus the non-cas 16-byte cases). A
5+
// manifest expressing its sources as a glob cannot pass per-file defines, so
6+
// each combination becomes a file that states its own and includes the shared
7+
// body. The body is upstream's and unmodified.
8+
#define L_cas
9+
#define SIZE 1
10+
#define MODEL 3
11+
// ⚠️ `assembly.h` FIRST, BY A PATH RELATIVE TO THIS FILE.
12+
//
13+
// `lse.S` opens with `#include "assembly.h"`, which upstream resolves by
14+
// compiling it with `-I` pointing at `builtins/`. This file lives elsewhere, so
15+
// that include would not resolve and the assembler would meet `HIDDEN(...)` as
16+
// an instruction: `error: unrecognized instruction mnemonic`. Including the
17+
// header here, by a path relative to this file, needs no flag at all — and a
18+
// flag is what would have to be repeated by anything else that ever includes
19+
// this directory.
20+
#include "../../llvm/compiler-rt/lib/builtins/assembly.h"
21+
#include "../../llvm/compiler-rt/lib/builtins/aarch64/lse.S"
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Generated. One of the 130 instantiations of compiler-rt's `aarch64/lse.S`.
2+
//
3+
// Upstream's CMake compiles that one file 130 times with different defines
4+
// (6 patterns x 5 sizes x 5 models, minus the non-cas 16-byte cases). A
5+
// manifest expressing its sources as a glob cannot pass per-file defines, so
6+
// each combination becomes a file that states its own and includes the shared
7+
// body. The body is upstream's and unmodified.
8+
#define L_cas
9+
#define SIZE 1
10+
#define MODEL 4
11+
// ⚠️ `assembly.h` FIRST, BY A PATH RELATIVE TO THIS FILE.
12+
//
13+
// `lse.S` opens with `#include "assembly.h"`, which upstream resolves by
14+
// compiling it with `-I` pointing at `builtins/`. This file lives elsewhere, so
15+
// that include would not resolve and the assembler would meet `HIDDEN(...)` as
16+
// an instruction: `error: unrecognized instruction mnemonic`. Including the
17+
// header here, by a path relative to this file, needs no flag at all — and a
18+
// flag is what would have to be repeated by anything else that ever includes
19+
// this directory.
20+
#include "../../llvm/compiler-rt/lib/builtins/assembly.h"
21+
#include "../../llvm/compiler-rt/lib/builtins/aarch64/lse.S"
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Generated. One of the 130 instantiations of compiler-rt's `aarch64/lse.S`.
2+
//
3+
// Upstream's CMake compiles that one file 130 times with different defines
4+
// (6 patterns x 5 sizes x 5 models, minus the non-cas 16-byte cases). A
5+
// manifest expressing its sources as a glob cannot pass per-file defines, so
6+
// each combination becomes a file that states its own and includes the shared
7+
// body. The body is upstream's and unmodified.
8+
#define L_cas
9+
#define SIZE 1
10+
#define MODEL 5
11+
// ⚠️ `assembly.h` FIRST, BY A PATH RELATIVE TO THIS FILE.
12+
//
13+
// `lse.S` opens with `#include "assembly.h"`, which upstream resolves by
14+
// compiling it with `-I` pointing at `builtins/`. This file lives elsewhere, so
15+
// that include would not resolve and the assembler would meet `HIDDEN(...)` as
16+
// an instruction: `error: unrecognized instruction mnemonic`. Including the
17+
// header here, by a path relative to this file, needs no flag at all — and a
18+
// flag is what would have to be repeated by anything else that ever includes
19+
// this directory.
20+
#include "../../llvm/compiler-rt/lib/builtins/assembly.h"
21+
#include "../../llvm/compiler-rt/lib/builtins/aarch64/lse.S"

0 commit comments

Comments
 (0)