From cb13137fcb92183acb0d76a93d56fd7ffa4aaeb1 Mon Sep 17 00:00:00 2001 From: Daniel Thau Date: Fri, 4 Aug 2023 22:29:28 -0400 Subject: [PATCH] make: more aggressively ensure static linkage `ldd` returns the same thing if something is statically linked as it does when it is dynamically linked to a library `ldd` can't find. Thus, the return value alone is not a reliable indicator of whether or not something is statically linked. In addition, check that `ldd` actually prints to stdout the expected string indicating the binary is not dynamically linked. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 4b07d8d4..b574152f 100644 --- a/Makefile +++ b/Makefile @@ -891,7 +891,7 @@ $(BUILD)/userland.tar: \ rm -f $(SLASHBR)/strata/local # ensure static for bin in $(SLASHBR)/bin/* $(SLASHBR)/libexec/*; do \ - if ldd "$$bin" >/dev/null 2>&1; then \ + if ldd "$$bin" >/dev/null 2>&1 || ! ldd "$$bin" 2>&1 | grep -q "not a dynamic executable" ; then \ echo "error: $$bin is dynamically linked"; exit 1; \ fi; \ done