Link with --as-needed.