[Buildroot] [PATCH 3/4] support/scripts/check-host-bins: skip RPATH check for missing libraries
Matthew Weber
matt at thewebers.ws
Wed Sep 9 12:39:24 UTC 2026
An ELF with only non-toolchain dependencies absent from HOST_DIR cannot use an
RPATH to find them. Report those missing dependencies, but skip the misleading
RPATH diagnostic.
Assisted-by: GitHub Copilot [VS Code]
Signed-off-by: Matthew Weber <matt at thewebers.ws>
---
Depends on v3 of the check-host-bins series:
https://patchwork.ozlabs.org/project/buildroot/list/?series=520240
The test script is available at:
https://gist.github.com/matthew-l-weber/34fae15a4319a81462961eadf0e31164
While exercising v3's missing-library check, an ELF with only external
non-toolchain dependencies was reported as both missing a library and missing
an RPATH. Since no relevant library exists in HOST_DIR, the latter diagnostic
is misleading.
Test 3h places /bin/ls in a synthetic HOST_DIR without its non-toolchain
dependencies. It verifies that check-host-bins reports the missing library
but does not also report an RPATH error when there is no HOST_DIR library to
locate.
Test 3l builds a binary with its non-toolchain dependency installed in the
synthetic HOST_DIR/lib but an invalid RPATH. It verifies that this valid
RPATH-check case still reports the RPATH diagnostic and not a missing-library
error.
support/scripts/check-host-bins | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/support/scripts/check-host-bins b/support/scripts/check-host-bins
index 5233f6cd1d..7e9b51cd4c 100755
--- a/support/scripts/check-host-bins
+++ b/support/scripts/check-host-bins
@@ -30,6 +30,7 @@ main() {
# shellcheck disable=SC2086 # we need the word splitting
printf ' - %s\n' ${missing_libs}
fi
+ any_lib_in_hostdir "${file}" "${hostdir}" || continue
check_elf_has_rpath "${file}" "${hostdir}" "${perpackagedir}" && continue
if [ ${rpath_hdr} -eq 0 ]; then
rpath_hdr=1
@@ -111,6 +112,18 @@ get_libs() {
)
}
+any_lib_in_hostdir() {
+ local file="${1}"
+ local hostdir="${2}"
+ local lib
+
+ while IFS= read -r lib; do
+ [ -e "${hostdir}/lib/${lib}" ] && return 0
+ done < <( get_libs "${file}" )
+
+ return 1
+}
+
# This function checks whether at least one of the RPATH of the given
# ELF executable (first argument) properly points to the host library
# directory (second argument), either through an absolute RPATH or a
--
2.39.5
More information about the buildroot
mailing list