diff --git a/README.md b/README.md index 7192566b..952ca089 100644 --- a/README.md +++ b/README.md @@ -6,11 +6,11 @@ C library. ```toml [dependencies] -openkal-llvm-runtime = "0.13.0" +openkal-llvm-runtime = "0.14.0" ``` > **Engine floor (mcpp 2026.9.20.1):** this version of this package pins -> `openkal-musl 0.18.0` and inherits its `[c-abi]` declaration. The engine +> `openkal-musl 0.19.0` and inherits its `[c-abi]` declaration. The engine > assembles the verification probe's command line in one place that REFUSES > to run it without a target selection (`cenv_probe::assemble_argv`), and > `cenv::realise` forces `-fno-short-wchar` on freestanding wchar. Older diff --git a/llvm/PATCHES.md b/llvm/PATCHES.md index ca0f2938..045eef8c 100644 --- a/llvm/PATCHES.md +++ b/llvm/PATCHES.md @@ -155,6 +155,32 @@ openkal-musl 的 `[c-abi] presents = "posix"` 把它和 `_WIN32`、`__MINGW32__` --- +## 第六处:`compiler-rt/lib/builtins/int_lib.h`(2026-09-21) + +前五处是按「撤掉 `_WIN32` 后会落错分支」找出来的。**第六处是按「撤掉 `__CYGWIN__` 后会 +落错分支」找出来的,而当时没有人去找第二遍。** + +```c +#if defined(__ELF__) || defined(__MINGW32__) || ... || defined(__CYGWIN__) + /* __attribute__((alias)) —— PE 要走的就是这一支 */ +#elif defined(__APPLE__) ... +#elif defined(_WIN32) || defined(__UEFI__) ... +#else +#error Unsupported target +``` + +这个文件今天**靠 `__CYGWIN__` 偶然工作**:`_WIN32`/`__MINGW32__` 被 `[c-abi] presents = +"posix"` 压掉,`__ELF__` 为假,只剩它。mcpp 撤掉 `__CYGWIN__` 之后(2026.9.21.1 的下一版), +三支全部落空,直接 `#error`。 + +它**不是**已安装的头,只由本包自己的构建编译,所以按本文件的规矩用私有 define +`OPENKAL_TARGET_WINDOWS`——而 `__libunwind_config.h` 反过来用 `__MCPP_TARGET_WINDOWS__`, +因为它**是**已安装的。两者读不同的宏,回答同一个关于同一个目标的问题,这正是下面那一节 +要求的性质。 + +⚠️ **下一次改这棵树,`grep` 的清单要加上 `__CYGWIN__`**: +`grep -rn "_WIN32\|_WIN64\|__MINGW32__\|__MINGW64__\|__CYGWIN__"`。 + ## ⭐ 一个名字,不是五个 五处补丁全部守卫在 **`OPENKAL`** 上,`cflags` 和 `cxxflags` 各给一次 diff --git a/llvm/compiler-rt/lib/builtins/int_lib.h b/llvm/compiler-rt/lib/builtins/int_lib.h index 943430de..f4fa1465 100644 --- a/llvm/compiler-rt/lib/builtins/int_lib.h +++ b/llvm/compiler-rt/lib/builtins/int_lib.h @@ -48,8 +48,29 @@ #define XSTR(a) STR(a) #define SYMBOL_NAME(name) XSTR(__USER_LABEL_PREFIX__) #name +// ─── openkal ─── BEGIN +// `OPENKAL_TARGET_WINDOWS` joins this guard, and the alternative was a hard +// `#error Unsupported target` a release from now. +// +// This target is PE, and PE takes the first branch: `__attribute__((alias))` +// is what the GNU/clang toolchain emits for it. Today that branch is reached +// through `__CYGWIN__`, which mcpp defines only because nothing else named +// the target --- BY ACCIDENT, not by this file's intent. `_WIN32` and +// `__MINGW32__` are suppressed here on purpose (`[c-abi] presents = "posix"`) +// and `__ELF__` is false, so when `__CYGWIN__` is withdrawn --- it is, one +// release after mcpp 2026.9.21.1 --- every operand of this `#if` goes false, +// `__APPLE__` and `_WIN32`/`__UEFI__` below are false too, and the `#else` +// is `#error Unsupported target`. +// +// The private define is the right name here, not `__mcpp_target_windows__`: +// this file is NOT installed, it is compiled only by this package's own +// build, and `mcpp.toml` carries `OPENKAL_TARGET_WINDOWS` to it in `cflags`. +// That is the same rule the other five patches in this tree follow, and the +// reason `__libunwind_config.h` does the opposite --- it IS installed. See +// `llvm/PATCHES.md`. #if defined(__ELF__) || defined(__MINGW32__) || defined(__wasm__) || \ - defined(_AIX) || defined(__CYGWIN__) + defined(_AIX) || defined(__CYGWIN__) || defined(OPENKAL_TARGET_WINDOWS) +// ─── openkal ─── END #define COMPILER_RT_ALIAS(name, aliasname) \ COMPILER_RT_ABI __typeof(name) aliasname __attribute__((__alias__(#name))); #elif defined(__APPLE__) diff --git a/llvm/libunwind/include/__libunwind_config.h b/llvm/libunwind/include/__libunwind_config.h index 629ee14f..16d0283d 100644 --- a/llvm/libunwind/include/__libunwind_config.h +++ b/llvm/libunwind/include/__libunwind_config.h @@ -54,15 +54,33 @@ // through `unwind.h` and `libunwind.h`, both public), so it cannot read // `OPENKAL_TARGET_WINDOWS` --- that is this package's own private build // define (mcpp.toml) and an application calling `unw_getcontext` directly -// against `unw_context_t` does not see it. `__CYGWIN__` is read instead, -// for the same reason `openkal-musl`'s `bits/setjmp.h` reads it: mcpp keeps -// it defined target-wide, an application's compile included. +// against `unw_context_t` does not see it. `__MCPP_TARGET_WINDOWS__` is read +// instead: mcpp states the target under its OWN name, target-wide, an +// application's compile included. +// +// TWO OPERANDS COVER EVERY ENGINE AND REMOVE THE ORDERING CONSTRAINT. One up +// to and including 2026.9.21.1 defines `__CYGWIN__`, which answers; the +// release that withdraws it defines `__MCPP_TARGET_WINDOWS__`, which answers +// instead. No engine defines neither, so this header has no flag day and the +// two releases may land in either order. The second operand goes once the +// withdrawal has shipped. +// +// 2026.9.21.1 spelt the name in lower case and it is not read here: that +// spelling existed for one release, nothing consumed it, and the release that +// withdraws `__CYGWIN__` renames it in the same change. Project-owned macros +// are upper case; lower case belongs to the compiler's own predefines, which +// mcpp supplies but does not own. +// +// THE OLD NAME WAS BORROWED AND MEANT SOMETHING ELSE. Upstream reads +// `__CYGWIN__` as "Win32 is available"; a 30-member measurement found four +// packages doing exactly that and reaching `#include `. It +// answered this file's question only by accident. // `UnwindRegistersSave.S` writes exactly the record sized here and reads // `OPENKAL_TARGET_WINDOWS` rather than `__CYGWIN__`, because it is NOT // installed --- compiled only by this package's own build, like // `okm_setjmp.S`. The two answer the same question about the same target // without reading the same macro, which is what has to hold; see that file. -# if defined(_WIN64) || defined(__CYGWIN__) +# if defined(_WIN64) || defined(__MCPP_TARGET_WINDOWS__) || defined(__CYGWIN__) // ─── openkal ─── END # define _LIBUNWIND_CONTEXT_SIZE 54 # ifdef __SEH__ diff --git a/mcpp.toml b/mcpp.toml index ee6b48d2..95ee8cf2 100644 --- a/mcpp.toml +++ b/mcpp.toml @@ -1,7 +1,7 @@ [package] namespace = "mcpplibs" name = "openkal-llvm-runtime" -version = "0.13.0" +version = "0.14.0" description = "LLVM's C++ runtime libraries — libc++, libc++abi and libunwind — configured for openkal-musl rather than for a host C library." license = "Apache-2.0" authors = ["mcpplibs"] @@ -216,7 +216,7 @@ sources = [ cflags = ["-DDISABLE_AARCH64_FMV=1"] [dependencies] -openkal-musl = "0.18.0" +openkal-musl = "0.19.0" [build]