Skip to content
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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
26 changes: 26 additions & 0 deletions llvm/PATCHES.md
Original file line number Diff line number Diff line change
Expand Up @@ -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` 各给一次
Expand Down
23 changes: 22 additions & 1 deletion llvm/compiler-rt/lib/builtins/int_lib.h
Original file line number Diff line number Diff line change
Expand Up @@ -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__)
Expand Down
26 changes: 22 additions & 4 deletions llvm/libunwind/include/__libunwind_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <windows.h>`. 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__
Expand Down
4 changes: 2 additions & 2 deletions mcpp.toml
Original file line number Diff line number Diff line change
@@ -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"]
Expand Down Expand Up @@ -216,7 +216,7 @@ sources = [
cflags = ["-DDISABLE_AARCH64_FMV=1"]

[dependencies]
openkal-musl = "0.18.0"
openkal-musl = "0.19.0"

[build]

Expand Down
Loading