MCPcopy Create free account
hub / github.com/FEX-Emu/FEX / LoadELF

Method LoadELF

Source/Tools/CommonTools/Linux/Utils/ELFContainer.cpp:152–177  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

150}
151
152bool ELFContainer::LoadELF(const fextl::string& Filename) {
153 if (!FEXCore::FileLoading::LoadFile(RawFile, Filename)) {
154 return false;
155 }
156
157 InterpreterHeader._64 = nullptr;
158
159 SectionHeaders.clear();
160 ProgramHeaders.clear();
161
162 uint8_t* Ident = reinterpret_cast<uint8_t*>(RawFile.data());
163
164 if (Ident[EI_MAG0] != ELFMAG0 || Ident[EI_MAG1] != ELFMAG1 || Ident[EI_MAG2] != ELFMAG2 || Ident[EI_MAG3] != ELFMAG3) {
165 LogMan::Msg::EFmt("ELF missing magic cookie");
166 return false;
167 }
168
169 if (Ident[EI_CLASS] == ELFCLASS32) {
170 return LoadELF_32();
171 } else if (Ident[EI_CLASS] == ELFCLASS64) {
172 return LoadELF_64();
173 }
174
175 LogMan::Msg::EFmt("Unknown ELF type");
176 return false;
177}
178
179bool ELFContainer::LoadELF_32() {
180 Mode = MODE_32BIT;

Callers

nothing calls this directly

Calls 3

LoadFileFunction · 0.85
EFmtFunction · 0.85
clearMethod · 0.80

Tested by

no test coverage detected