[PECOFF] Refactor _imp_ symbol generator.

We are going to have another type of jump table for the delay-load
import table. In order to prepare for that, we want to factor out
the function handling the jump table. No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@219446 91177308-0d34-0410-b5e6-96231b3b80d8
Reapply [ELF] Only mark as DT_NEEDED libs that are strictly necessary (r219353)

When committed in r219353, this patch originally caused problems because it was
not tested in debug build. In such scenarios, Driver.cpp adds two additional
passes. These passes serialize all atoms via YAML and reads it back. Since the
patch changed ObjectAtom to hold a new reference, the serialization was removing
the extra data.

This commit implements r219853 in another way, similar to the original MIPS way,
by using a StringSet that holds the names of all copied atoms instead of
directly holding a reference to the copied atom. In this way, this commit is
simpler and eliminate the necessity of changing the DefinedAtom hierarchy to
hold a new data.

Reviewers: shankarke

http://reviews.llvm.org/D5713


git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@219449 91177308-0d34-0410-b5e6-96231b3b80d8