From 94fcb93f51d34f0033fd29e443e142b2e978a90e Mon Sep 17 00:00:00 2001 From: diviocity Date: Mon, 30 Nov 2026 14:03:30 +0100 Subject: [PATCH] Resolve compiler search subdirectories inside the target SDK --- BOOTSTRAP.md | 2 ++ tools/vinix-cc.v | 32 ++++++++++++++++++++++++-------- 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/BOOTSTRAP.md b/BOOTSTRAP.md index 0b9da21..9eab10b 100644 --- a/BOOTSTRAP.md +++ b/BOOTSTRAP.md @@ -103,6 +103,8 @@ OpenSSH 9.9p2-1 passed its AArch64 recipe checks in QEMU user mode with six pack On AArch64, readline's configure script repurposes `CROSS_COMPILE` as a C preprocessor flag. The configure wrapper now fixes the compiler names before that script runs. With the same signed musl and ncurses SDK, configure changed from a lookup for `-DCROSS_COMPILINGgcc` to a successful AArch64 compiler and configuration check. See `arm/abi16/readline-configure-01`, receipt SHA-256 `60d817d3cd361d8a07bf186e3a8378787e05664207fef02a00ed25cfbfc1ce7f`. +Readline 8.2.13-1 built and passed its history and ELF checks on AArch64. The compiler wrapper also rebases absolute include and library subdirectories into the signed SDK, including the `/usr/include/ncursesw` path emitted by pinentry. Pinentry 1.3.1-1 built its terminal and curses programs, ran the target version check, and passed the ELF page audit. See `arm/abi16/readline-package-01` and `arm/abi16/pinentry-headers-01`, receipt SHA-256 `705341ec3a85b2779cd6ebd551bed3c06672ee86674b4d50fec6ab149453c2bc` and `096d60a52b5b89d22eab0945aa6de8922e4ffc115aaa51a878ae335799ab31d4`. + An eight-package x86_64 guest tested the BusyBox wget applet and its separately packaged TLS helper. It rejected an unknown certificate, retrieved the expected bytes after installing the local CA, and rejected the same certificate for a different hostname. The guest fixture is `tests/userland/wget.sh`. The worker keeps the install, audit and serial hashes in `foundation/wget-guest-x86_64-01/receipts.sha256`, SHA-256 `5872d1467ee2594b9305bed5fa1ceb084c8c3fde4ebccb0539db25d02b3849f9`. For package roots too large for a test initramfs, use `python3 tests/disk-root.py "$arch" "$root" "$fixture" "$iso" "$boot" "$output"` on the worker. The root must supply BusyBox init, and the fixture prints `VPAC FIXTURE GUEST PASS` after its checks. The helper creates a fresh ext2 image file from a private copy and runs QEMU in snapshot mode. The x86_64 release kernel read the matching disk identity and relocated all 109 dynamic executable paths from a 106-package root with 512 MiB of guest RAM. The test retains its ext2 and serial hashes under `foundation/disk-exec-x86-02/test`, receipt SHA-256 `6f600855744d04fa71d916f545e746ed36ba2686a56937c2b4c3cb02e3ec6a58`. diff --git a/tools/vinix-cc.v b/tools/vinix-cc.v index 48fb016..3be3e4c 100644 --- a/tools/vinix-cc.v +++ b/tools/vinix-cc.v @@ -5,21 +5,37 @@ module main import os // Libtool can add -L/usr/lib while it relinks libraries under DESTDIR. GCC's -// --sysroot does not rebase an ordinary -L argument. Keep these explicit -// system directories inside the SDK, including their two-argument spellings. +// --sysroot does not rebase ordinary -L or -I arguments. Keep explicit +// system directories and their descendants inside the SDK. +fn target_search_path(root string, flag string, path string) string { + if flag == '-L' && (path == '/usr/lib' || path.starts_with('/usr/lib/') || path == '/lib' + || path.starts_with('/lib/')) { + return root + path + } + if flag in ['-I', '-isystem'] && (path == '/usr/include' || path.starts_with('/usr/include/')) { + return root + path + } + return path +} + fn target_search_args(root string, input []string) []string { mut args := []string{cap: input.len} mut previous := '' for arg in input { - if (previous == '-L' && arg in ['/usr/lib', '/lib']) - || (previous in ['-I', '-isystem'] && arg == '/usr/include') { - args << root + arg - } else if arg in ['-L/usr/lib', '-L/lib', '-I/usr/include'] { - args << arg[..2] + root + arg[2..] + if previous != '' { + args << target_search_path(root, previous, arg) + previous = '' + continue + } + if arg in ['-L', '-I', '-isystem'] { + previous = arg + } + flag := arg.all_before('/') + if flag in ['-L', '-I', '-isystem'] && arg.len > flag.len { + args << flag + target_search_path(root, flag, arg[flag.len..]) } else { args << arg } - previous = arg } return args } -- 2.56.1