From 4cdd46819fec91bdbdad4f7c50b665d43ec6f4a8 Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Thu, 29 Aug 2024 11:10:45 +0200 Subject: [TRACE] Improved trace on symbol name --- src/elfs/elfloader.c | 19 +++++++++++++++++++ src/elfs/elfloader32.c | 9 +++++++++ 2 files changed, 28 insertions(+) (limited to 'src/elfs') diff --git a/src/elfs/elfloader.c b/src/elfs/elfloader.c index d251abaa..9a7266f9 100644 --- a/src/elfs/elfloader.c +++ b/src/elfs/elfloader.c @@ -1712,6 +1712,25 @@ void* ElfGetWeakSymbolStartEnd(elfheader_t* head, uintptr_t *offs, uintptr_t *en return box64_is32bits?ElfGetWeakSymbolStartEnd32(head, offs, end, symname, ver, vername, local, veropt):ElfGetWeakSymbolStartEnd64(head, offs, end, symname, ver, vername, local, veropt); } +void* ElfGetSymbolStartEnd32(elfheader_t* head, uintptr_t *offs, uintptr_t *end, const char* symname, int* ver, const char** vername, int local, int* veropt) +#ifndef BOX32 +{ return NULL; } +#else + ; +#endif +void* ElfGetSymbolStartEnd64(elfheader_t* head, uintptr_t *offs, uintptr_t *end, const char* symname, int* ver, const char** vername, int local, int* veropt) +{ + Elf64_Sym* sym = ElfLocateSymbol(head, offs, end, symname, ver, vername, local, veropt); + if(!sym) return NULL; + if(offs) *offs = sym->st_value + head->delta; + if(end) *end = sym->st_value + head->delta + sym->st_size; + return sym; +} +void* ElfGetSymbolStartEnd(elfheader_t* head, uintptr_t *offs, uintptr_t *end, const char* symname, int* ver, const char** vername, int local, int* veropt) +{ + return box64_is32bits?ElfGetSymbolStartEnd32(head, offs, end, symname, ver, vername, local, veropt):ElfGetSymbolStartEnd64(head, offs, end, symname, ver, vername, local, veropt); +} + int ElfGetSymTabStartEnd32(elfheader_t* head, uintptr_t *offs, uintptr_t *end, const char* symname) #ifndef BOX32 { return 0; } diff --git a/src/elfs/elfloader32.c b/src/elfs/elfloader32.c index 2902dcc9..9f2dfa45 100644 --- a/src/elfs/elfloader32.c +++ b/src/elfs/elfloader32.c @@ -805,6 +805,15 @@ void* ElfGetWeakSymbolStartEnd32(elfheader_t* head, uintptr_t *offs, uintptr_t * return sym; } +void* ElfGetSymbolStartEnd32(elfheader_t* head, uintptr_t *offs, uintptr_t *end, const char* symname, int* ver, const char** vername, int local, int* veropt) +{ + Elf32_Sym* sym = ElfLocateSymbol(head, offs, end, symname, ver, vername, local, veropt); + if(!sym) return NULL; + if(offs) *offs = sym->st_value + head->delta; + if(end) *end = sym->st_value + head->delta + sym->st_size; + return sym; +} + int ElfGetSymTabStartEnd32(elfheader_t* head, uintptr_t *offs, uintptr_t *end, const char* symname) { Elf32_Sym* sym = ElfSymTabLookup32(head, symname); -- cgit 1.4.1