From bb00972beea3b3059bfdc8b3403b23a379e0aa63 Mon Sep 17 00:00:00 2001 From: diviocity Date: Mon, 30 Nov 2026 11:57:16 +0100 Subject: [PATCH] Restore the published AArch64 MPFR decimal ABI --- BOOTSTRAP.md | 2 ++ mpfr/PKGBUILD.vile | 11 +++++++---- mpfr/decimal.c | 21 +++++++++++++++++++++ 3 files changed, 30 insertions(+), 4 deletions(-) create mode 100644 mpfr/decimal.c diff --git a/BOOTSTRAP.md b/BOOTSTRAP.md index b0089ed..0e28a54 100644 --- a/BOOTSTRAP.md +++ b/BOOTSTRAP.md @@ -42,6 +42,8 @@ The released arm64 kernel uses 16 KiB pages. For every nonempty ELF load segment The initial arm64 survey covered 22 distinct archive names. Thirteen contained an incompatible load segment, affecting 28 of 53 packaged executables and shared objects. BusyBox 1.38.0-4 and both initial musl releases were affected. The Linux UAPI and fortify headers contained no executable or shared object. Earlier arm64 installation and ownership receipts predate this kernel check. The worker stores the source archive hashes and segment offsets in `arm/abi16/previous-02`, receipt SHA-256 `676679a285a3ccd67bbd85ea2415fbc46e0e79b4f6bfc9bb5e9a12c310bd54f6`. The wrong-machine, historical BusyBox, header-only and x86_64 musl controls are in `arm/abi16/archive-controls-01`, receipt SHA-256 `cc8e171dc5febc3ec75a7a3c30a008c9e49bd7bbc8e9d7ace465c576dee762e1`. +MPFR needs a cross-compiler with BID decimal support. On aarch64 the worker used the pinned Ubuntu GCC 14.2 cross-compiler as a build tool, Vinix musl headers and a static decimal support archive built from the GCC source used for the Vinix runtime. The compiler inputs and probe are recorded in `gnu/arm/decimal-compiler/receipts.sha256`. The signed MPFR 4.2.1-5 has SHA-256 `e44e82b8761f1bc286c48778be25d227d3081e116f19c68752815f683fabbf82` and retains all 697 published exports. Reproduce the check with `mpfr/decimal.c` and `mpfr/thread-state.c` linked against the signed SDK. The released kernel ran both fixtures and round-tripped decimal64 and decimal128 while keeping two threads' floating-point state separate. See `gnu/arm/logs/mpfr-decimal-131/receipts.sha256` and `gnu/arm/logs/numeric-decimal-guest-132/serial.log`, SHA-256 `4f5302374bc2f94137fd31ad6c3015fd95fe0282b6f87e7141d06a17edbb5820` and `0a16a54024c57e6751d814eb6f7ab9122aadd4322f145ca1409139dace70c894`. + The desktop metapackage requires musl 1.2.6-4 or later on arm64 and 1.2.6-2 or later on x86_64. The test-signed ARM 1.2.6-3 loader itself had 16 KiB load segments. Its GCC specs let the cross toolchain override that setting for a newly linked shared library. The expected ARM minimum excludes this SDK. The worker checked the architecture-specific version constraints with native vpac metadata in `foundation/release-musl-floor-02`, receipt SHA-256 `2d6886c3bc9fdc7ef38945d303c92cb3b877eba9d67c2fa25b49f46d73019e8a`. Run `python3 tests/exec-linkage.py x86_64 "$client" "$auditor" --proot "$(command -v proot)"` on an x86_64 worker to exercise the installed loader against each dynamic executable in an audited root. For a Vinix guest, use `--fixture "$work/linkage.sh"` and pass that script to the boot harness. Packaged musl 1.2.6 applies relocations before returning from `--list`. It resolved all 109 dynamic executables in the signed 106-package x86_64 root. Renaming the exported `OPENSSL_init_ssl` symbol in an isolated copy of libssl caused the loader to reject `/usr/bin/openssl` with status 127. See `foundation/exec-linkage-01`, receipt SHA-256 `cb2fdec09f4b9e7c873ec82d672af576e9e0c26484f9496744588323a01ed3a0`. diff --git a/mpfr/PKGBUILD.vile b/mpfr/PKGBUILD.vile index 9cda59c..e21a97d 100644 --- a/mpfr/PKGBUILD.vile +++ b/mpfr/PKGBUILD.vile @@ -5,22 +5,25 @@ libc := if arm { "musl>=1.2.6-4" } else { "musl" } defpkgbuild(mpfr, #:pkgname, "mpfr", #:pkgver, "4.2.1", - #:pkgrel, if arm { 4 } else { 3 }, + #:pkgrel, if arm { 5 } else { 3 }, #:pkgdesc, "Multiple precision floating-point arithmetic with correct rounding", #:arch, [#:x86-64, #:aarch64], #:url, "https://www.mpfr.org/", #:license, "LGPL-3.0-or-later", #:depends, list(libc, if arm { "gmp>=6.3.0-3" } else { "gmp" }), - #:source, ["https://distfiles.alpinelinux.org/distfiles/v3.21/mpfr-4.2.1.tar.xz", "thread-state.c"], - #:sha256sums, ["277807353a6726978996945af13e52829e3abd7a9a5b7fb2793894e18f1fcbb2", "2950b3f63b5596ce23f83edbee76ef80d3266aa936ff88dc7fab5d97b6ce8acd"], + #:source, ["https://distfiles.alpinelinux.org/distfiles/v3.21/mpfr-4.2.1.tar.xz", "thread-state.c", "decimal.c"], + #:sha256sums, ["277807353a6726978996945af13e52829e3abd7a9a5b7fb2793894e18f1fcbb2", "2950b3f63b5596ce23f83edbee76ef80d3266aa936ff88dc7fab5d97b6ce8acd", + "c43b2b4185f324d67351e2e15a9ee97beb2ba27b30d1543b9ab2e5e4286a3396"], #:build, fn() { run("env", "CFLAGS=-O2 -std=gnu17", "CC_FOR_BUILD=gcc", "vinix-configure", "mpfr-4.2.1/configure", - "--enable-shared", "--enable-static", "--enable-thread-safe") + "--enable-shared", "--enable-static", "--enable-thread-safe", "--enable-decimal-float=bid") run("make") }, #:check, fn() { run("vinix-cc", "-std=gnu17", "-pthread", "-Impfr-4.2.1/src", "thread-state.c", "-Lsrc/.libs", "-lmpfr", "-lgmp", "-o", "thread-state") run("vinix-run", "--library-path", "src/.libs", "./thread-state") + run("vinix-cc", "-std=gnu17", "-Impfr-4.2.1/src", "decimal.c", "-Lsrc/.libs", "-lmpfr", "-lgmp", "-o", "decimal") + run("vinix-run", "--library-path", "src/.libs", "./decimal") }, #:package, fn() { run("make", string-append("DESTDIR=", pkgdir()), "install") diff --git a/mpfr/decimal.c b/mpfr/decimal.c new file mode 100644 index 0000000..3f43610 --- /dev/null +++ b/mpfr/decimal.c @@ -0,0 +1,21 @@ +#define MPFR_WANT_DECIMAL_FLOATS +#include +#include + +int main(void) +{ + volatile _Decimal64 input64 = 1234567890123456.dd; + volatile _Decimal128 input128 = 1234567890123456789012345678901234.dl; + mpfr_t number; + mpfr_init2(number, 160); + int valid = mpfr_buildopt_decimal_p() + && mpfr_set_decimal64(number, input64, MPFR_RNDN) == 0 + && mpfr_get_decimal64(number, MPFR_RNDN) == input64 + && mpfr_set_decimal128(number, input128, MPFR_RNDN) == 0 + && mpfr_get_decimal128(number, MPFR_RNDN) == input128; + mpfr_clear(number); + if (!valid) + return 1; + puts("MPFR round-tripped C decimal64 and decimal128"); + return 0; +} -- 2.56.1