diff options
Diffstat (limited to 'lld/COFF/InputFiles.cpp')
-rw-r--r-- | lld/COFF/InputFiles.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lld/COFF/InputFiles.cpp b/lld/COFF/InputFiles.cpp index df3b6a032cf..4093b2faa6e 100644 --- a/lld/COFF/InputFiles.cpp +++ b/lld/COFF/InputFiles.cpp @@ -325,12 +325,21 @@ void ImportFile::parse() { this->Hdr = Hdr; ExternalName = ExtName; + // Instantiate symbol objects. ImpSym = cast<DefinedImportData>( Symtab->addImportData(ImpName, this)->body()); - if (Hdr->getType() == llvm::COFF::IMPORT_CONST) + + if (Hdr->getType() == llvm::COFF::IMPORT_CONST) { ConstSym = cast<DefinedImportData>(Symtab->addImportData(Name, this)->body()); + // A __imp_ and non-__imp_ symbols for the same dllimport'ed symbol + // should be gc'ed as a group. Add a bidirectional edge. + // Used by MarkLive.cpp. + ImpSym->Sibling = ConstSym; + ConstSym->Sibling = ImpSym; + } + // If type is function, we need to create a thunk which jump to an // address pointed by the __imp_ symbol. (This allows you to call // DLL functions just like regular non-DLL functions.) |