llvm.org GIT mirror llvm / c5ea695
[llvm-readobj] Support -needed-libs option for COFF files This implements the -needed-libs option in the COFF dumper. Differential Revision: https://reviews.llvm.org/D41529 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321498 91177308-0d34-0410-b5e6-96231b3b80d8 Petr Hosek 2 years ago
3 changed file(s) with 27 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
0 RUN: llvm-readobj -needed-libs %p/Inputs/needed-libs.obj.coff-am64 | FileCheck %s
1
2 CHECK: NeededLibraries [
3 CHECK-NEXT: KERNEL32.dll
4 CHECK-NEXT: ]
8080 void printSymbols() override;
8181 void printDynamicSymbols() override;
8282 void printUnwindInfo() override;
83
84 void printNeededLibraries() override;
85
8386 void printCOFFImports() override;
8487 void printCOFFExports() override;
8588 void printCOFFDirectives() override;
15211524 }
15221525 }
15231526
1527 void COFFDumper::printNeededLibraries() {
1528 ListScope D(W, "NeededLibraries");
1529
1530 using LibsTy = std::vector;
1531 LibsTy Libs;
1532
1533 for (const ImportDirectoryEntryRef &DirRef : Obj->import_directories()) {
1534 StringRef Name;
1535 if (!DirRef.getName(Name))
1536 Libs.push_back(Name);
1537 }
1538
1539 std::stable_sort(Libs.begin(), Libs.end());
1540
1541 for (const auto &L : Libs) {
1542 outs() << " " << L << "\n";
1543 }
1544 }
1545
15241546 void COFFDumper::printImportedSymbols(
15251547 iterator_range Range) {
15261548 for (const ImportedSymbolRef &I : Range) {