Skip to content

Commit 2db01be

Browse files
fix: fix symbol search order issue
1 parent 1e593b6 commit 2db01be

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

library/src/main/cpp/linker/linker_symbol.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,19 @@ bool ProcessSymbol(LinkerSymbolCategory category,
2525
symbol.category, category);
2626
return true;
2727
}
28+
if (names.size() == 0) {
29+
LOGD("skip target symbol no name");
30+
return true;
31+
}
32+
symbol.name = *names.begin();
2833

2934
if (!symbol.CheckApi()) {
3035
LOGD("skip target symbol %s api level [%d, %d), current api level %d", names.size() > 0 ? *names.begin() : "",
3136
symbol.min_api, symbol.max_api, android_api);
3237

3338
return true;
3439
}
35-
if (names.size() == 0) {
36-
LOGD("skip target symbol no name");
37-
return true;
38-
}
40+
3941
for (const char *name : names) {
4042
uint64_t address = symbol_finder(name, Type, false);
4143
if (address == 0 && find_prefix) {
@@ -95,6 +97,8 @@ bool LinkerSymbol::LoadSymbol(LinkerSymbolCategory category) {
9597
}
9698

9799
PROCESS_SYMBOL(solist, "__dl__ZL6solist");
100+
PROCESS_SYMBOL(linker_soinfo, android_api >= __ANDROID_API_O__ ? "ld-android.so" : "libdl.so");
101+
98102
PROCESS_SYMBOL(g_ld_debug_verbosity, "__dl_g_ld_debug_verbosity");
99103
PROCESS_SYMBOL(g_linker_debug_config, "__dl_g_linker_debug_config");
100104
PROCESS_SYMBOL(g_linker_logger, "__dl_g_linker_logger");
@@ -146,8 +150,6 @@ bool LinkerSymbol::LoadSymbol(LinkerSymbolCategory category) {
146150
PROCESS_SYMBOL(g_soinfo_links_allocator, "__dl__ZL24g_soinfo_links_allocator");
147151
PROCESS_SYMBOL(g_namespace_allocator, "__dl__ZL21g_namespace_allocator");
148152
PROCESS_SYMBOL(g_namespace_list_allocator, "__dl__ZL26g_namespace_list_allocator");
149-
150-
PROCESS_SYMBOL(linker_soinfo, android_api >= __ANDROID_API_O__ ? "ld-android.so" : "libdl.so");
151153
return true;
152154
}
153155

0 commit comments

Comments
 (0)