diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2024-08-29 11:10:45 +0200 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2024-08-29 11:10:45 +0200 |
| commit | 4cdd46819fec91bdbdad4f7c50b665d43ec6f4a8 (patch) | |
| tree | e432705fc61a434e2405b2a6fda9611cdd4ea714 /src/elfs | |
| parent | 0450371e282bd5c4dbbceaeca590626304609036 (diff) | |
| download | box64-4cdd46819fec91bdbdad4f7c50b665d43ec6f4a8.tar.gz box64-4cdd46819fec91bdbdad4f7c50b665d43ec6f4a8.zip | |
[TRACE] Improved trace on symbol name
Diffstat (limited to 'src/elfs')
| -rw-r--r-- | src/elfs/elfloader.c | 19 | ||||
| -rw-r--r-- | src/elfs/elfloader32.c | 9 |
2 files changed, 28 insertions, 0 deletions
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); |