about summary refs log tree commit diff stats
path: root/src/include
diff options
context:
space:
mode:
Diffstat (limited to 'src/include')
-rwxr-xr-xsrc/include/box64context.h6
-rwxr-xr-xsrc/include/elfloader.h4
-rwxr-xr-xsrc/include/librarian.h7
-rwxr-xr-xsrc/include/library.h14
-rw-r--r--src/include/symbols.h14
-rwxr-xr-xsrc/include/wrappedlibs.h4
6 files changed, 28 insertions, 21 deletions
diff --git a/src/include/box64context.h b/src/include/box64context.h
index 036a2b6d..17f4a2a0 100755
--- a/src/include/box64context.h
+++ b/src/include/box64context.h
@@ -14,6 +14,7 @@ typedef struct lib_s lib_t;
 typedef struct bridge_s bridge_t;
 typedef struct dlprivate_s dlprivate_t;
 typedef struct kh_symbolmap_s kh_symbolmap_t;
+typedef struct kh_defaultversion_s kh_defaultversion_t;
 typedef struct library_s library_t;
 typedef struct linkmap_s linkmap_t;
 typedef struct kh_threadstack_s kh_threadstack_t;
@@ -52,10 +53,7 @@ typedef struct needed_libs_s {
     library_t   **libs;
 } needed_libs_t;
 
-void add_neededlib(needed_libs_t* needed, library_t* lib);
 void free_neededlib(needed_libs_t* needed);
-void add_dependedlib(needed_libs_t* depended, library_t* lib);
-void free_dependedlib(needed_libs_t* depended);
 
 typedef struct base_segment_s {
     uintptr_t       base;
@@ -120,6 +118,8 @@ typedef struct box64context_s {
     kh_symbolmap_t      *almymap;       // link to the mysymbolmap if libOpenAL
     kh_symbolmap_t      *vkwrappers;    // the map of wrapper for VulkanProcs (TODO: check SDL2)
     kh_symbolmap_t      *vkmymap;       // link to the mysymbolmap of libGL
+    kh_defaultversion_t *globaldefver;  // the global default version for symbols (the XXX@@vvvv of symbols)
+    kh_defaultversion_t *weakdefver;    // the weak default version for symbols (the XXX@@vvvv of symbols)
     vkprocaddess_t      vkprocaddress;
 
     pthread_mutex_t     mutex_once;
diff --git a/src/include/elfloader.h b/src/include/elfloader.h
index ca7a6621..6846dcd4 100755
--- a/src/include/elfloader.h
+++ b/src/include/elfloader.h
@@ -63,6 +63,10 @@ const char* GetParentSymbolVersion(elfheader_t* h, int index);
 const char* VersionnedName(const char* name, int ver, const char* vername);
 int SameVersionnedSymbol(const char* name1, int ver1, const char* vername1, const char* name2, int ver2, const char* vername2);
 
+kh_mapsymbols_t* GetMapSymbols(elfheader_t* h);
+kh_mapsymbols_t* GetWeakSymbols(elfheader_t* h);
+kh_mapsymbols_t* GetLocalSymbols(elfheader_t* h);
+
 void* GetNativeSymbolUnversionned(void* lib, const char* name);
 
 void AddMainElfToLinkmap(elfheader_t* lib);
diff --git a/src/include/librarian.h b/src/include/librarian.h
index d2f0740c..a3fdfb3d 100755
--- a/src/include/librarian.h
+++ b/src/include/librarian.h
@@ -20,20 +20,15 @@ dlprivate_t *NewDLPrivate();
 void FreeDLPrivate(dlprivate_t **lib);
 
 box64context_t* GetLibrarianContext(lib_t* maplib);
-kh_mapsymbols_t* GetMapSymbol(lib_t* maplib);
-kh_mapsymbols_t* GetWeakSymbol(lib_t* maplib);
-kh_mapsymbols_t* GetLocalSymbol(lib_t* maplib);
 kh_mapsymbols_t* GetGlobalData(lib_t* maplib);
-int AddNeededLib(lib_t* maplib, needed_libs_t* neededlibs, library_t *deplib, int local, int bindnow, const char** paths, int npath, box64context_t* box64, x64emu_t* emu); // 0=success, 1=error
+int AddNeededLib(lib_t* maplib, needed_libs_t* neededlibs, library_t* deplib, int local, int bindnow, const char** paths, int npath, box64context_t* box64, x64emu_t* emu); // 0=success, 1=error
 library_t* GetLibMapLib(lib_t* maplib, const char* name);
 library_t* GetLibInternal(const char* name);
 uintptr_t FindGlobalSymbol(lib_t *maplib, const char* name, int version, const char* vername);
 int GetNoSelfSymbolStartEnd(lib_t *maplib, const char* name, uintptr_t* start, uintptr_t* end, elfheader_t* self, int version, const char* vername);
-int GetSelfSymbolStartEnd(lib_t *maplib, const char* name, uintptr_t* start, uintptr_t* end, elfheader_t *self, int version, const char* vername);
 int GetGlobalSymbolStartEnd(lib_t *maplib, const char* name, uintptr_t* start, uintptr_t* end, elfheader_t *self, int version, const char* vername);
 int GetGlobalNoWeakSymbolStartEnd(lib_t *maplib, const char* name, uintptr_t* start, uintptr_t* end, int version, const char* vername);
 int GetLocalSymbolStartEnd(lib_t *maplib, const char* name, uintptr_t* start, uintptr_t* end, elfheader_t *self, int version, const char* vername);
-int GetNoWeakSymbolStartEnd(lib_t *maplib, const char* name, uintptr_t* start, uintptr_t* end, elfheader_t *self, int version, const char* vername);
 elfheader_t* GetGlobalSymbolElf(lib_t *maplib, const char* name, int version, const char* vername);
 int IsGlobalNoWeakSymbolInNative(lib_t *maplib, const char* name, int version, const char* vername);
 
diff --git a/src/include/library.h b/src/include/library.h
index 1bd9be3a..b62e122d 100755
--- a/src/include/library.h
+++ b/src/include/library.h
@@ -9,8 +9,9 @@ typedef struct kh_symbolmap_s  kh_symbolmap_t;
 typedef struct box64context_s  box64context_t;
 typedef struct x64emu_s        x64emu_t;
 typedef struct needed_libs_s   needed_libs_t;
+typedef struct elfheader_s     elfheader_t;
 
-#define LIB_NATIVE      0
+#define LIB_WRAPPED     0
 #define LIB_EMULATED    1
 #define LIB_UNNKNOW     -1
 
@@ -23,9 +24,9 @@ void Free1Library(library_t **lib, x64emu_t* emu);
 
 char* GetNameLib(library_t *lib);
 int IsSameLib(library_t* lib, const char* path);    // check if lib is same (path -> name)
-int GetLibSymbolStartEnd(library_t* lib, const char* name, uintptr_t* start, uintptr_t* end, int version, const char* vername, int local);
-int GetLibNoWeakSymbolStartEnd(library_t* lib, const char* name, uintptr_t* start, uintptr_t* end, int version, const char* vername, int local);
-int GetLibLocalSymbolStartEnd(library_t* lib, const char* name, uintptr_t* start, uintptr_t* end, int version, const char* vername, int local);
+int GetLibGlobalSymbolStartEnd(library_t* lib, const char* name, uintptr_t* start, uintptr_t* end, int* weak, int version, const char* vername, int local);
+int GetLibWeakSymbolStartEnd(library_t* lib, const char* name, uintptr_t* start, uintptr_t* end, int* weak, int version, const char* vername, int local);
+int GetLibLocalSymbolStartEnd(library_t* lib, const char* name, uintptr_t* start, uintptr_t* end, int* weak, int version, const char* vername, int local);
 void fillGLProcWrapper(box64context_t* context);
 void freeGLProcWrapper(box64context_t* context);
 void fillALProcWrapper(box64context_t* context);
@@ -35,7 +36,8 @@ int GetNeededLibN(library_t* lib);
 library_t* GetNeededLib(library_t* lib, int idx);
 lib_t* GetMaplib(library_t* lib);
 
-int GetElfIndex(library_t* lib);    // -1 if no elf (i.e. native)
-void* GetHandle(library_t* lib);    // NULL if not native
+int GetElfIndex(library_t* lib);    // -1 if no elf (i.e. wrapped)
+elfheader_t* GetElf(library_t* lib);    // NULL if no elf (i.e. wrapped)
+void* GetHandle(library_t* lib);    // NULL if not wrapped
 
 #endif //__LIBRARY_H_
diff --git a/src/include/symbols.h b/src/include/symbols.h
index 49cd40f0..98eb9db7 100644
--- a/src/include/symbols.h
+++ b/src/include/symbols.h
@@ -14,11 +14,19 @@ void FreeMapSymbols(kh_mapsymbols_t** map);
 
 // replace if already there
 void AddSymbol(kh_mapsymbols_t *mapsymbols, const char* name, uintptr_t addr, uint32_t sz, int ver, const char* vername);
-uintptr_t FindSymbol(kh_mapsymbols_t *mapsymbols, const char* name, int ver, const char* vername, int local);
+uintptr_t FindSymbol(kh_mapsymbols_t *mapsymbols, const char* name, int ver, const char* vername, int local, const char* defver);
 // don't add if already there
 
-void AddWeakSymbol(kh_mapsymbols_t *mapsymbols, const char* name, uintptr_t addr, uint32_t sz, int ver, const char* vername);
-int GetSymbolStartEnd(kh_mapsymbols_t* mapsymbols, const char* name, uintptr_t* start, uintptr_t* end, int ver, const char* vername, int local);
+void AddUniqueSymbol(kh_mapsymbols_t *mapsymbols, const char* name, uintptr_t addr, uint32_t sz, int ver, const char* vername);
+int GetSymbolStartEnd(kh_mapsymbols_t* mapsymbols, const char* name, uintptr_t* start, uintptr_t* end, int ver, const char* vername, int local, const char* defver);
 const char* GetSymbolName(kh_mapsymbols_t* mapsymbols, void* p, uintptr_t* offs, uint32_t* sz, const char** vername);
 
+// default version handling
+KHASH_MAP_DECLARE_STR(defaultversion, const char*)
+kh_defaultversion_t* NewDefaultVersion();
+void FreeDefaultVersion(kh_defaultversion_t** def);
+
+void AddDefaultVersion(kh_defaultversion_t* def, const char* symname, const char* vername);
+const char* GetDefaultVersion(kh_defaultversion_t* def, const char* symname);
+
 #endif //__SYMBOLS_PRIVATE_H_
\ No newline at end of file
diff --git a/src/include/wrappedlibs.h b/src/include/wrappedlibs.h
index 5ff61939..871f7af0 100755
--- a/src/include/wrappedlibs.h
+++ b/src/include/wrappedlibs.h
@@ -7,7 +7,7 @@ typedef struct box64context_s  box64context_t;
 
 typedef int (*wrappedlib_init_t)(library_t * lib, box64context_t* box64);  // 0 = success
 typedef void (*wrappedlib_fini_t)(library_t * lib);
-typedef int (*wrappedlib_get_t)(library_t* lib, const char* name, uintptr_t *offs, uintptr_t *sz, int version, const char* vername, int local);
+typedef int (*wrappedlib_get_t)(library_t* lib, const char* name, uintptr_t *offs, uintptr_t *sz, int* weak, int version, const char* vername, int local);
 
 void setNeededLibs(library_t* lib, int n, ...);
 #define SETALT(A)       lib->w.altmy = strdup(#A)
@@ -17,8 +17,6 @@ typedef struct wrappedlib_s {
     const char*         name;
     wrappedlib_init_t   init;
     wrappedlib_fini_t   fini;
-    wrappedlib_get_t    get;
-    wrappedlib_get_t    getnoweak;
 } wrappedlib_t;
 
 #endif //__WRAPPEDLIBS_H__