34 lines
690 B
C++
Raw Normal View History

2019-03-23 23:13:52 +03:00
#include "elf.h"
#include <QFileInfo>
ELF::ELF()
{
}
2019-08-31 22:22:26 +03:00
bool ELF::getLibInfo(const QString &lib, LibInfo &info) const {
2019-03-23 23:13:52 +03:00
ElfReader reader(lib);
auto headers = reader.readHeaders();
if (headers.elfclass == ElfClass::Elf_ELFCLASS32) {
2019-04-05 14:23:42 +03:00
info.setPlatform(Unix32);
2019-03-23 23:13:52 +03:00
} else if (headers.elfclass == ElfClass::Elf_ELFCLASS64) {
2019-04-05 14:23:42 +03:00
info.setPlatform(Unix64);
2019-03-23 23:13:52 +03:00
} else {
2019-04-05 14:23:42 +03:00
info.setPlatform(UnknownPlatform);
2019-03-23 23:13:52 +03:00
return false;
}
2019-04-05 14:23:42 +03:00
info.setName(QFileInfo(lib).fileName());
info.setPath(QFileInfo(lib).absolutePath());
2019-03-23 23:13:52 +03:00
2019-04-05 16:52:53 +03:00
auto dep = reader.dependencies();
for (auto &i : dep) {
info.addDependncies(i.toUpper());
2019-03-23 23:13:52 +03:00
}
return true;
}