From 82601efd5e2bcbe7c12c2a285f362530c187ec6a Mon Sep 17 00:00:00 2001 From: David Garske Date: Fri, 13 Nov 2026 10:43:48 -0800 Subject: [PATCH] Fix the CI jobs that fail on the Ubuntu 26.04 runner image --- .github/workflows/test-endian.yml | 12 +++++++++--- .github/workflows/test-sbom.yml | 7 ++++++- .github/workflows/test-x86-fsp-qemu.yml | 6 +++--- arch.mk | 4 ++++ src/string.c | 5 +++++ tools/fs-test/README.md | 2 +- tools/fs-test/runtests.sh | 9 ++++++--- tools/scripts/x86_fsp/qemu/qemu_build_fsp.sh | 3 +++ 8 files changed, 37 insertions(+), 11 deletions(-) diff --git a/.github/workflows/test-endian.yml b/.github/workflows/test-endian.yml index 24f678ca1f..1912e95748 100644 --- a/.github/workflows/test-endian.yml +++ b/.github/workflows/test-endian.yml @@ -25,9 +25,14 @@ jobs: run: | export DEBIAN_FRONTEND=noninteractive sudo apt-get update -o Acquire::Retries=3 + # Ubuntu 26.04 dropped qemu-user-static: qemu-user carries the + # static emulators there, as qemu-ppc. + QEMU_PKG=qemu-user-static + apt-cache policy "$QEMU_PKG" | grep -q 'Candidate: [0-9]' \ + || QEMU_PKG=qemu-user sudo apt-get install --no-install-recommends -y -q \ -o Acquire::Retries=3 \ - gcc-powerpc-linux-gnu libc6-dev-powerpc-cross qemu-user-static \ + gcc-powerpc-linux-gnu libc6-dev-powerpc-cross "$QEMU_PKG" \ dosfstools mtools e2fsprogs # Fixture generation takes minutes, so prove the cross toolchain works @@ -39,8 +44,9 @@ jobs: powerpc-linux-gnu-gcc -static -o /tmp/be_probe /tmp/be_probe.c file /tmp/be_probe | grep -q 'MSB' \ || { echo "cross-compiler did not produce a big-endian binary"; exit 1; } - qemu-ppc-static /tmp/be_probe \ - || { echo "qemu-ppc-static cannot run a big-endian binary"; exit 1; } + QEMU_PPC=$(command -v qemu-ppc-static || command -v qemu-ppc) + "$QEMU_PPC" /tmp/be_probe \ + || { echo "$QEMU_PPC cannot run a big-endian binary"; exit 1; } echo "big-endian toolchain OK" - name: generate filesystem fixtures diff --git a/.github/workflows/test-sbom.yml b/.github/workflows/test-sbom.yml index 250b01a39d..4e54127444 100644 --- a/.github/workflows/test-sbom.yml +++ b/.github/workflows/test-sbom.yml @@ -43,7 +43,12 @@ on: jobs: sbom_canary: - runs-on: ubuntu-latest + # Held on 24.04: the macro capture runs each compiler at its own default + # language standard, and from GCC 15 that default is C23, which defines + # macros (the *_WIDTH family) that clang's default does not. + # The neutrality check below then fails on 26.04 until the capture pins a + # standard. + runs-on: ubuntu-24.04 timeout-minutes: 20 steps: diff --git a/.github/workflows/test-x86-fsp-qemu.yml b/.github/workflows/test-x86-fsp-qemu.yml index 9691dca4ba..f9688c604a 100644 --- a/.github/workflows/test-x86-fsp-qemu.yml +++ b/.github/workflows/test-x86-fsp-qemu.yml @@ -45,7 +45,7 @@ jobs: run: | export DEBIAN_FRONTEND=noninteractive sudo apt-get update -o Acquire::Retries=3 - sudo apt-get install --no-install-recommends -y -q -o Acquire::Retries=3 nasm gcc-multilib qemu-system-x86 swtpm uuid-dev + sudo apt-get install --no-install-recommends -y -q -o Acquire::Retries=3 nasm gcc-multilib qemu-system-x86 swtpm uuid-dev python3-setuptools - name: run test run: | ./tools/scripts/x86_fsp/qemu/test_qemu.sh @@ -65,7 +65,7 @@ jobs: run: | export DEBIAN_FRONTEND=noninteractive sudo apt-get update -o Acquire::Retries=3 - sudo apt-get install --no-install-recommends -y -q -o Acquire::Retries=3 nasm gcc-multilib qemu-system-x86 uuid-dev dosfstools mtools e2fsprogs + sudo apt-get install --no-install-recommends -y -q -o Acquire::Retries=3 nasm gcc-multilib qemu-system-x86 uuid-dev python3-setuptools dosfstools mtools e2fsprogs - name: run test run: | ./tools/scripts/x86_fsp/qemu/test_qemu.sh -f @@ -84,7 +84,7 @@ jobs: run: | export DEBIAN_FRONTEND=noninteractive sudo apt-get update -o Acquire::Retries=3 - sudo apt-get install --no-install-recommends -y -q -o Acquire::Retries=3 nasm gcc-multilib qemu-system-x86 swtpm uuid-dev + sudo apt-get install --no-install-recommends -y -q -o Acquire::Retries=3 nasm gcc-multilib qemu-system-x86 swtpm uuid-dev python3-setuptools - name: run test run: | ./tools/scripts/x86_fsp/qemu/test_qemu.sh -r diff --git a/arch.mk b/arch.mk index b5eccfc0ee..2be3f40c1b 100644 --- a/arch.mk +++ b/arch.mk @@ -2609,6 +2609,10 @@ endif # x86-64 FSP targets ifeq ("${FSP}", "1") CFLAGS+=-DWOLFBOOT_FSP=1 + # State the baseline CPU. A distribution compiler can default to a newer + # level (Ubuntu's amd64v3 variant targets x86-64-v3), and the BMI2-class + # instructions it then emits fault on a CPU, real or emulated, without them. + CFLAGS+=-march=x86-64 USE_GCC_HEADLESS=0 LD_START_GROUP = LD_END_GROUP = diff --git a/src/string.c b/src/string.c index e5bd12ef34..8519d5e8fa 100644 --- a/src/string.c +++ b/src/string.c @@ -257,6 +257,11 @@ int memcmp(const void *_s1, const void *_s2, size_t n) return diff; } +/* A C23 defines memchr as a macro that keeps the constness of + * its argument; this is the function itself. */ +#ifdef memchr +#undef memchr +#endif void* memchr(void const *s, int c_in, size_t n) { unsigned char c = (unsigned char)c_in; diff --git a/tools/fs-test/README.md b/tools/fs-test/README.md index cb0ecee56b..960a42d10c 100644 --- a/tools/fs-test/README.md +++ b/tools/fs-test/README.md @@ -82,7 +82,7 @@ Two notes on the fixtures: ## Big-endian coverage -`make check` also runs the fixtures as **big-endian PowerPC** under `qemu-user`, when `powerpc-linux-gnu-gcc` and `qemu-ppc-static` are installed. It skips with a note otherwise. +`make check` also runs the fixtures as **big-endian PowerPC** under `qemu-user`, when `powerpc-linux-gnu-gcc` and `qemu-ppc-static` (or `qemu-ppc`, on distributions whose `qemu-user` package replaced `qemu-user-static`) are installed. It skips with a note otherwise. This matters because the parsers read every multi-byte on-media field through byte-wise accessors (`fs_le16` / `fs_le32`) rather than casting a buffer to a struct. That should make them endian-neutral, and the big-endian run proves it instead of assuming it. diff --git a/tools/fs-test/runtests.sh b/tools/fs-test/runtests.sh index 7b8a8e7fe2..9d070dff06 100755 --- a/tools/fs-test/runtests.sh +++ b/tools/fs-test/runtests.sh @@ -65,8 +65,11 @@ neg ext4-4k.img 0 "/a/b/c/d/e/f/g/h/i/j/k/l.itb" "path too deep" # entries, and every FAT32/ext4 field. All of it is read byte-wise, so the # whole stack should be endian-neutral. Prove it by running the same # fixtures as big-endian PowerPC under qemu-user. +# The emulator is qemu-ppc-static where the qemu-user-static package exists, +# and qemu-ppc from qemu-user on distributions that dropped it. +QEMU_PPC=$(command -v qemu-ppc-static || command -v qemu-ppc || true) if command -v powerpc-linux-gnu-gcc >/dev/null 2>&1 && \ - command -v qemu-ppc-static >/dev/null 2>&1; then + [ -n "$QEMU_PPC" ]; then echo echo "=== big-endian (PowerPC), full stack incl. MBR/GPT ===" # Do NOT hide this build. A cross-compile failure here (a missing @@ -86,7 +89,7 @@ if command -v powerpc-linux-gnu-gcc >/dev/null 2>&1 && \ local img="$1" path="$2" [ -f "$F/$img" ] || return printf " %-26s " "$img" - if qemu-ppc-static ./fs-test-be verify "$F/$img" 0 "$path" \ + if "$QEMU_PPC" ./fs-test-be verify "$F/$img" 0 "$path" \ "$F/payload/os.itb" >/dev/null 2>&1; then echo "PASS"; pass=$((pass + 1)) else @@ -102,7 +105,7 @@ if command -v powerpc-linux-gnu-gcc >/dev/null 2>&1 && \ fi else echo - echo " (big-endian check skipped: needs powerpc-linux-gnu-gcc + qemu-ppc-static)" + echo " (big-endian check skipped: needs powerpc-linux-gnu-gcc + qemu-ppc-static or qemu-ppc)" fi echo diff --git a/tools/scripts/x86_fsp/qemu/qemu_build_fsp.sh b/tools/scripts/x86_fsp/qemu/qemu_build_fsp.sh index d3ee84b7ef..81f60b46ff 100755 --- a/tools/scripts/x86_fsp/qemu/qemu_build_fsp.sh +++ b/tools/scripts/x86_fsp/qemu/qemu_build_fsp.sh @@ -59,6 +59,9 @@ download_sbl_patch_and_patch_edkii() { } build_qemu_fsp() { + # This EDK2 release's host tools are pre-C23 code (old-style function + # declarations), and C23 is the default from GCC 15. + export BUILD_CC="${BUILD_CC:-gcc -std=gnu17}" (cd "$WORK_DIR/edk2" && python ./BuildFsp.py && cd BuildFsp &&