Commit c944276c authored by Alexandre Lissy's avatar Alexandre Lissy
Browse files

Bug 1835231 - Use dlopen() wrapper for Android <= 22 r=gsvelto

parent 2fe74ec8
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -24,6 +24,14 @@ static inline T dlsym_wrapper(void* aHandle, const char* aName) {
#endif  // MOZ_LINKER
}

static inline void* dlopen_wrapper(const char* aPath, int flags) {
#ifdef MOZ_LINKER
  return __wrap_dlopen(aPath, flags);
#else
  return dlopen(aPath, flags);
#endif  // MOZ_LINKER
}

template <typename T>
static T get_real_symbol(const char* aName, T aReplacementSymbol) {
  // T can only be a function pointer
@@ -41,7 +49,7 @@ static T get_real_symbol(const char* aName, T aReplacementSymbol) {
    // libc.so. Note that this won't work if we're trying to interpose
    // functions that are in other libraries, but hopefully we'll never have
    // to do that.
    void* handle = dlopen("libc.so", RTLD_LAZY);
    void* handle = dlopen_wrapper("libc.so", RTLD_LAZY);

    if (handle) {
      real_symbol = dlsym_wrapper<T>(handle, aName);