[PECOFF] Fix arguments passed to lib.exe.

git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@203891 91177308-0d34-0410-b5e6-96231b3b80d8
[PECOFF] Fix link order.

LLD fails to link symbol "_main" if the symbol is in a library file and
the library file is given as a bare argument (i.e. not with /defaultlib
option). It's because library files given as bare arguments are processed
before other libraries given with /defaultlib, so when Linker finds msvcrtd
needs a definition for "_main", the file providing the main function has
already been processed and skipped. Linker don't revisit libraries if it's
not given with /defaultlib.

To fix it this patch change the way of command line handling; files end with
".lib" are treated as if they are given with /defaultlib. I don't believe
it's 100% correct behavior but it's better than before.

git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@203892 91177308-0d34-0410-b5e6-96231b3b80d8
[PECOFF] Handle large objects having more than 32768 sections.

The COFF spec says that the SectionNumber field in the symbol table is 16 bit
signed type, but MSVC treats the field as if it is unsigned.

git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@203901 91177308-0d34-0410-b5e6-96231b3b80d8
Remove redundant "virtual" keyword.

git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@203903 91177308-0d34-0410-b5e6-96231b3b80d8
[PECOFF] Support yet another new type of weak symbol.

COMDAT_SELECT_LARGEST is a COMDAT type that make linker to choose the largest
definition from among all of the definition of a symbol. If the size is the
same, the choice is arbitrary.

Differential Revision: http://llvm-reviews.chandlerc.com/D3011