diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2022-10-22 20:57:31 +0200 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2022-10-22 20:57:31 +0200 |
| commit | 58cdb1bda2f2dd6a0bc5ea42e99b279fc687c06b (patch) | |
| tree | 099bf5dc7d814272d6842df6656c2e672d5a1143 /src/librarian/library_private.h | |
| parent | a530f565110875c431ff9600ee9da4a640599ec7 (diff) | |
| download | box64-58cdb1bda2f2dd6a0bc5ea42e99b279fc687c06b.tar.gz box64-58cdb1bda2f2dd6a0bc5ea42e99b279fc687c06b.zip | |
Refactored, again, elfloader symbol fetching (ported from box86)
Diffstat (limited to 'src/librarian/library_private.h')
| -rwxr-xr-x | src/librarian/library_private.h | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/src/librarian/library_private.h b/src/librarian/library_private.h index 34810f86..3015c55e 100755 --- a/src/librarian/library_private.h +++ b/src/librarian/library_private.h @@ -8,12 +8,13 @@ #include "wrappedlibs.h" #include "box64context.h" -typedef struct lib_s lib_t; -typedef struct bridge_s bridge_t; -typedef struct kh_bridgemap_s kh_bridgemap_t; -typedef struct kh_mapsymbols_s kh_mapsymbols_t; +typedef struct lib_s lib_t; +typedef struct bridge_s bridge_t; +typedef struct elfheader_s elfheader_t; +typedef struct kh_bridgemap_s kh_bridgemap_t; +typedef struct kh_mapsymbols_s kh_mapsymbols_t; +typedef struct x64emu_s x64emu_t; -typedef struct x64emu_s x64emu_t; typedef void (*wrapper_t)(x64emu_t* emu, uintptr_t fnc); typedef struct symbol2_s { @@ -54,9 +55,6 @@ typedef struct elib_s { int elf_index; elfheader_t *elf; int finalized; - kh_mapsymbols_t *mapsymbols; - kh_mapsymbols_t *weaksymbols; - kh_mapsymbols_t *localsymbols; } elib_t; typedef struct library_s { @@ -66,18 +64,24 @@ typedef struct library_s { int type; // 0: native(wrapped) 1: emulated(elf) -1: undetermined int active; wrappedlib_fini_t fini; - wrappedlib_get_t get; // get weak and no weak - wrappedlib_get_t getnoweak; // get only non weak symbol - wrappedlib_get_t getlocal; + wrappedlib_get_t getglobal; // get global (non-weak) + wrappedlib_get_t getweak; // get weak symbol + wrappedlib_get_t getlocal; // get local symbol union { wlib_t w; elib_t e; }; // private lib data needed_libs_t needed; - needed_libs_t depended; // used to free library - lib_t *maplib; // local maplib, for dlopen'd library with LOCAL binding (most of the dlopen) - kh_bridgemap_t *bridgemap; + needed_libs_t dependedby; // used to free library + lib_t *maplib; // local maplib, for dlopen'd library with LOCAL binding (most of the dlopen) + kh_bridgemap_t *gbridgemap; // global symbol bridgemap + kh_bridgemap_t *wbridgemap; // weak symbol bridgemap + kh_bridgemap_t *lbridgemap; // local symbol bridgemap } library_t; +void add_neededlib(needed_libs_t* needed, library_t* lib); +void free_neededlib(needed_libs_t* needed); +void add_dependedbylib(needed_libs_t* dependedby, library_t* lib); +void free_dependedbylib(needed_libs_t* dependedby); // type for map elements typedef struct map_onesymbol_s { @@ -97,7 +101,7 @@ typedef struct map_onedata_s { int weak; } map_onedata_t; -int getSymbolInMaps(library_t *lib, const char* name, int noweak, uintptr_t *addr, uintptr_t *size, int version, const char* vername, int local); // Add bridges to functions +int getSymbolInMaps(library_t *lib, const char* name, int noweak, uintptr_t *addr, uintptr_t *size, int *weak, int version, const char* vername, int local); // Add bridges to functions typedef struct linkmap_s { // actual struct link_map |