Skip to content

Commit

Permalink
make: more aggressively ensure static linkage
Browse files Browse the repository at this point in the history
`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.
  • Loading branch information
paradigm committed Aug 5, 2023
1 parent 72f235d commit cb13137
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit cb13137

Please sign in to comment.