Description: Link as needed
Author: Arno Töll <debian@toell.net>
Last-Update: 2025-09-12

* Makefile:
  + Add -Wl,--as-needed to LDFLAGS
--- a/Makefile
+++ b/Makefile
@@ -30,6 +30,7 @@
 
 CFLAGS  += -ggdb -O2 -fomit-frame-pointer -funroll-loops -fexpensive-optimizations \
           -ffast-math -Wall -g
+LDFLAGS += -Wl,--as-needed
 
 
 all: modules snowdrop toinstall
@@ -56,7 +57,7 @@
 	  echo "[+] Building 'sd-$$i'..." ; \
 	  ADDME="-lmd5"; \
 	  test "$$USEOPENSSL" = "" || ADDME="-DUSE_OPENSSL -lcrypto" ; \
-	  $(CC)  -DVER=\"$(VER)\" $(CFLAGS) -DTARGETLANG=\"$$i\" snowdrop.c lang-$$i.o -o sd-$$i $$ADDME || exit 1; \
+	  $(CC) $(LDFLAGS) -DVER=\"$(VER)\" $(CFLAGS) -DTARGETLANG=\"$$i\" snowdrop.c lang-$$i.o -o sd-$$i $$ADDME || exit 1; \
 	done; \
 	echo "[*] Main code compiled."
 
