Bug 1080342 - Change how the symbols the flash plugin uses are hooked on Android. r=snorp
With
bug 1077366, the linker makes the library containing it a fake
LD_PRELOAD. As a consequence, instead of, in the linker itself,
explicitely special-casing the symbols that disappeared in Android 4.4
that the flash plugin uses, it is now possible to use normal symbol
resolution to stubs defined separately in libmozglue.
--- a/mozglue/build/BionicGlue.cpp
+++ b/mozglue/build/BionicGlue.cpp
@@ -255,8 +255,25 @@ extern "C" NS_EXPORT size_t __wrap_strlc
extern "C" NS_EXPORT size_t __wrap_strlcpy(char * a0, const char * a1, size_t a2) { return __real_strlcpy(a0, a1, a2); }
extern "C" NS_EXPORT size_t __wrap_strcspn(const char * a0, const char * a1) { return __real_strcspn(a0, a1); }
extern "C" NS_EXPORT char* __wrap_strpbrk(const char * a0, const char * a1) { return __real_strpbrk(a0, a1); }
extern "C" NS_EXPORT char* __wrap_strsep(char ** a0, const char * a1) { return __real_strsep(a0, a1); }
extern "C" NS_EXPORT size_t __wrap_strspn(const char * a0, const char * a1) { return __real_strspn(a0, a1); }
extern "C" NS_EXPORT int __wrap_strcoll(const char * a0, const char * a1) { return __real_strcoll(a0, a1); }
extern "C" NS_EXPORT size_t __wrap_strxfrm(char * a0, const char * a1, size_t a2) { return __real_strxfrm(a0, a1, a2); }
#endif
+
+/* Flash plugin uses symbols that are not present in Android >= 4.4 */
+#ifndef MOZ_WIDGET_GONK
+namespace android {
+ namespace VectorImpl {
+ NS_EXPORT void reservedVectorImpl1(void) { }
+ NS_EXPORT void reservedVectorImpl2(void) { }
+ NS_EXPORT void reservedVectorImpl3(void) { }
+ NS_EXPORT void reservedVectorImpl4(void) { }
+ NS_EXPORT void reservedVectorImpl5(void) { }
+ NS_EXPORT void reservedVectorImpl6(void) { }
+ NS_EXPORT void reservedVectorImpl7(void) { }
+ NS_EXPORT void reservedVectorImpl8(void) { }
+ }
+}
+#endif
+
--- a/mozglue/linker/CustomElf.cpp
+++ b/mozglue/linker/CustomElf.cpp
@@ -69,21 +69,16 @@ void debug_phdr(const char *type, const
static int p_flags_to_mprot(Word flags)
{
return ((flags & PF_X) ? PROT_EXEC : 0) |
((flags & PF_W) ? PROT_WRITE : 0) |
((flags & PF_R) ? PROT_READ : 0);
}
-void
-__void_stub(void)
-{
-}
-
} /* anonymous namespace */
/**
* RAII wrapper for a mapping of the first page off a Mappable object.
* This calls Mappable::munmap instead of system munmap.
*/
class Mappable1stPagePtr: public GenericMappedPtr<Mappable1stPagePtr> {
public:
@@ -325,26 +320,16 @@ CustomElf::GetSymbolPtrInDeps(const char
#endif
} else if (symbol[0] == 's' && symbol[1] == 'i') {
if (strcmp(symbol + 2, "gnal") == 0)
return FunctionPtr(signal);
if (strcmp(symbol + 2, "gaction") == 0)
return FunctionPtr(sigaction);
}
-#define MISSING_FLASH_SYMNAME_START "_ZN7android10VectorImpl19reservedVectorImpl"
-
- // Android changed some symbols that Flash depended on in 4.4,
- // so stub those out here
- if (strncmp(symbol,
- MISSING_FLASH_SYMNAME_START,
- sizeof(MISSING_FLASH_SYMNAME_START) - 1) == 0) {
- return FunctionPtr(__void_stub);
- }
-
void *sym;
unsigned long hash = Hash(symbol);
/* self_elf should never be NULL, but better safe than sorry. */
if (ElfLoader::Singleton.self_elf) {
/* We consider the library containing this code a permanent LD_PRELOAD,
* so, check if the symbol exists here first. */