1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 15:27:35 +00:00

LibELF: Make ELF::Loader RefCounted

This commit is contained in:
Itamar 2020-04-17 14:40:38 +03:00 committed by Andreas Kling
parent 5c1b3ce42e
commit edaa9c06d9
5 changed files with 15 additions and 10 deletions

View file

@ -28,6 +28,7 @@
#include <AK/Function.h>
#include <AK/HashMap.h>
#include <AK/NonnullRefPtr.h>
#include <AK/OwnPtr.h>
#include <AK/StringView.h>
#include <AK/Vector.h>
@ -42,9 +43,9 @@ class Region;
namespace ELF {
class Loader {
class Loader : public RefCounted<Loader> {
public:
explicit Loader(const u8*, size_t);
static NonnullRefPtr<Loader> create(const u8* data, size_t size) { return adopt(*new Loader(data, size)); }
~Loader();
bool load();
@ -67,6 +68,8 @@ public:
Optional<Image::Symbol> find_symbol(u32 address, u32* offset = nullptr) const;
private:
explicit Loader(const u8*, size_t);
bool layout();
bool perform_relocations();
void* lookup(const ELF::Image::Symbol&);