From a3303987f0b5dedf76618bc73103ceae870bdbb8 Mon Sep 17 00:00:00 2001 From: speak-agent <248744407+speak-agent@users.noreply.github.com> Date: Thu, 20 Aug 2026 17:00:29 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=A0=87=E5=87=86=E5=BA=93=E5=AD=90?= =?UTF-8?q?=E9=9B=86=E5=9C=A8=E9=9B=B6=20libc=20=E6=A1=A3=E4=B8=8A?= =?UTF-8?q?=E5=8F=AF=E7=94=A8=20=E2=80=94=E2=80=94=2094/103=20=E4=B8=AA?= =?UTF-8?q?=E5=A4=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * std-freestanding-nolibc 0.2.0 —— 五个函数 + **四份 C 头** * std-freestanding 0.4.0 —— nolibc feature ⭐ 障碍从来不是「子集想要 C 库」:libc++ 为 C 头带了包装头,靠 #include_next 到真正 那份去取 size_t / mbstate_t / time_t / EOF。没有 C 库时这条链无处可续,而包装头报的是 **缺类型**不是缺头 —— 所以从错误信息里看不出原因。 ⚠️ 顺序是整个机制:shim 目录必须排在 libc++ **之后**。实测:放前面解锁 0 个, 放后面解锁 79 个。 九个真需要 C 库的头(cinttypes/cmath/complex/cstdlib/exception/format/print/random/ valarray)由 feature 宏摘掉,连同各自的导出表。 验证:零 libc 工程用 std::array + std::ranges::sort(带比较器)+ std::string_view, qemu 中打印 54321 / zero-libc std ok,11156 字节,底下没有任何 C 库。 --- pkgs/s/std-freestanding-nolibc.lua | 21 +++++++++++++++++++++ pkgs/s/std-freestanding.lua | 21 +++++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/pkgs/s/std-freestanding-nolibc.lua b/pkgs/s/std-freestanding-nolibc.lua index 32efb08..3848eac 100644 --- a/pkgs/s/std-freestanding-nolibc.lua +++ b/pkgs/s/std-freestanding-nolibc.lua @@ -44,6 +44,13 @@ package = { }, sha256 = "8999ec9db31699569e14a9c5f0fa24f4736961b1d8aec143c4d0cc7e5a978ec0", }, + ["0.2.0"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/std-freestanding-nolibc/archive/refs/tags/0.2.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/std-freestanding-nolibc/releases/download/0.2.0/std-freestanding-nolibc-0.2.0.tar.gz", + }, + sha256 = "8e3509752d0a13411b5eabf64c3b9420cf904bbc7bba9e1ab0bd8f16b69e7afd", + }, }, macosx = { ["0.1.0"] = { @@ -60,6 +67,13 @@ package = { }, sha256 = "8999ec9db31699569e14a9c5f0fa24f4736961b1d8aec143c4d0cc7e5a978ec0", }, + ["0.2.0"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/std-freestanding-nolibc/archive/refs/tags/0.2.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/std-freestanding-nolibc/releases/download/0.2.0/std-freestanding-nolibc-0.2.0.tar.gz", + }, + sha256 = "8e3509752d0a13411b5eabf64c3b9420cf904bbc7bba9e1ab0bd8f16b69e7afd", + }, }, windows = { ["0.1.0"] = { @@ -76,6 +90,13 @@ package = { }, sha256 = "8999ec9db31699569e14a9c5f0fa24f4736961b1d8aec143c4d0cc7e5a978ec0", }, + ["0.2.0"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/std-freestanding-nolibc/archive/refs/tags/0.2.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/std-freestanding-nolibc/releases/download/0.2.0/std-freestanding-nolibc-0.2.0.tar.gz", + }, + sha256 = "8e3509752d0a13411b5eabf64c3b9420cf904bbc7bba9e1ab0bd8f16b69e7afd", + }, }, }, diff --git a/pkgs/s/std-freestanding.lua b/pkgs/s/std-freestanding.lua index 446c9c2..12bc74d 100644 --- a/pkgs/s/std-freestanding.lua +++ b/pkgs/s/std-freestanding.lua @@ -64,6 +64,13 @@ package = { }, sha256 = "8cd1687b2a02a53729fe8d97319b862f92a9c00ae2fb51985332fdbe0c1332c2", }, + ["0.4.0"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/std-freestanding/archive/refs/tags/0.4.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/std-freestanding/releases/download/0.4.0/std-freestanding-0.4.0.tar.gz", + }, + sha256 = "a0306d470f524f7ac32fca2ab46a46435a66dc0eb9b4960ada013a905f66b9a6", + }, }, macosx = { ["0.2.0"] = { @@ -94,6 +101,13 @@ package = { }, sha256 = "8cd1687b2a02a53729fe8d97319b862f92a9c00ae2fb51985332fdbe0c1332c2", }, + ["0.4.0"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/std-freestanding/archive/refs/tags/0.4.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/std-freestanding/releases/download/0.4.0/std-freestanding-0.4.0.tar.gz", + }, + sha256 = "a0306d470f524f7ac32fca2ab46a46435a66dc0eb9b4960ada013a905f66b9a6", + }, }, windows = { ["0.2.0"] = { @@ -124,6 +138,13 @@ package = { }, sha256 = "8cd1687b2a02a53729fe8d97319b862f92a9c00ae2fb51985332fdbe0c1332c2", }, + ["0.4.0"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/std-freestanding/archive/refs/tags/0.4.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/std-freestanding/releases/download/0.4.0/std-freestanding-0.4.0.tar.gz", + }, + sha256 = "a0306d470f524f7ac32fca2ab46a46435a66dc0eb9b4960ada013a905f66b9a6", + }, }, },