Bug 1442468 - Remove workaround for http://code.google.com/p/android/issues/detail?id=23203. r?froydnj draft
authorMike Hommey <mh+mozilla@glandium.org>
Thu, 01 Mar 2018 15:15:02 +0900
changeset 762295 9da181db8a5d9f0975527e2554524d7683c596b3
parent 759182 ad3c6f89d67752309a473e57a47fb88f9da37683
push id101124
push userbmo:mh+mozilla@glandium.org
push dateFri, 02 Mar 2018 00:32:51 +0000
bugs1442468, 23203, 720621, 734832
Bug 1442468 - Remove workaround for http://code.google.com/p/android/issues/detail?id=23203. r?froydnj That NDK bug has been fixed since r8c, and we now require something more recent than that. This effectively reverts the changes from bug 720621 and bug 734832.
--- a/memory/replace/logalloc/LogAlloc.cpp
+++ b/memory/replace/logalloc/LogAlloc.cpp
@@ -51,19 +51,16 @@ GetTid()
 #if defined(_WIN32)
   return size_t(GetCurrentThreadId());
   return size_t(pthread_self());
 #ifdef ANDROID
-/* See mozglue/android/APKOpen.cpp */
-extern "C" MOZ_EXPORT __attribute__((weak)) void* __dso_handle;
 /* Android doesn't have pthread_atfork defined in pthread.h */
 extern "C" MOZ_EXPORT int
 pthread_atfork(void (*)(void), void (*)(void), void (*)(void));
 class LogAllocBridge : public ReplaceMallocBridge
   virtual void InitDebugFd(mozilla::DebugFdRegistry& aRegistry) override
--- a/mozglue/android/APKOpen.cpp
+++ b/mozglue/android/APKOpen.cpp
@@ -54,32 +54,16 @@
  * is loaded.
 void make_dumpable() {
   prctl(PR_SET_DUMPABLE, 1);
-extern "C" {
- * To work around http://code.google.com/p/android/issues/detail?id=23203
- * we don't link with the crt objects. In some configurations, this means
- * a lack of the __dso_handle symbol because it is defined there, and
- * depending on the android platform and ndk versions used, it may or may
- * not be defined in libc.so. In the latter case, we fail to link. Defining
- * it here as weak makes us provide the symbol when it's not provided by
- * the crt objects, making the change transparent for future NDKs that
- * would fix the original problem. On older NDKs, it is not a problem
- * either because the way __dso_handle was used was already broken (and
- * the custom linker works around it).
- */
-  APKOPEN_EXPORT __attribute__((weak)) void *__dso_handle;
 typedef int mozglueresult;
 enum StartupEvent {
 #define mozilla_StartupTimeline_Event(ev, z) ev,
 #include "StartupTimeline.h"
 #undef mozilla_StartupTimeline_Event
--- a/old-configure.in
+++ b/old-configure.in
@@ -1649,52 +1649,16 @@ if test -n "$MOZ_LINKER"; then
 dnl gold emits wrong sysv-style elf hash tables when building both sysv and
 dnl style tables. https://sourceware.org/bugzilla/show_bug.cgi?id=13597
 dnl Since the linker only understands the sysv ones, no need to build the
 dnl gnu style tables anyways.
   LDFLAGS="$LDFLAGS -Wl,--hash-style=sysv"
-dnl The custom linker doesn't support text relocations, but NDK >= r6b
-dnl creates some (http://code.google.com/p/android/issues/detail?id=23203)
-dnl We however want to avoid these text relocations, and this can be done
-dnl by making gcc not link crtbegin and crtend. In the broken NDKs, crtend
-dnl doesn't contain anything at all, beside placeholders for some sections,
-dnl and crtbegin only contains a finalizer function that calls
-dnl __cxa_finalize. The custom linker actually takes care of calling
-dnl __cxa_finalize when the library doesn't call it itself, which makes it
-dnl safe not to link crtbegin. Besides, previous versions of the NDK didn't
-dnl link crtbegin and crtend at all.
-if test -n "$MOZ_LINKER" -a "$OS_TARGET" = "Android"; then
-  AC_CACHE_CHECK([whether the CRT objects have text relocations],
-    ac_cv_crt_has_text_relocations,
-    [echo 'int foo() { return 0; }' > conftest.cpp
-     if AC_TRY_COMMAND(${CXX-g++} -o conftest${DLL_SUFFIX} $CXXFLAGS $DSO_LDOPTS $LDFLAGS conftest.cpp $LIBS 1>&5) &&
-        test -s conftest${DLL_SUFFIX}; then
-       if ${TOOLCHAIN_PREFIX}readelf -d conftest${DLL_SUFFIX} | grep TEXTREL > /dev/null; then
-         ac_cv_crt_has_text_relocations=yes
-       else
-         ac_cv_crt_has_text_relocations=no
-       fi
-     else
-       AC_ERROR([couldn't compile a simple C file])
-     fi
-     rm -rf conftest*])
-  if test "$ac_cv_crt_has_text_relocations" = yes; then
-    dnl While we want libraries to skip the CRT files, we don't want
-    dnl executables to be treated the same way. We thus set the flag
-    dnl in DSO_LDOPTS and not LDFLAGS. However, to pass it to nspr,
-    dnl we need to use LDFLAGS because nspr doesn't inherit DSO_LDOPTS.
-    dnl Using LDFLAGS in nspr is safe, since we only really build
-    dnl libraries there.
-    DSO_LDOPTS="$DSO_LDOPTS -nostartfiles"
-  fi
 dnl End of C++ language/feature checks
 dnl ========================================================
 dnl =  Internationalization checks
 dnl ========================================================
 dnl Internationalization and Locale support is different