Link binaries with -Wl,--as-needed to reduce library dependencies