From: "David Nyström" <david.nystrom@est.tech>
To: yocto-patches@lists.yoctoproject.org
Cc: "David Nyström" <david.nystrom@est.tech>
Subject: [PATCH] test-glibc-symver: Add test for glibc version deps
Date: Mon, 30 Nov 2026 11:19:23 +0100 [thread overview]
Message-ID: <20261130101923.906076-1-david.nystrom@est.tech> (raw)
A symbol version the host's glibc doesn't have makes every process
libpseudo.so is preloaded into die, so it is worth noticing at build
time rather than on whichever host is oldest. Fail on the __isoc23_*
redirects, and on anything future needing more than
PSEUDO_MAX_GLIBC_VERSION (2.34 today)
Checked against both revisions of the io_uring mode parsing: it fails
on strtol() and passes on pseudo_strtol_wrapper().
AI-Generated: Uses Kiro CLI (claude-opus-5)
Signed-off-by: David Nyström <david.nystrom@est.tech>
---
test/test-glibc-symver.sh | 68 +++++++++++++++++++++++++++++++++++++++
1 file changed, 68 insertions(+)
create mode 100755 test/test-glibc-symver.sh
diff --git a/test/test-glibc-symver.sh b/test/test-glibc-symver.sh
new file mode 100755
index 0000000..da3d4c3
--- /dev/null
+++ b/test/test-glibc-symver.sh
@@ -0,0 +1,68 @@
+#!/bin/bash
+#
+# SPDX-License-Identifier: LGPL-2.1-only
+#
+# libpseudo.so is preloaded into every process of a build, and a native build
+# of pseudo is shared between hosts (Yocto ships one in sstate). A symbol
+# version the running host's glibc doesn't have is not ignored like a missing
+# preload: it is a fatal relocation error for every process, which is the
+# bitbake fakeroot worker dying before it reads its first byte.
+#
+# glibc 2.38 and later headers turn strtol(), strtoll() and atoi() into
+# __isoc23_* calls when _GNU_SOURCE is defined, which pseudo defines
+# everywhere, so those have to be reached through the wrappers in strtol.c and
+# pseudo_client_scanf.c. This checks none of them, and nothing else newer
+# than PSEUDO_MAX_GLIBC_VERSION, has crept back in.
+#
+# A host whose own glibc is no newer than PSEUDO_MAX_GLIBC_VERSION cannot link
+# anything too new in the first place, so a pass there says nothing about the
+# source: pre-2.38 headers emit no __isoc23_* redirect at all, and the same
+# tree built on a newer host can still fail.
+
+: "${PSEUDO_PREFIX:=$PWD}"
+: "${PSEUDO_MAX_GLIBC_VERSION:=2.34}"
+
+if ! command -v nm >/dev/null 2>&1; then
+ echo "no nm to read symbol versions with" >&2
+ exit 255
+fi
+
+files=()
+for f in "$PSEUDO_PREFIX"/lib*/libpseudo.so \
+ "$PSEUDO_PREFIX"/lib*/*/libpseudo.so \
+ "$PSEUDO_PREFIX"/bin/pseudo "$PSEUDO_PREFIX"/bin/pseudodb; do
+ [ -f "$f" ] && files+=("$f")
+done
+
+if [ ${#files[@]} -eq 0 ]; then
+ echo "nothing built to check in $PSEUDO_PREFIX" >&2
+ exit 255
+fi
+
+newer_than_max() {
+ [ "$(printf '%s\n%s\n' "$1" "$PSEUDO_MAX_GLIBC_VERSION" | sort -V |
+ tail -n 1)" != "$PSEUDO_MAX_GLIBC_VERSION" ]
+}
+
+# nm -D -u lists the symbols an object needs from elsewhere with the version
+# each resolves against, "U strtol@GLIBC_2.2.5", so what is left of those
+# lines once sed drops the symbol is the set of versions needed.
+rc=0
+seen=
+for f in "${files[@]}"; do
+ for v in $(nm -D -u "$f" 2>/dev/null | sed -n 's/.*@GLIBC_//p' | sort -u -V); do
+ seen=y
+ newer_than_max "$v" || continue
+
+ echo "$f needs GLIBC_$v, newer than the" >&2
+ echo " GLIBC_$PSEUDO_MAX_GLIBC_VERSION pseudo has to run against" >&2
+ rc=1
+ done
+done
+
+# nm prints @GLIBC_ only from binutils 2.35(2020) on, and everything checked here
+# needs something from glibc, so no versions at all means the check could not
+# be made rather than that it passed.
+[ -n "$seen" ] || { echo "nm reports no symbol versions" >&2; exit 255; }
+
+exit $rc
--
2.53.0
next reply other threads:[~2026-11-30 10:19 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-30 10:19 David Nyström [this message]
2026-11-30 11:03 ` [yocto-patches] [PATCH] test-glibc-symver: Add test for glibc version deps Yoann Congal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261130101923.906076-1-david.nystrom@est.tech \
--to=david.nystrom@est.tech \
--cc=yocto-patches@lists.yoctoproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.