2023-05-23 04:48:25 +00:00
|
|
|
#include "Linker.h"
|
|
|
|
|
|
|
|
Linker::Linker()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
Linker::~Linker()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
Module* Linker::LoadModule(const std::string& elf_name)
|
|
|
|
{
|
|
|
|
auto* m = new Module;
|
2023-05-23 07:47:56 +00:00
|
|
|
m->elf = new Elf;
|
|
|
|
m->elf->Open(elf_name);//load elf
|
|
|
|
|
|
|
|
m_modules.push_back(m);//added it to load modules
|
2023-05-23 04:48:25 +00:00
|
|
|
|
|
|
|
return m;
|
2023-05-23 07:47:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Module* Linker::FindModule(/*u32 id*/)
|
|
|
|
{
|
|
|
|
//find module . TODO atm we only have 1 module so we don't need to iterate on vector
|
|
|
|
Module* m = m_modules.at(0);
|
|
|
|
|
|
|
|
if (m)
|
|
|
|
{
|
|
|
|
return m;
|
|
|
|
}
|
|
|
|
return nullptr;
|
2023-05-23 04:48:25 +00:00
|
|
|
}
|