diff --git a/llvm/test/tools/llvm-nm/XCOFF/Inputs/test_gcc.o b/llvm/test/tools/llvm-nm/XCOFF/Inputs/test_gcc.o new file mode 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 GIT binary patch literal 0 Hc$@getTargetTriple()).isArch64Bit(); if (isa(Obj) || isa(Obj)) return false; + if (XCOFFObjectFile *XCOFFObj = dyn_cast(&Obj)) + return XCOFFObj->is64Bit(); + if (isa(Obj)) return false; if (TapiFile *Tapi = dyn_cast(&Obj)) @@ -903,6 +921,41 @@ return '?'; } +static char getSymbolNMTypeChar(XCOFFObjectFile &Obj, symbol_iterator I) { + Expected TypeOrErr = I->getType(); + if (!TypeOrErr) + reportWarning(TypeOrErr.takeError(), Obj.getFileName()); + + uint32_t SymType = TypeOrErr.get(); + + if (SymType == SymbolRef::ST_Debug) + return 'N'; + + if (SymType == SymbolRef::ST_File) + return 'f'; + + Expected SymSecOrErr = I->getSection(); + + if (!SymSecOrErr) + reportWarning(SymSecOrErr.takeError(), Obj.getFileName()); + + section_iterator SecIter = SymSecOrErr.get(); + + if (SecIter == Obj.section_end()) + return '?'; + + if (SecIter->isText()) + return 't'; + + if (SecIter->isData()) + return 'd'; + + if (SecIter->isBSS()) + return 'b'; + + return '?'; +} + static char getSymbolNMTypeChar(COFFImportFile &Obj) { switch (Obj.getCOFFImportHeader()->getType()) { case COFF::IMPORT_CODE: @@ -1051,6 +1104,8 @@ Ret = getSymbolNMTypeChar(*IR, I); else if (COFFObjectFile *COFF = dyn_cast(&Obj)) Ret = getSymbolNMTypeChar(*COFF, I); + else if (XCOFFObjectFile *XCOFF = dyn_cast(&Obj)) + Ret = getSymbolNMTypeChar(*XCOFF, I); else if (COFFImportFile *COFFImport = dyn_cast(&Obj)) Ret = getSymbolNMTypeChar(*COFFImport); else if (MachOObjectFile *MachO = dyn_cast(&Obj)) @@ -1637,6 +1692,7 @@ S.Address = 0; if (isa(&Obj)) S.Size = ELFSymbolRef(Sym).getSize(); + if (PrintAddress && isa(Obj)) { SymbolRef SymRef(Sym); Expected AddressOrErr = SymRef.getAddress();