Added -Wl and --as-needed flags