Bug 1543555 - Stop using our linker to resolve libc/libm symbols when not strictly necessary. r=froydnj

Differential Revision: https://phabricator.services.mozilla.com/D27019

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Mike Hommey 2019-04-12 02:12:31 +00:00
Родитель 349901dac4
Коммит 492bd126b6
1 изменённых файлов: 10 добавлений и 5 удалений

Просмотреть файл

@ -592,11 +592,16 @@ void ElfLoader::Init() {
self_elf = LoadedElf::Create(info.dli_fname, info.dli_fbase); self_elf = LoadedElf::Create(info.dli_fname, info.dli_fbase);
} }
#if defined(ANDROID) #if defined(ANDROID)
if (dladdr(FunctionPtr(syscall), &info) != 0) { // On Android < 5.0, resolving weak symbols via dlsym doesn't work.
libc = LoadedElf::Create(info.dli_fname, info.dli_fbase); // The weak symbols Gecko uses are in either libc or libm, so we
} // wrap those such that this linker does symbol resolution for them.
if (dladdr(FunctionPtr<int (*)(double)>(isnan), &info) != 0) { if (GetAndroidSDKVersion() < 21) {
libm = LoadedElf::Create(info.dli_fname, info.dli_fbase); if (dladdr(FunctionPtr(syscall), &info) != 0) {
libc = LoadedElf::Create(info.dli_fname, info.dli_fbase);
}
if (dladdr(FunctionPtr<int (*)(double)>(isnan), &info) != 0) {
libm = LoadedElf::Create(info.dli_fname, info.dli_fbase);
}
} }
#endif #endif
} }