COFF: Support import-by-ordinal DLL imports.

Symbols exported by DLLs can be imported not by name but by
small number or ordinal. Usually, symbols have both ordinals
and names, and in that case ordinals are called "hints" and
used by the loader as hints.

However, symbols can have only ordinals. They are called
import-by-ordinal symbols. You need to manage ordinals by hand
so that they will never change if you choose to use the feature.
But it's supposed to make dynamic linking faster because
it needs no string comparison. Not sure if that claim still
stands in year 2015, though. Anyways, the feature exists,
and this patch implements that.

llvm-svn: 238780
diff --git a/lld/COFF/InputFiles.cpp b/lld/COFF/InputFiles.cpp
index e2a597a..0205328 100644
--- a/lld/COFF/InputFiles.cpp
+++ b/lld/COFF/InputFiles.cpp
@@ -229,7 +229,11 @@
   StringRef Name = StringAlloc.save(StringRef(Buf + sizeof(*Hdr)));
   StringRef ImpName = StringAlloc.save(Twine("__imp_") + Name);
   StringRef DLLName(Buf + sizeof(coff_import_header) + Name.size() + 1);
-  auto *ImpSym = new (Alloc) DefinedImportData(DLLName, ImpName, Name, Hdr);
+  StringRef ExternalName = Name;
+  if (Hdr->getNameType() == llvm::COFF::IMPORT_ORDINAL)
+    ExternalName = "";
+  auto *ImpSym = new (Alloc) DefinedImportData(DLLName, ImpName, ExternalName,
+                                               Hdr);
   SymbolBodies.push_back(ImpSym);
 
   // If type is function, we need to create a thunk which jump to an