The previous default behavior of LLD was --as-needed. LLD linked
against a DSO only if the DSO file was actually used to link an
executable (i.e. at least one symbol was resolved using the shared
library file.) What was missing was --no-as-needed support.
In this patch I added a boolean flag to FileNode for --as-needed.
I also added an accessor to DSO name to shared library file class.
It looks like all the needed entries will not be in link order. The loop(just above your change) goes over the list of files that are really needed and add its to the needed list.