2018-10-10 11:53:07 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <AK/HashMap.h>
|
|
|
|
#include <AK/OwnPtr.h>
|
|
|
|
#include <AK/Vector.h>
|
|
|
|
#include "ExecSpace.h"
|
|
|
|
#include "ELFImage.h"
|
|
|
|
|
|
|
|
class ELFLoader {
|
|
|
|
public:
|
2018-10-18 15:38:04 +02:00
|
|
|
ELFLoader(ExecSpace&, ByteBuffer&&);
|
2018-10-10 11:53:07 +02:00
|
|
|
~ELFLoader();
|
|
|
|
|
|
|
|
bool load();
|
|
|
|
|
|
|
|
private:
|
2018-10-25 10:00:37 +02:00
|
|
|
bool layout();
|
|
|
|
bool performRelocations();
|
2018-10-10 11:53:07 +02:00
|
|
|
void exportSymbols();
|
|
|
|
void* lookup(const ELFImage::Symbol&);
|
|
|
|
char* areaForSection(const ELFImage::Section&);
|
|
|
|
char* areaForSectionName(const char*);
|
|
|
|
|
|
|
|
ExecSpace& m_execSpace;
|
|
|
|
HashMap<String, char*> m_sections;
|
|
|
|
OwnPtr<ELFImage> m_image;
|
|
|
|
};
|
|
|
|
|