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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301614 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Saleem Abdulrasool 2017-04-28 04:29:43 +00:00
parent a7fa95c0e5
commit df4f50c81f
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