1 /*
2     Copyright (C) 2015 Volker Krause <vkrause@kde.org>
3 
4     This program is free software; you can redistribute it and/or modify it
5     under the terms of the GNU Library General Public License as published by
6     the Free Software Foundation; either version 2 of the License, or (at your
7     option) any later version.
8 
9     This program is distributed in the hope that it will be useful, but WITHOUT
10     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
12     License for more details.
13 
14     You should have received a copy of the GNU General Public License
15     along with this program.  If not, see <https://www.gnu.org/licenses/>.
16 */
17 
18 #ifndef DEPENDENCIESCHECK_H
19 #define DEPENDENCIESCHECK_H
20 
21 class ElfFileSet;
22 class ElfFile;
23 class ElfSymbolTableEntry;
24 
25 #include <QPair>
26 #include <QVector>
27 
28 namespace DependenciesCheck
29 {
30     using UnusedDependencies = QVector<QPair<int, int>>;
31     /** Find all unused DT_NEEDED entries in the entire file set. */
32     UnusedDependencies unusedDependencies(ElfFileSet *fileSet, int fileToCheck = -1);
33 
34     /** Dump unused dependencies to stdout, for use in CLI tools. */
35     void printUnusedDependencies(ElfFileSet *fileSet, const UnusedDependencies &unusedDeps);
36 
37     /** Returns a list of symbols of @p providerFile used by @p userFile. */
38     QVector<ElfSymbolTableEntry*> usedSymbols(ElfFile *userFile, ElfFile* providerFile);
39     /** Returns the amount of symbols from @p providerFile used by @p userFile. */
40     int usedSymbolCount(ElfFile *userFile, ElfFile* providerFile);
41 }
42 
43 #endif // DEPENDENCIESCHECK_H
44