-
Notifications
You must be signed in to change notification settings - Fork 11
A set of fixes related to clang, aarch64 and musl pecularities of vmstructs stack unwinder #199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
29fd728
433670e
98f565d
9c2aea9
06b2efe
0836db5
4882ffd
7a9a263
c90f352
e8c0470
e912ec8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,6 +29,8 @@ | |
| #define _FILE_OFFSET_BITS 64 | ||
| #include <unistd.h> | ||
|
|
||
| uintptr_t ElfParser::_root_symbols[LAST_ROOT_SYMBOL_KIND] = {0}; | ||
|
|
||
| ElfSection *ElfParser::findSection(uint32_t type, const char *name) { | ||
| if (_header == NULL) { | ||
| return NULL; | ||
|
|
@@ -348,6 +350,26 @@ void ElfParser::loadSymbols(bool use_debug) { | |
| } | ||
| } | ||
|
|
||
| void ElfParser::addSymbol(const void *start, int length, const char *name, bool update_bounds) { | ||
| _cc->add(start, length, name, update_bounds); | ||
| if (!strcmp("_start", name)) { | ||
| TEST_LOG("===> found _start"); | ||
| _root_symbols[_start] = (uintptr_t)start; | ||
| } else if (!strcmp("start_thread", name)) { | ||
| TEST_LOG("===> found start_thread"); | ||
| _root_symbols[start_thread] = (uintptr_t)start; | ||
| } else if (!strcmp("_ZL19thread_native_entryP6Thread", name)) { | ||
| TEST_LOG("===> found _ZL19thread_native_entryP6Thread"); | ||
| _root_symbols[_ZL19thread_native_entryP6Thread] = (uintptr_t)start; | ||
| } else if (!strcmp("_thread_start", name)) { | ||
| TEST_LOG("===> found _thread_start"); | ||
| _root_symbols[_thread_start] = (uintptr_t)start; | ||
| } else if (!strcmp("thread_start", name)) { | ||
| TEST_LOG("===> found thread_start"); | ||
| _root_symbols[thread_start] = (uintptr_t)start; | ||
| } | ||
| } | ||
|
|
||
| // Load symbols from /usr/lib/debug/.build-id/ab/cdef1234.debug, where | ||
| // abcdef1234 is Build ID | ||
| bool ElfParser::loadSymbolsUsingBuildId() { | ||
|
|
@@ -427,8 +449,7 @@ void ElfParser::loadSymbolTable(const char *symbols, size_t total_size, | |
| // Skip special AArch64 mapping symbols: $x and $d | ||
| if (sym->st_size != 0 || sym->st_info != 0 || | ||
| strings[sym->st_name] != '$') { | ||
| _cc->add(_base + sym->st_value, (int)sym->st_size, | ||
| strings + sym->st_name); | ||
| addSymbol(_base + sym->st_value, (int)sym->st_size, strings + sym->st_name); | ||
| } | ||
| } | ||
| } | ||
|
|
@@ -458,7 +479,7 @@ void ElfParser::addRelocationSymbols(ElfSection *reltab, const char *plt) { | |
| name[sizeof(name) - 1] = 0; | ||
| } | ||
|
|
||
| _cc->add(plt, PLT_ENTRY_SIZE, name); | ||
| addSymbol(plt, PLT_ENTRY_SIZE, name); | ||
| plt += PLT_ENTRY_SIZE; | ||
| } | ||
| } | ||
|
|
@@ -612,6 +633,16 @@ void Symbols::parseLibraries(CodeCacheArray *array, bool kernel_symbols) { | |
| // concurrent loading and unloading of shared libraries. | ||
| // Without it, we may access memory of a library that is being unloaded. | ||
| dl_iterate_phdr(parseLibrariesCallback, array); | ||
| TEST_LOG("Parsed %d libraries", array->count()); | ||
| } | ||
|
|
||
| bool Symbols::isRootSymbol(const void* address) { | ||
| for (int i = 0; i < LAST_ROOT_SYMBOL_KIND; i++) { | ||
| if (ElfParser::_root_symbols[i] == (uintptr_t)address) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. minor, the ordering could be smart (per code blob)
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, probably. I'll just let it dangling here. We are doing at most 5 comparisons which (I hope) compiler would just unroll anyway, and possibly vectorize. |
||
| return true; | ||
| } | ||
| } | ||
| return false; | ||
| } | ||
|
|
||
| #endif // __linux__ | ||
Uh oh!
There was an error while loading. Please reload this page.