COFF Import: expose both symbols

COFF Import libraries which use the obsolete CONSTANT export are
supposed to get two symbols, one with the `_imp_` prefix and one
without.  Ensure that we expose both for iteration.  This is necessary
to fix the librarian with COFF CONSTANT exports.

llvm-svn: 301614
This commit is contained in:
Saleem Abdulrasool 2017-04-28 04:29:43 +00:00
parent 49e58e766b
commit 41d9ef3ced
3 changed files with 10 additions and 3 deletions

View File

@ -53,7 +53,7 @@ public:
basic_symbol_iterator symbol_end() const override {
DataRefImpl Symb;
Symb.p = isCode() ? 2 : 1;
Symb.p = isData() ? 1 : 2;
return BasicSymbolRef(Symb, this);
}
@ -63,8 +63,8 @@ public:
}
private:
bool isCode() const {
return getCOFFImportHeader()->getType() == COFF::IMPORT_CODE;
bool isData() const {
return getCOFFImportHeader()->getType() == COFF::IMPORT_DATA;
}
};

Binary file not shown.

View File

@ -0,0 +1,7 @@
RUN: llvm-readobj -coff-exports %S/Inputs/const-import.lib | FileCheck %s
CHECK: Type: const
CHECK: Name type: noprefix
CHECK: Symbol: __imp____CFConstantStringClassReference
CHECK: Symbol: ___CFConstantStringClassReference