Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(32)

Unified Diff: third_party/android_crazy_linker/src/src/crazy_linker_shared_library.cpp

Issue 2945293002: crazy_linker: isnanf workaround, reloaded. (Closed)
Patch Set: . Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/android_crazy_linker/src/src/crazy_linker_shared_library.cpp
diff --git a/third_party/android_crazy_linker/src/src/crazy_linker_shared_library.cpp b/third_party/android_crazy_linker/src/src/crazy_linker_shared_library.cpp
index f9abd66240b453fe808ad701de04f5e897b1bb49..5e07ba6765a5a0ace26ed491fef2b737dedc5dce 100644
--- a/third_party/android_crazy_linker/src/src/crazy_linker_shared_library.cpp
+++ b/third_party/android_crazy_linker/src/src/crazy_linker_shared_library.cpp
@@ -62,6 +62,14 @@ namespace crazy {
namespace {
+int local_isnanf(float x) {
+ uint32_t bits;
+ memcpy(&bits, &x, sizeof bits);
+ if ((bits & 0x7f800000) != 0x7f800000)
+ return 0;
+ return (bits & 0x7fffff) ? 1 : 0;
+}
+
typedef SharedLibrary::linker_function_t linker_function_t;
typedef int (*JNI_OnLoadFunctionPtr)(void* vm, void* reserved);
typedef void (*JNI_OnUnloadFunctionPtr)(void* vm, void* reserved);
@@ -157,10 +165,15 @@ class SharedLibraryResolver : public ElfRelocations::SymbolResolver {
// isnanf never need be resolved in gcc builds.
//
// http://code.google.com/p/chromium/issues/detail?id=376828
- if (!address &&
- !strcmp(symbol_name, "isnanf") &&
- !strcmp(wrap->GetName(), "libm.so"))
+ if (!address && !strcmp(symbol_name, "isnanf") &&
+ !strcmp(wrap->GetName(), "libm.so")) {
address = ::dlsym(wrap->GetSystem(), "__isnanf");
+ if (!address) {
+ // __isnanf only exists on Android 21+, so use a local fallback
+ // if that doesn't exist either.
+ address = reinterpret_cast<void*>(&local_isnanf);
+ }
+ }
return address;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698