mirror of
https://github.com/intel/llvm.git
synced 2026-01-26 12:26:52 +08:00
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
This commit is contained in:
@@ -229,7 +229,11 @@ std::error_code ImportFile::parse() {
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user