Index: include/llvm/Support/COFF.h =================================================================== --- include/llvm/Support/COFF.h +++ include/llvm/Support/COFF.h @@ -657,7 +657,7 @@ } ImportNameType getNameType() const { - return static_cast((TypeInfo & 0x1C) >> 3); + return static_cast((TypeInfo & 0x1C) >> 2); } }; Index: test/tools/llvm-readobj/imports-mangle.test =================================================================== --- /dev/null +++ test/tools/llvm-readobj/imports-mangle.test @@ -0,0 +1,17 @@ +RUN: llvm-readobj --coff-imports %p/Inputs/imports.mangle.coff-x86_64 | FileCheck -check-prefix=X64 %s + +X64: Name type: undecorate +X64-NEXT: Symbol: __imp_?sym4@@YAHH@Z +X64-NEXT: Symbol: ?sym4@@YAHH@Z + +X64: Name type: noprefix +X64-NEXT: Symbol: __imp__sym3 +X64-NEXT: Symbol: _sym3 + +X64: Name type: name +X64-NEXT: Symbol: __imp_sym1 +X64-NEXT: Symbol: sym1 + +X64: Name type: ordinal +X64-NEXT: Symbol: __imp_sym2 +X64-NEXT: Symbol: sym2 Index: tools/llvm-readobj/llvm-readobj.cpp =================================================================== --- tools/llvm-readobj/llvm-readobj.cpp +++ tools/llvm-readobj/llvm-readobj.cpp @@ -460,6 +460,8 @@ } if (ObjectFile *Obj = dyn_cast(&*ChildOrErr.get())) dumpObject(Obj); + else if (COFFImportFile *Import = dyn_cast(&*ChildOrErr.get())) + dumpCOFFImportFile(Import); else reportError(Arc->getFileName(), readobj_error::unrecognized_file_format); }