File indexing completed on 2024-04-28 05:40:56

0001 /*
0002     Copyright (C) 2015 Volker Krause <vkrause@kde.org>
0003 
0004     This program is free software; you can redistribute it and/or modify it
0005     under the terms of the GNU Library General Public License as published by
0006     the Free Software Foundation; either version 2 of the License, or (at your
0007     option) any later version.
0008 
0009     This program is distributed in the hope that it will be useful, but WITHOUT
0010     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0011     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
0012     License for more details.
0013 
0014     You should have received a copy of the GNU General Public License
0015     along with this program.  If not, see <https://www.gnu.org/licenses/>.
0016 */
0017 
0018 #include <config-elf-dissector-version.h>
0019 
0020 #include <optimizers/dependencysorter.h>
0021 
0022 #include <elf/elffileset.h>
0023 
0024 #include <QCoreApplication>
0025 #include <QCommandLineParser>
0026 
0027 int main(int argc, char** argv)
0028 {
0029     QCoreApplication::setApplicationName(QStringLiteral("ELF Optimizer"));
0030     QCoreApplication::setOrganizationName(QStringLiteral("KDE"));
0031     QCoreApplication::setOrganizationDomain(QStringLiteral("kde.org"));
0032     QCoreApplication::setApplicationVersion(QStringLiteral(ELF_DISSECTOR_VERSION_STRING));
0033 
0034     QCoreApplication app(argc, argv);
0035 
0036     QCommandLineParser parser;
0037     parser.addHelpOption();
0038     parser.addVersionOption();
0039     parser.addPositionalArgument(QStringLiteral("elf"), QStringLiteral("ELF library to optimize"), QStringLiteral("<elf>"));
0040     parser.process(app);
0041 
0042     DependencySorter optimizer;
0043     foreach (const auto &fileName, parser.positionalArguments()) {
0044         ElfFileSet set;
0045         set.addFile(fileName);
0046         if (set.size() == 0)
0047             continue;
0048         optimizer.sortDtNeeded(&set);
0049     }
0050 
0051     return 0;
0052 }