Full band×arch kernel sweep + gcc-era quirk handling + tarball mirror#1
Open
lacraig2 wants to merge 5 commits into
Open
Full band×arch kernel sweep + gcc-era quirk handling + tarball mirror#1lacraig2 wants to merge 5 commits into
lacraig2 wants to merge 5 commits into
Conversation
… mirror-upload.sh
validate-sweep.nix builds one stock kernel per band across every
kernel-capable arch (42 cells) to a vmlinux, turning the per-arch kernel
column from sampled (5 points) to swept. Endianness/width-definite
defconfigs (SGI Indy/Origin, Loongson, PowerMac) so a pass certifies the
ABI, not just "a kernel". powerpcle excluded (no 32-bit PPC-LE port in
mainline Linux — that matrix cell is userland-only); k2.6 arm64 and
powerpc64le excluded (ports postdate 2.6).
kernel.nix eraQuirks: a newer gcc than a tree expects trips its own
-Werror. We build kernels, not lint them, so demote:
- KCFLAGS=-Wno-error (cross/target warnings: unused-but-set, alias-decl)
- HOSTCFLAGS (host tools: -fcommon for gcc>=10 -fno-common
breaking dtc's yylloc; -Wno-error for gcc>=12
objtool/OpenSSL-3). Note the semantics flip:
pre-4.19 HOSTCFLAGS OVERRIDES (k3 restates the
3.18 defaults), >=4.19 it APPENDS. Threaded in as
a single quoted token (spaced value would
word-split under unquoted $makeFlags — a -O2 got
misread as make's -Output-sync).
Sweep result: 32/42. k6 11/11, k4 10/11, k3 9/11, k2.6 2/9.
The 10 residual failures are four characterized root causes, NOT flag
noise, documented for follow-up:
1. gcc 5.3 too new for k2.6 non-ARM: mips page.c function-to-variable
alias is a hard error under gcc>=5; ppc/x86 -Werror defeated by
subdir flag precedence. True fix = era-appropriate gcc-4.x.
2. ppc64 big-endian ELFv1/ELFv2: musl toolchain is elfv2, old BE ppc64
kernels are elfv1 (-mcall-aixdesc). Needs -mabi=elfv1 forcing.
3. vDSO cross-propagation: ppc64le/x86 vdso sub-builds invoke host gcc.
4. tools/ has its own -Werror (objtool) unreachable by HOSTCFLAGS.
gcc 5.3.0 hit hard, unfixable errors on stock 2.6 for most arches (mips
page.c function->variable alias is rejected outright by gcc>=5; x86 vDSO
-m elf_x86_64). Those are symptoms of the compiler being too new, so
switch the k2.6 band to a genuinely era-appropriate gcc 4.9.4 built from
source. Contrary to the "can't build ancient gcc under a modern host"
worry, gcc 4.9.4 compiles fine under host gcc 13 with five small fixes in
mk-cross-toolchain.nix, all gated to gccVer<5 so gcc>=5 cells are
byte-identical:
1. refresh pre-musl config.sub/config.guess from nixpkgs gnu-config
(2010s ones reject *-linux-musl* triples)
2. gcc 4.9.4 (not mcm-blessed 4.7.4, whose in-tree mpc can't detect a
modern mpfr); support libs pinned to the era (mpfr 3.1.4/mpc 1.0.3/
gmp 6.1.0 — mpfr>=4 won't build against gcc 4.9)
3. synthesize the mcm hashes/ entry from the staged tarball, so we are
not limited to mcm's blessed component set
4. touch staged tarballs newer than their hashes, else make fires an
offline-forbidden wget
5. build gcc's own C++03-era source with -std=gnu++03 (host gcc 13
defaults to C++17; e.g. bool operator++ in reload1.c) + add `file`
The k2.6 band builds languages="c" (kernels/modules are C; gcc 4.9's
libstdc++ predates musl's _IS* ctype macros). kernel.nix gains a k2.6
quirk that strips standalone -Werror from the old tree's Makefiles (it
lands after KCFLAGS and wins on precedence), keeping -Werror-implicit-*
and -Werror=<x> intact.
Result: k2.6 2/9 -> 3/9 (armel, armhf, powerpc); gcc 4.9.4 verified to
emit correct ARM ELF (static + dynamic musl). gcc 4.9.4 is NECESSARY but
not SUFFICIENT: it removed the hard errors, but the non-ARM tail is
layered — mips (all 4) fail in the toolchain (gcc 4.9 MIPS libgcc needs
asm/unistd.h in the build sysroot; also regresses .#k26-all to 6/12),
powerpc64 hits modern-make mixed-rules + ELFv1/v2, x86_64 a percpu macro.
See README "TRUE gcc-4.x" for the remaining per-arch fixes.
gcc 4.9's MIPS libgcc unwinder (md-unwind-support.h) #includes
<asm/unistd.h>, but mcm stages kernel headers into the build sysroot too
late (after libgcc) -> "asm/unistd.h: No such file", failing all 4 MIPS
k2.6 toolchains and regressing .#k26-all.
Append a rule to litecross/Makefile (gated gccVer<5) making libgcc depend
on the kernel headers being copied into obj_sysroot first. Built as a
double-quoted Nix string so \t yields the literal tabs Makefile recipes
need. Verified: mipsel k2.6 gcc 4.9.4 toolchain builds and emits MIPS32r2
ELF; .#k26-all now builds all 12 k2.6 toolchains.
This fixes the TOOLCHAIN layer (important for MIPS module / other-version
kernel builds) but NOT the 2.6.31 MIPS kernel, which fails on SOURCE
issues that persist under gcc 4.9.4:
- arch/mips/mm/page.c aliases a function to a variable — REJECTED BY
GCC 4.9 TOO (correcting the earlier assumption that this was a
gcc-5-only error; it is a kernel-source problem)
- r4k_switch.S uses FPU opcodes (mtc1 $f30/$f31) the assembler rejects
for the configured ISA
Both need kernel source patches, not toolchain work.
k2.6 kernel tally stays 3/9 (armel, armhf, powerpc); toolchain row now
12/12. README/TRUE-gcc-4.x section corrected accordingly.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Three pieces of work land here:
Tarball mirror (
mirror.nix,mirror-upload.sh) — every pinned tarball (mcm components + Bootlin SDKs) is fetched mirror-first / upstream-fallback. Inert untilbaseis set (base = null→ upstream-only, verified hash-preserving no-op). Turns upstream pins into reproducible-forever copies.Full band×arch kernel sweep (
validate-sweep.nix) — builds one stock kernel per band across every kernel-capable arch (42 cells) to avmlinux, using endianness/width-definite defconfigs (SGI Indy/Origin, Loongson, PowerMac) so a pass certifies the ABI, not just "a kernel." This turns the per-arch kernel column from sampled (5 points) to swept.gcc-era quirk handling (
kernel.nixeraQuirks) — a newer gcc than a tree expects trips the tree's own-Werror; we build kernels, not lint them, so demote viaKCFLAGS/HOSTCFLAGS.Sweep result: 32/42
objtoolundertools/has its own-Werror(gcc-13) unreachable byHOSTCFLAGSpage.cfn→var alias (hard gcc≥5 error); ppc/x86 subdir-Werror+ x86 vDSOThe two quirk fixes recovered all three k3
dtccells with zero regressions (the 10 failures are a strict subset of the pre-fix 13).Headline finding
The residual 10 are four characterized root causes, not noise, and cluster by era. Modern kernels are essentially clean; the frontier is k2.6, where gcc 5.3 is era-inappropriate — it works for ARM but hits genuine source/ABI incompatibilities that a true gcc-4.x would not. This empirically validates pursuing the deferred true-gcc-4.x toolchain (mcm stable pin) for k2.6 over per-arch kernel shims — next up.