mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 07:07:45 +00:00
LibELF: Split do_relocation
into do_{direct,plt}_relocation
No functional changes intended. This is in preparation of a commit that overhauls how IFUNCs are resolved. This commit lets us move the implementation of PLT patching from `DynamicObject` to `DynamicLoader` where all other relocation code lives. For this, got[2] now stores the loader's address instead of the object's.
This commit is contained in:
parent
c4e0f5e5ee
commit
cd45c2d295
4 changed files with 82 additions and 56 deletions
|
@ -40,6 +40,8 @@ enum class ShouldInitializeWeak {
|
|||
No
|
||||
};
|
||||
|
||||
extern "C" FlatPtr _fixup_plt_entry(DynamicObject* object, u32 relocation_offset);
|
||||
|
||||
class DynamicLoader : public RefCounted<DynamicLoader> {
|
||||
public:
|
||||
static Result<NonnullRefPtr<DynamicLoader>, DlErrorMessage> try_create(int fd, DeprecatedString filepath);
|
||||
|
@ -113,6 +115,8 @@ private:
|
|||
ElfW(Phdr) m_program_header; // Explicitly a copy of the PHDR in the image
|
||||
};
|
||||
|
||||
friend FlatPtr _fixup_plt_entry(DynamicObject*, u32);
|
||||
|
||||
// Stage 1
|
||||
void load_program_headers();
|
||||
|
||||
|
@ -133,7 +137,8 @@ private:
|
|||
Success = 1,
|
||||
ResolveLater = 2,
|
||||
};
|
||||
RelocationResult do_relocation(DynamicObject::Relocation const&, ShouldInitializeWeak should_initialize_weak);
|
||||
RelocationResult do_direct_relocation(DynamicObject::Relocation const&, ShouldInitializeWeak);
|
||||
static RelocationResult do_plt_relocation(DynamicObject::Relocation const&);
|
||||
void do_relr_relocations();
|
||||
void find_tls_size_and_alignment();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue