scons: Add '-Wl,--as-needed' to default LINKFLAGS
scons: Add '-Wl,--as-needed' to default LINKFLAGS

In current build flow, EXTRAS flag is evaluated before building gem5
tools and binaries. Such that, unneeded libraries may be linked into
gem5 binaries. Adding '-Wl,--as-needed' can fix this problem also
shrinks binaries.

Change-Id: Ifb001786a66b0dd9b29865e39a5740313002f250
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/24003
Reviewed-by: Jason Lowe-Power <68c46a606457643eab92053c1c05574abb26f861@lowepower.com>
Reviewed-by: Gabe Black <5c8aa1266c03186393d9e7b3b4e3b14239af8201@google.com>
Maintainer: Jason Lowe-Power <68c46a606457643eab92053c1c05574abb26f861@lowepower.com>
Tested-by: kokoro <2ac7b1f3fa578934c95181d4272be0d3bca00121@google.com>

gem5/gem5,gem5/gem5,gem5/gem5,gem5/gem5,gem5/gem5,gem5/gem5,gem5/gem5