From 362a3fde10a3bb2738fcf30ae2e2eaf4a53df042 Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Tue, 31 Oct 2023 15:38:31 +0100 Subject: [ELFLOADER] Changed how memory is managed in elfloader --- src/include/custommem.h | 1 + src/include/elfloader.h | 5 ++--- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/include') diff --git a/src/include/custommem.h b/src/include/custommem.h index 31b3f30e..ffd20af6 100644 --- a/src/include/custommem.h +++ b/src/include/custommem.h @@ -96,6 +96,7 @@ void* find32bitBlock(size_t size); void* find31bitBlockNearHint(void* hint, size_t size); void* find47bitBlock(size_t size); void* find47bitBlockNearHint(void* hint, size_t size); +void* find47bitBlockElf(size_t size, int mainbin); int isBlockFree(void* hint, size_t size); // unlock mutex that are locked by current thread (for signal handling). Return a mask of unlock mutex diff --git a/src/include/elfloader.h b/src/include/elfloader.h index d9d7f152..bc09ad31 100644 --- a/src/include/elfloader.h +++ b/src/include/elfloader.h @@ -14,6 +14,7 @@ typedef struct kh_defaultversion_s kh_defaultversion_t; typedef struct dynablock_s dynablock_t; #endif +// Open an elfheader. Transfert control of f to elfheader also! elfheader_t* LoadAndCheckElfHeader(FILE* f, const char* name, int exec); // exec : 0 = lib, 1 = exec void FreeElfHeader(elfheader_t** head); const char* ElfName(elfheader_t* head); @@ -22,11 +23,9 @@ void ElfAttachLib(elfheader_t* head, library_t* lib); // return 0 if OK int CalcLoadAddr(elfheader_t* head); -int AllocElfMemory(box64context_t* context, elfheader_t* head, int mainbin); +int AllocLoadElfMemory(box64context_t* context, elfheader_t* head, int mainbin); void FreeElfMemory(elfheader_t* head); -int LoadElfMemory(FILE* f, box64context_t* context, elfheader_t* head); int isElfHasNeededVer(elfheader_t* head, const char* libname, elfheader_t* verneeded); -int ReloadElfMemory(FILE* f, box64context_t* context, elfheader_t* head); int RelocateElf(lib_t *maplib, lib_t* local_maplib, int bindnow, elfheader_t* head); int RelocateElfPlt(lib_t *maplib, lib_t* local_maplib, int bindnow, elfheader_t* head); void CalcStack(elfheader_t* h, uint64_t* stacksz, size_t* stackalign); -- cgit 1.4.1