diff --git a/build/autoconf/compiler-opts.m4 b/build/autoconf/compiler-opts.m4
index cb47cf7..3397d83 100644
--- a/build/autoconf/compiler-opts.m4
+++ b/build/autoconf/compiler-opts.m4
@@ -274,13 +274,13 @@ if test "$GNU_CC" -a "$GCC_USE_GNU_LD" -a -z "$MOZ_DISABLE_ICF" -a -z "$DEVELOPE
               'int main() {return foo() - bar();}' > conftest.${ac_ext}
         # If the linker supports ICF, foo and bar symbols will have
         # the same address
-        if AC_TRY_COMMAND([${CC-cc} -o conftest${ac_exeext} $LDFLAGS -Wl,--icf=safe -ffunction-sections conftest.${ac_ext} $LIBS 1>&2]) &&
-           test -s conftest${ac_exeext} &&
-           objdump -t conftest${ac_exeext} | awk changequote(<<, >>)'{a[<<$>>6] = <<$>>1} END {if (a["foo"] && (a["foo"] != a["bar"])) { exit 1 }}'changequote([, ]); then
-            LD_SUPPORTS_ICF=yes
-        else
+        #if AC_TRY_COMMAND([${CC-cc} -o conftest${ac_exeext} $LDFLAGS -Wl,--icf=safe -ffunction-sections conftest.${ac_ext} $LIBS 1>&2]) &&
+        #   test -s conftest${ac_exeext} &&
+        #   objdump -t conftest${ac_exeext} | awk changequote(<<, >>)'{a[<<$>>6] = <<$>>1} END {if (a["foo"] && (a["foo"] != a["bar"])) { exit 1 }}'changequote([, ]); then
+        #    LD_SUPPORTS_ICF=yes
+        #else
             LD_SUPPORTS_ICF=no
-        fi
+        #fi
         rm -rf conftest*])
     if test "$LD_SUPPORTS_ICF" = yes; then
         _SAVE_LDFLAGS="$LDFLAGS -Wl,--icf=safe"
@@ -319,11 +319,11 @@ if test "$GNU_CC" -a "$GCC_USE_GNU_LD" -a -z "$DEVELOPER_OPTIONS"; then
                   GC_SECTIONS_BREAKS_DEBUG_RANGES="no, but it's broken in some other way"
              fi
              rm -rf conftest*])
-         if test "$GC_SECTIONS_BREAKS_DEBUG_RANGES" = no; then
-             DSO_LDOPTS="$DSO_LDOPTS -Wl,--gc-sections"
-         fi
-    else
-        DSO_LDOPTS="$DSO_LDOPTS -Wl,--gc-sections"
+         #if test "$GC_SECTIONS_BREAKS_DEBUG_RANGES" = no; then
+             #DSO_LDOPTS="$DSO_LDOPTS -Wl,--gc-sections"
+         #fi
+    #else
+        #DSO_LDOPTS="$DSO_LDOPTS -Wl,--gc-sections"
     fi
 fi
 
diff --git a/client.mk b/client.mk
index b9c6b61..6ca57f0 100644
--- a/client.mk
+++ b/client.mk
@@ -68,7 +68,9 @@ ifeq (,$(strip $(AUTOCONF)))
 AUTOCONF=$(error Could not find autoconf 2.13)
 endif
 
-SH := /bin/sh
+#AUTOCONF=autoconf213
+
+SH := /bin/bash
 PERL ?= perl
 PYTHON ?= $(shell which python2.7 > /dev/null 2>&1 && echo python2.7 || echo python)
 
diff --git a/config/gcc-stl-wrapper.template.h b/config/gcc-stl-wrapper.template.h
index 00f46bd..0e2b2d5 100644
--- a/config/gcc-stl-wrapper.template.h
+++ b/config/gcc-stl-wrapper.template.h
@@ -17,6 +17,16 @@
 // Silence "warning: #include_next is a GCC extension"
 #pragma GCC system_header
 
+#if defined(DEBUG) && !defined(_GLIBCXX_DEBUG)
+// Enable checked iterators and other goodies
+//
+// FIXME/bug 551254: gcc's debug STL implementation requires -frtti.
+// Figure out how to resolve this with -fno-rtti.  Maybe build with
+// -frtti in DEBUG builds?
+//
+//  # define _GLIBCXX_DEBUG 1
+#endif
+
 #ifdef _WIN32
 // Suppress windef.h min and max macros - they make std::min/max not compile.
 #define NOMINMAX 1
@@ -26,17 +36,20 @@
 #ifndef moz_dont_include_mozalloc_for_cstdlib
 #  define moz_dont_include_mozalloc_for_cstdlib
 #endif
-#ifndef moz_dont_include_mozalloc_for_${HEADER}
-// mozalloc.h wants <new>; break the cycle by always explicitly
-// including <new> here.  NB: this is a tad sneaky.  Sez the gcc docs:
-//
-//    `#include_next' does not distinguish between <file> and "file"
-//    inclusion, nor does it check that the file you specify has the
-//    same name as the current file. It simply looks for the file
-//    named, starting with the directory in the search path after the
-//    one where the current file was found.
-#  include_next <new>
 
+// Include mozalloc after the STL header and all other headers it includes
+// have been preprocessed.
+#if !defined(MOZ_INCLUDE_MOZALLOC_H) && \
+    !defined(moz_dont_include_mozalloc_for_${HEADER})
+#  define MOZ_INCLUDE_MOZALLOC_H
+#  define MOZ_INCLUDE_MOZALLOC_H_FROM_${HEADER}
+#endif
+
+#pragma GCC visibility push(default)
+#include_next <${HEADER}>
+#pragma GCC visibility pop
+
+#ifdef MOZ_INCLUDE_MOZALLOC_H_FROM_${HEADER}
 // See if we're in code that can use mozalloc.  NB: this duplicates
 // code in nscore.h because nscore.h pulls in prtypes.h, and chromium
 // can't build with that being included before base/basictypes.h.
@@ -45,23 +58,8 @@
 #  else
 #    error "STL code can only be used with infallible ::operator new()"
 #  endif
-
-#endif
-
-#if defined(DEBUG) && !defined(_GLIBCXX_DEBUG)
-// Enable checked iterators and other goodies
-//
-// FIXME/bug 551254: gcc's debug STL implementation requires -frtti.
-// Figure out how to resolve this with -fno-rtti.  Maybe build with
-// -frtti in DEBUG builds?
-//
-//  # define _GLIBCXX_DEBUG 1
 #endif
 
-#pragma GCC visibility push(default)
-#include_next <${HEADER}>
-#pragma GCC visibility pop
-
 // gcc calls a __throw_*() function from bits/functexcept.h when it
 // wants to "throw an exception".  functexcept exists nominally to
 // support -fno-exceptions, but since we'll always use the system
diff --git a/config/make-stl-wrappers.py b/config/make-stl-wrappers.py
index 6e5f3f7..c0ab21c 100644
--- a/config/make-stl-wrappers.py
+++ b/config/make-stl-wrappers.py
@@ -30,7 +30,6 @@ def main(outdir, compiler, template_file, header_list_file):
         os.mkdir(outdir)
 
     template = open(template_file, 'r').read()
-    path_to_new = header_path('new', compiler)
 
     for header in open(header_list_file, 'r'):
         header = header.rstrip()
@@ -40,8 +39,7 @@ def main(outdir, compiler, template_file, header_list_file):
         path = header_path(header, compiler)
         with FileAvoidWrite(os.path.join(outdir, header)) as f:
             f.write(string.Template(template).substitute(HEADER=header,
-                                                         HEADER_PATH=path,
-                                                         NEW_HEADER_PATH=path_to_new))
+                                                         HEADER_PATH=path))
 
 
 if __name__ == '__main__':
diff --git a/config/rules.mk b/config/rules.mk
index 436a8c6..884bf6b 100644
--- a/config/rules.mk
+++ b/config/rules.mk
@@ -459,12 +459,12 @@ endif # AIX
 #
 ifeq ($(OS_ARCH),Linux)
 ifdef IS_COMPONENT
-EXTRA_DSO_LDOPTS += -Wl,-Bsymbolic
-endif
-ifdef LD_VERSION_SCRIPT
-EXTRA_DSO_LDOPTS += -Wl,--version-script,$(LD_VERSION_SCRIPT)
-EXTRA_DEPS += $(LD_VERSION_SCRIPT)
+#EXTRA_DSO_LDOPTS += -Wl,-Bsymbolic
 endif
+#ifdef LD_VERSION_SCRIPT
+#EXTRA_DSO_LDOPTS += -Wl,--version-script,$(LD_VERSION_SCRIPT)
+#EXTRA_DEPS += $(LD_VERSION_SCRIPT)
+#endif
 endif
 
 #
diff --git a/configure.in b/configure.in
index 9d37e7d..2ef2415 100644
--- a/configure.in
+++ b/configure.in
@@ -1377,26 +1377,26 @@ if test "$GNU_CC"; then
     CFLAGS=$_SAVE_CFLAGS
     AC_MSG_CHECKING([for -z noexecstack option to ld])
     _SAVE_LDFLAGS=$LDFLAGS
-    LDFLAGS="$LDFLAGS -Wl,-z,noexecstack"
-    AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
-                  AC_MSG_RESULT([no])
-                  LDFLAGS=$_SAVE_LDFLAGS)
+    dnl LDFLAGS="$LDFLAGS -Wl,-z,noexecstack"
+    dnl AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
+    dnl              AC_MSG_RESULT([no])
+    dnl              LDFLAGS=$_SAVE_LDFLAGS)
 
     AC_MSG_CHECKING([for -z text option to ld])
     _SAVE_LDFLAGS=$LDFLAGS
-    LDFLAGS="$LDFLAGS -Wl,-z,text"
-    AC_TRY_LINK(,,AC_MSG_RESULT([yes])
-                  [NSPR_LDFLAGS="$NSPR_LDFLAGS -Wl,-z,text"],
-                  AC_MSG_RESULT([no])
-                  LDFLAGS=$_SAVE_LDFLAGS)
+    dnl LDFLAGS="$LDFLAGS -Wl,-z,text"
+    dnl AC_TRY_LINK(,,AC_MSG_RESULT([yes])
+    dnl              [NSPR_LDFLAGS="$NSPR_LDFLAGS -Wl,-z,text"],
+    dnl              AC_MSG_RESULT([no])
+    dnl              LDFLAGS=$_SAVE_LDFLAGS)
 
-    AC_MSG_CHECKING([for --build-id option to ld])
+    dnl AC_MSG_CHECKING([for --build-id option to ld])
     _SAVE_LDFLAGS=$LDFLAGS
-    LDFLAGS="$LDFLAGS -Wl,--build-id"
-    AC_TRY_LINK(,,AC_MSG_RESULT([yes])
-                  [NSPR_LDFLAGS="$NSPR_LDFLAGS -Wl,--build-id"],
-                  AC_MSG_RESULT([no])
-                  LDFLAGS=$_SAVE_LDFLAGS)
+    dnl LDFLAGS="$LDFLAGS -Wl,--build-id"
+    dnl AC_TRY_LINK(,,AC_MSG_RESULT([yes])
+    dnl              [NSPR_LDFLAGS="$NSPR_LDFLAGS -Wl,--build-id"],
+    dnl              AC_MSG_RESULT([no])
+    dnl              LDFLAGS=$_SAVE_LDFLAGS)
 
     AC_MSG_CHECKING([for --ignore-unresolved-symbol option to ld])
     HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=
@@ -1446,7 +1446,7 @@ if test "$GNU_CC"; then
         # symbols for shared objects in some cases.
         if test -z "$MOZ_NO_WLZDEFS"; then
             # Don't allow undefined symbols in libraries
-            DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
+            #DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
 
             # BSDs need `environ' exposed for posix_spawn (bug 753046)
             case "$OS_TARGET" in
diff --git a/dom/xml/nsXMLContentSink.cpp b/dom/xml/nsXMLContentSink.cpp
index 2e34df0..a5acb68 100644
--- a/dom/xml/nsXMLContentSink.cpp
+++ b/dom/xml/nsXMLContentSink.cpp
@@ -4,6 +4,8 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
+#pragma GCC optimize 0
+
 #include "nsCOMPtr.h"
 #include "nsXMLContentSink.h"
 #include "nsIParser.h"
diff --git a/gfx/gl/GLContextProvider.h b/gfx/gl/GLContextProvider.h
index cfc3582..fb92878 100644
--- a/gfx/gl/GLContextProvider.h
+++ b/gfx/gl/GLContextProvider.h
@@ -12,6 +12,8 @@
 
 #include "nsSize.h" // for gfxIntSize (needed by GLContextProviderImpl.h below)
 
+ #define XP_PANDORA 1
+
 class nsIWidget;
 
 namespace mozilla {
diff --git a/gfx/gl/GLContextProviderEGL.cpp b/gfx/gl/GLContextProviderEGL.cpp
index 72d1a19..b7252d7 100644
--- a/gfx/gl/GLContextProviderEGL.cpp
+++ b/gfx/gl/GLContextProviderEGL.cpp
@@ -878,7 +878,9 @@ GLContextEGL::CreateEGLPixmapOffscreenContext(const gfxIntSize& size)
 already_AddRefed<GLContext>
 GLContextProviderEGL::CreateHeadless(bool)
 {
+    printf_stderr("GLContextProviderEGL::CreateForWindow...\n");
     if (!sEGLLibrary.EnsureInitialized()) {
+        printf_stderr("EGL not initialized!\n");
         return nullptr;
     }
 
diff --git a/gfx/skia/moz.build b/gfx/skia/moz.build
index 58eae87..086413e 100644
--- a/gfx/skia/moz.build
+++ b/gfx/skia/moz.build
@@ -961,7 +961,7 @@ elif CONFIG['CLANG_CL']:
     SOURCES['trunk/src/opts/SkBlurImage_opts_SSE4.cpp'].flags += ['-msse4.1']
 
 if CONFIG['GNU_CXX'] and CONFIG['CPU_ARCH'] == 'arm':
-    SOURCES['skia/src/opts/SkBlitRow_opts_arm.cpp'].flags += ['-fomit-frame-pointer']
+    SOURCES['trunk/src/opts/SkBlitRow_opts_arm.cpp'].flags += ['-fomit-frame-pointer']
 
 DEFINES['SKIA_IMPLEMENTATION'] = 1
 DEFINES['GR_IMPLEMENTATION'] = 1
diff --git a/gfx/thebes/gfxFT2Utils.cpp b/gfx/thebes/gfxFT2Utils.cpp
index cd202fa..ef64ba0 100644
--- a/gfx/thebes/gfxFT2Utils.cpp
+++ b/gfx/thebes/gfxFT2Utils.cpp
@@ -35,7 +35,7 @@ ScaleRoundDesignUnits(FT_Short aDesignMetric, FT_Fixed aScale)
 static void
 SnapLineToPixels(gfxFloat& aOffset, gfxFloat& aSize)
 {
-    gfxFloat snappedSize = std::max(floor(aSize + 0.5), 1.0);
+    gfxFloat snappedSize = std::max(floorf(aSize + 0.5), 1.0f);
     // Correct offset for change in size
     gfxFloat offset = aOffset - 0.5 * (aSize - snappedSize);
     // Snap offset
diff --git a/gfx/thebes/gfxFont.cpp b/gfx/thebes/gfxFont.cpp
index 6d950e5..e638d87 100644
--- a/gfx/thebes/gfxFont.cpp
+++ b/gfx/thebes/gfxFont.cpp
@@ -3335,10 +3335,10 @@ gfxFont::SanitizeMetrics(gfxFont::Metrics *aMetrics, bool aIsBadUnderlineFont)
         return;
     }
 
-    aMetrics->underlineSize = std::max(1.0, aMetrics->underlineSize);
-    aMetrics->strikeoutSize = std::max(1.0, aMetrics->strikeoutSize);
+    aMetrics->underlineSize = std::max((double)1.0, aMetrics->underlineSize);
+    aMetrics->strikeoutSize = std::max((double)1.0, aMetrics->strikeoutSize);
 
-    aMetrics->underlineOffset = std::min(aMetrics->underlineOffset, -1.0);
+    aMetrics->underlineOffset = std::min(aMetrics->underlineOffset, (double)-1.0);
 
     if (aMetrics->maxAscent < 1.0) {
         // We cannot draw strikeout line and overline in the ascent...
@@ -3360,7 +3360,7 @@ gfxFont::SanitizeMetrics(gfxFont::Metrics *aMetrics, bool aIsBadUnderlineFont)
     if (!mStyle.systemFont && aIsBadUnderlineFont) {
         // First, we need 2 pixels between baseline and underline at least. Because many CJK characters
         // put their glyphs on the baseline, so, 1 pixel is too close for CJK characters.
-        aMetrics->underlineOffset = std::min(aMetrics->underlineOffset, -2.0);
+        aMetrics->underlineOffset = std::min(aMetrics->underlineOffset, (double)-2.0);
 
         // Next, we put the underline to bottom of below of the descent space.
         if (aMetrics->internalLeading + aMetrics->externalLeading > aMetrics->underlineSize) {
@@ -3374,7 +3374,7 @@ gfxFont::SanitizeMetrics(gfxFont::Metrics *aMetrics, bool aIsBadUnderlineFont)
     // will stay within the boundary.
     else if (aMetrics->underlineSize - aMetrics->underlineOffset > aMetrics->maxDescent) {
         if (aMetrics->underlineSize > aMetrics->maxDescent)
-            aMetrics->underlineSize = std::max(aMetrics->maxDescent, 1.0);
+            aMetrics->underlineSize = std::max(aMetrics->maxDescent, (double)1.0);
         // The max underlineOffset is 1px (the min underlineSize is 1px, and min maxDescent is 0px.)
         aMetrics->underlineOffset = aMetrics->underlineSize - aMetrics->maxDescent;
     }
@@ -3385,7 +3385,7 @@ gfxFont::SanitizeMetrics(gfxFont::Metrics *aMetrics, bool aIsBadUnderlineFont)
     gfxFloat halfOfStrikeoutSize = floor(aMetrics->strikeoutSize / 2.0 + 0.5);
     if (halfOfStrikeoutSize + aMetrics->strikeoutOffset > aMetrics->maxAscent) {
         if (aMetrics->strikeoutSize > aMetrics->maxAscent) {
-            aMetrics->strikeoutSize = std::max(aMetrics->maxAscent, 1.0);
+            aMetrics->strikeoutSize = std::max(aMetrics->maxAscent, (double)1.0);
             halfOfStrikeoutSize = floor(aMetrics->strikeoutSize / 2.0 + 0.5);
         }
         gfxFloat ascent = floor(aMetrics->maxAscent + 0.5);
diff --git a/gfx/thebes/gfxFont.h b/gfx/thebes/gfxFont.h
index a9a91c0..a8a1b34 100644
--- a/gfx/thebes/gfxFont.h
+++ b/gfx/thebes/gfxFont.h
@@ -165,8 +165,8 @@ struct gfxFontStyle {
     // Not meant to be called when sizeAdjust = 0.
     gfxFloat GetAdjustedSize(gfxFloat aspect) const {
         NS_ASSERTION(sizeAdjust != 0.0, "Not meant to be called when sizeAdjust = 0");
-        gfxFloat adjustedSize = std::max(NS_round(size*(sizeAdjust/aspect)), 1.0);
-        return std::min(adjustedSize, FONT_MAX_SIZE);
+        gfxFloat adjustedSize = std::max(NS_round(size*(sizeAdjust/aspect)), (double)1.0);
+        return std::min(adjustedSize, (double)FONT_MAX_SIZE);
     }
 
     PLDHashNumber Hash() const {
diff --git a/gfx/thebes/gfxFontUtils.cpp b/gfx/thebes/gfxFontUtils.cpp
index fa5054f..21968e6 100644
--- a/gfx/thebes/gfxFontUtils.cpp
+++ b/gfx/thebes/gfxFontUtils.cpp
@@ -927,7 +927,8 @@ CopySwapUTF16(const uint16_t *aInBuf, uint16_t *aOutBuf, uint32_t aLen)
 {
     const uint16_t *end = aInBuf + aLen;
     while (aInBuf < end) {
-        uint16_t value = *aInBuf;
+        uint16_t value; 
+        memcpy(&value, aInBuf, sizeof(value));
         *aOutBuf = (value >> 8) | (value & 0xff) << 8;
         aOutBuf++;
         aInBuf++;
diff --git a/gfx/thebes/gfxQuaternion.h b/gfx/thebes/gfxQuaternion.h
index c9e9241..b6b7c5b 100644
--- a/gfx/thebes/gfxQuaternion.h
+++ b/gfx/thebes/gfxQuaternion.h
@@ -32,7 +32,7 @@ struct gfxQuaternion : public mozilla::gfx::BasePoint4D<gfxFloat, gfxQuaternion>
     }
 
     gfxQuaternion Slerp(const gfxQuaternion &aOther, gfxFloat aCoeff) {
-        gfxFloat dot = mozilla::clamped(DotProduct(aOther), -1.0, 1.0);
+        gfxFloat dot = mozilla::clamped((float)DotProduct(aOther), -1.0f, 1.0f);
         if (dot == 1.0) {
             return *this;
         }
diff --git a/gfx/ycbcr/ycbcr_to_rgb565.cpp b/gfx/ycbcr/ycbcr_to_rgb565.cpp
index 97c768a..5c48d52 100644
--- a/gfx/ycbcr/ycbcr_to_rgb565.cpp
+++ b/gfx/ycbcr/ycbcr_to_rgb565.cpp
@@ -65,7 +65,7 @@ typedef void (*yuv2rgb565_row_scale_nearest_func)(
 
 
 
-# if defined(MOZILLA_MAY_SUPPORT_NEON)
+# if 0//defined(MOZILLA_MAY_SUPPORT_NEON)
 
 extern "C" void ScaleYCbCr42xToRGB565_BilinearY_Row_NEON(
  const yuv2rgb565_row_scale_bilinear_ctx *ctx, int dither);
@@ -475,7 +475,7 @@ NS_GFX_(void) ScaleYCbCrToRGB565(const uint8_t *y_buf,
       source_uv_yoffs_q16 += 1<<(15+y_shift);
       if (yuv_type != YV24) {
         scale_row =
-#  if defined(MOZILLA_MAY_SUPPORT_NEON)
+#  if 0//defined(MOZILLA_MAY_SUPPORT_NEON)
          supports_neon() ? ScaleYCbCr42xToRGB565_BilinearY_Row_NEON :
 #  endif
          ScaleYCbCr42xToRGB565_BilinearY_Row_C;
@@ -547,7 +547,7 @@ NS_GFX_(bool) IsScaleYCbCrToRGB565Fast(int source_x0,
   // Very fast.
   if (width <= 0 || height <= 0)
     return true;
-#  if defined(MOZILLA_MAY_SUPPORT_NEON)
+#  if 0//defined(MOZILLA_MAY_SUPPORT_NEON)
   if (filter != FILTER_NONE) {
     int source_dx_q16;
     int source_dy_q16;
@@ -614,7 +614,7 @@ NS_GFX_(void) ConvertYCbCrToRGB565(const uint8* y_buf,
   int y_shift;
   x_shift = yuv_type != YV24;
   y_shift = yuv_type == YV12;
-#  ifdef MOZILLA_MAY_SUPPORT_NEON
+#  if 0//def MOZILLA_MAY_SUPPORT_NEON
   if (yuv_type != YV24 && supports_neon())
   {
     for (int i = 0; i < pic_height; i++) {
@@ -655,7 +655,7 @@ NS_GFX_(bool) IsConvertYCbCrToRGB565Fast(int pic_x,
                                          int pic_height,
                                          YUVType yuv_type)
 {
-#  if defined(MOZILLA_MAY_SUPPORT_NEON)
+#  if 0//defined(MOZILLA_MAY_SUPPORT_NEON)
   return (yuv_type != YV24 && supports_neon());
 #  else
   return false;
diff --git a/js/public/CallNonGenericMethod.h b/js/public/CallNonGenericMethod.h
index 6f8ba37..913e0bc 100644
--- a/js/public/CallNonGenericMethod.h
+++ b/js/public/CallNonGenericMethod.h
@@ -93,7 +93,7 @@ CallMethodIfWrapped(JSContext* cx, IsAcceptableThis test, NativeImpl impl,
 //       tail position in a JSNative.  Do not call it from any other place.
 //
 template<IsAcceptableThis Test, NativeImpl Impl>
-MOZ_ALWAYS_INLINE bool
+/*MOZ_ALWAYS_INLINE*/ bool
 CallNonGenericMethod(JSContext* cx, const CallArgs& args)
 {
     HandleValue thisv = args.thisv();
@@ -103,7 +103,7 @@ CallNonGenericMethod(JSContext* cx, const CallArgs& args)
     return detail::CallMethodIfWrapped(cx, Test, Impl, args);
 }
 
-MOZ_ALWAYS_INLINE bool
+/*MOZ_ALWAYS_INLINE*/static bool
 CallNonGenericMethod(JSContext* cx, IsAcceptableThis Test, NativeImpl Impl,
                      const CallArgs& args)
 {
diff --git a/js/public/Conversions.h b/js/public/Conversions.h
index e486d75..9df85ee 100644
--- a/js/public/Conversions.h
+++ b/js/public/Conversions.h
@@ -93,7 +93,7 @@ extern JS_PUBLIC_API(bool)
 OrdinaryToPrimitive(JSContext* cx, HandleObject obj, JSType type, MutableHandleValue vp);
 
 /* ES6 draft 20141224, 7.1.2. */
-MOZ_ALWAYS_INLINE bool
+/*MOZ_ALWAYS_INLINE*/static bool
 ToBoolean(HandleValue v)
 {
     if (v.isBoolean())
diff --git a/js/public/Id.h b/js/public/Id.h
index 692655b..b0e1cb2 100644
--- a/js/public/Id.h
+++ b/js/public/Id.h
@@ -74,7 +74,7 @@ JSID_IS_ZERO(jsid id)
     return JSID_BITS(id) == 0;
 }
 
-static MOZ_ALWAYS_INLINE bool
+static /*MOZ_ALWAYS_INLINE*/ bool
 JSID_IS_INT(jsid id)
 {
     return !!(JSID_BITS(id) & JSID_TYPE_INT);
diff --git a/js/src/builtin/RegExp.cpp b/js/src/builtin/RegExp.cpp
index 4793be3..4744687 100644
--- a/js/src/builtin/RegExp.cpp
+++ b/js/src/builtin/RegExp.cpp
@@ -3,7 +3,7 @@
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
+#pragma GCC optimize 2
 #include "builtin/RegExp.h"
 
 #include "mozilla/TypeTraits.h"
diff --git a/js/src/jit/BaselineDebugModeOSR.cpp b/js/src/jit/BaselineDebugModeOSR.cpp
index 1c8de6c..59a6407 100644
--- a/js/src/jit/BaselineDebugModeOSR.cpp
+++ b/js/src/jit/BaselineDebugModeOSR.cpp
@@ -1077,8 +1077,8 @@ EmitBaselineDebugModeOSRHandlerTail(MacroAssembler& masm, Register temp, bool re
     if (returnFromCallVM) {
         jumpRegs.take(ReturnReg);
     } else {
-        jumpRegs.take(R0);
-        jumpRegs.take(R1);
+        jumpRegs.take(js::jit::R0);
+        jumpRegs.take(js::jit::R1);
     }
     jumpRegs.take(BaselineFrameReg);
     Register target = jumpRegs.takeAny();
@@ -1088,8 +1088,8 @@ EmitBaselineDebugModeOSRHandlerTail(MacroAssembler& masm, Register temp, bool re
     if (returnFromCallVM) {
         masm.pop(ReturnReg);
     } else {
-        masm.popValue(R1);
-        masm.popValue(R0);
+        masm.popValue(js::jit::R1);
+        masm.popValue(js::jit::R0);
     }
 
     masm.jump(target);
diff --git a/js/src/jsarray.cpp b/js/src/jsarray.cpp
index 7b33cd9..3d38e05 100644
--- a/js/src/jsarray.cpp
+++ b/js/src/jsarray.cpp
@@ -2410,9 +2410,9 @@ js::array_splice_impl(JSContext* cx, unsigned argc, Value* vp, bool returnValueI
     /* Step 6. */
     uint32_t actualStart;
     if (relativeStart < 0)
-        actualStart = Max(len + relativeStart, 0.0);
+        actualStart = Max((float)(len) + (float)(relativeStart), 0.0f);
     else
-        actualStart = Min(relativeStart, double(len));
+        actualStart = Min((float)relativeStart, float(len));
 
     /* Step 7. */
     uint32_t actualDeleteCount;
@@ -2421,7 +2421,7 @@ js::array_splice_impl(JSContext* cx, unsigned argc, Value* vp, bool returnValueI
         RootedValue cnt(cx, args.length() >= 2 ? args[1] : Int32Value(0));
         if (!ToInteger(cx, cnt, &deleteCountDouble))
             return false;
-        actualDeleteCount = Min(Max(deleteCountDouble, 0.0), double(len - actualStart));
+        actualDeleteCount = Min(Max((float)deleteCountDouble, 0.0f), float(len - actualStart));
     } else {
         /*
          * Non-standard: if start was specified but deleteCount was omitted,
diff --git a/js/src/jscntxt.h b/js/src/jscntxt.h
index f5e38d3..a8546a8 100644
--- a/js/src/jscntxt.h
+++ b/js/src/jscntxt.h
@@ -650,7 +650,7 @@ extern const JSErrorFormatString js_ErrorFormatString[JSErr_Limit];
 
 namespace js {
 
-MOZ_ALWAYS_INLINE bool
+/*MOZ_ALWAYS_INLINE*/static bool
 CheckForInterrupt(JSContext* cx)
 {
     // Add an inline fast-path since we have to check for interrupts in some hot
diff --git a/js/src/jsnum.cpp b/js/src/jsnum.cpp
index 1628a70..9212f9b 100644
--- a/js/src/jsnum.cpp
+++ b/js/src/jsnum.cpp
@@ -8,6 +8,9 @@
  * JS number type and wrapper class.
  */
 
+#pragma GCC optimize "no-single-precision-constant"
+#pragma GCC optimize "no-fast-math"
+
 #include "jsnum.h"
 
 #include "mozilla/double-conversion.h"
diff --git a/js/src/json.cpp b/js/src/json.cpp
index 8034f5b..7dfbacc 100644
--- a/js/src/json.cpp
+++ b/js/src/json.cpp
@@ -642,7 +642,7 @@ js_Stringify(JSContext* cx, MutableHandleValue vp, JSObject* replacer_, Value sp
         /* Step 6. */
         double d;
         JS_ALWAYS_TRUE(ToInteger(cx, space, &d));
-        d = Min(10.0, d);
+        d = Min(10.0f, (float)d);
         if (d >= 1 && !gap.appendN(' ', uint32_t(d)))
             return false;
     } else if (space.isString()) {
diff --git a/js/src/jsstr.h b/js/src/jsstr.h
index b9ae3b8..5b6df0b 100644
--- a/js/src/jsstr.h
+++ b/js/src/jsstr.h
@@ -146,7 +146,7 @@ ToStringSlow(ExclusiveContext* cx, typename MaybeRooted<Value, allowGC>::HandleT
  * known not to be a string, use ToStringSlow instead.
  */
 template <AllowGC allowGC>
-static MOZ_ALWAYS_INLINE JSString*
+static /*MOZ_ALWAYS_INLINE*/ JSString*
 ToString(JSContext* cx, JS::HandleValue v)
 {
     if (v.isString())
diff --git a/js/src/shell/js.cpp b/js/src/shell/js.cpp
index 191ab90..ebea275 100644
--- a/js/src/shell/js.cpp
+++ b/js/src/shell/js.cpp
@@ -37,6 +37,7 @@
 # include <sys/stat.h>
 # include <sys/wait.h>
 # include <unistd.h>
+# include <linux/limits.h>
 #endif
 
 #include "jsapi.h"
diff --git a/js/src/vm/String.h b/js/src/vm/String.h
index 5a539b0..19a15ac 100644
--- a/js/src/vm/String.h
+++ b/js/src/vm/String.h
@@ -317,7 +317,7 @@ class JSString : public js::gc::TenuredCell
   public:
     /* All strings have length. */
 
-    MOZ_ALWAYS_INLINE
+    /*MOZ_ALWAYS_INLINE*/
     size_t length() const {
         return d.u1.length;
     }
@@ -624,12 +624,12 @@ class JSLinearString : public JSString
     MOZ_ALWAYS_INLINE
     const CharT* chars(const JS::AutoCheckCannotGC& nogc) const;
 
-    MOZ_ALWAYS_INLINE
+    /*MOZ_ALWAYS_INLINE*/
     const JS::Latin1Char* latin1Chars(const JS::AutoCheckCannotGC& nogc) const {
         return rawLatin1Chars();
     }
 
-    MOZ_ALWAYS_INLINE
+    /*MOZ_ALWAYS_INLINE*/
     const char16_t* twoByteChars(const JS::AutoCheckCannotGC& nogc) const {
         return rawTwoByteChars();
     }
@@ -1201,7 +1201,7 @@ JSString::getChar(js::ExclusiveContext* cx, size_t index, char16_t* code)
     return true;
 }
 
-MOZ_ALWAYS_INLINE JSLinearString*
+/*MOZ_ALWAYS_INLINE*/ JSLinearString*
 JSString::ensureLinear(js::ExclusiveContext* cx)
 {
     return isLinear()
diff --git a/js/src/vm/TypeInference-inl.h b/js/src/vm/TypeInference-inl.h
index 2f89552..1187e31 100644
--- a/js/src/vm/TypeInference-inl.h
+++ b/js/src/vm/TypeInference-inl.h
@@ -9,6 +9,8 @@
 #ifndef vm_TypeInference_inl_h
 #define vm_TypeInference_inl_h
 
+#pragma GCC optimize 1
+
 #include "vm/TypeInference.h"
 
 #include "mozilla/PodOperations.h"
diff --git a/layout/generic/ScrollbarActivity.cpp b/layout/generic/ScrollbarActivity.cpp
index 01296ce..d59ac86 100644
--- a/layout/generic/ScrollbarActivity.cpp
+++ b/layout/generic/ScrollbarActivity.cpp
@@ -363,8 +363,8 @@ SetOpacityOnElement(nsIContent* aContent, double aOpacity)
 bool
 ScrollbarActivity::UpdateOpacity(TimeStamp aTime)
 {
-  double progress = (aTime - mFadeBeginTime) / FadeDuration();
-  double opacity = 1.0 - std::max(0.0, std::min(1.0, progress));
+  float progress = (aTime - mFadeBeginTime) / FadeDuration();
+  float opacity = 1.0f - std::max(0.0f, std::min(1.0f, progress));
 
   // 'this' may be getting destroyed during SetOpacityOnElement calls.
   nsWeakFrame weakFrame((do_QueryFrame(mScrollableFrame)));
diff --git a/layout/generic/nsGfxScrollFrame.cpp b/layout/generic/nsGfxScrollFrame.cpp
index 181c872..e0bead8 100644
--- a/layout/generic/nsGfxScrollFrame.cpp
+++ b/layout/generic/nsGfxScrollFrame.cpp
@@ -1617,7 +1617,7 @@ public:
 
 protected:
   double ProgressAt(TimeStamp aTime) {
-    return clamped((aTime - mStartTime) / mDuration, 0.0, 1.0);
+    return clamped((aTime - mStartTime) / mDuration, (double)0.0, (double)1.0);
   }
 
   nscoord VelocityComponent(double aTimeProgress,
@@ -1740,7 +1740,7 @@ AsyncScroll::CalcDurationForEventTime(TimeStamp aTime, nsIAtom *aOrigin) {
                                          kDefaultDurationToIntervalRatio * 100) / 100.0;
 
     // Duration should be at least as long as the intervals -> ratio is at least 1
-    mIntervalRatio = std::max(1.0, mIntervalRatio);
+    mIntervalRatio = std::max((double)1.0, mIntervalRatio);
 
     if (mIsFirstIteration) {
       // Starting a new scroll (i.e. not when extending an existing scroll animation),
diff --git a/memory/mozalloc/mozalloc.h b/memory/mozalloc/mozalloc.h
index 2b370ec..acc9d4f 100644
--- a/memory/mozalloc/mozalloc.h
+++ b/memory/mozalloc/mozalloc.h
@@ -12,10 +12,16 @@
  * https://bugzilla.mozilla.org/show_bug.cgi?id=427099
  */
 
-#include <stdlib.h>
-#include <string.h>
 #if defined(__cplusplus)
 #  include <new>
+// Since libstdc++ 6, including the C headers (e.g. stdlib.h) instead of the
+// corresponding C++ header (e.g. cstdlib) can cause confusion in C++ code
+// using things defined there. Specifically, with stdlib.h, the use of abs()
+// in gfx/graphite2/src/inc/UtfCodec.h somehow ends up picking the wrong abs()
+#  include <cstdlib>
+#  include <cstring>
+#else
+#  include <stdlib.h>
 #endif
 #include "xpcom-config.h"
 
diff --git a/mfbt/Vector.h b/mfbt/Vector.h
index 712521c..77f456c 100644
--- a/mfbt/Vector.h
+++ b/mfbt/Vector.h
@@ -732,7 +732,7 @@ VectorBase<T, N, AP, TV>::operator=(TV&& aRhs)
 }
 
 template<typename T, size_t N, class AP, class TV>
-MOZ_ALWAYS_INLINE
+/*MOZ_ALWAYS_INLINE*/ static
 VectorBase<T, N, AP, TV>::~VectorBase()
 {
   MOZ_REENTRANCY_GUARD_ET_AL;
diff --git a/modules/libjar/nsZipArchive.cpp b/modules/libjar/nsZipArchive.cpp
index eaf22ac..5f7bad2 100644
--- a/modules/libjar/nsZipArchive.cpp
+++ b/modules/libjar/nsZipArchive.cpp
@@ -16,6 +16,7 @@
 #include "plarena.h"
 
 #define READTYPE  int32_t
+#include <linux/limits.h>
 #include "zlib.h"
 #include "nsISupportsUtils.h"
 #include "prio.h"
@@ -28,6 +29,8 @@
 #include "prenv.h"
 #if defined(XP_WIN)
 #include <windows.h>
+#else
+#include <linux/limits.h>
 #endif
 
 // For placement new used for arena allocations of zip file list
diff --git a/netwerk/base/nsSocketTransportService2.cpp b/netwerk/base/nsSocketTransportService2.cpp
index 2bdc7b8..9a441af 100644
--- a/netwerk/base/nsSocketTransportService2.cpp
+++ b/netwerk/base/nsSocketTransportService2.cpp
@@ -41,6 +41,44 @@ PRThread                 *gSocketThread           = nullptr;
 #define SOCKET_LIMIT_MIN     50U
 #define BLIP_INTERVAL_PREF "network.activity.blipIntervalMilliseconds"
 
+extern "C" {
+// those 3 function needs implementation, as the link operation when cross-compiling for the Pandora will fail to link the one from libc...
+ static u_long myNextRandom = 1;
+
+ int rand(void)
+ {
+    return (int)((myNextRandom = (1103515245 * myNextRandom) + 12345) % ((u_long)RAND_MAX + 1));
+ }
+
+ void srand(u_int seed)
+ {
+    myNextRandom = seed;
+ }
+
+ void *bsearch(const void *key, const void *base, size_t num, size_t size,
+	      int (*cmp)(const void *key, const void *elt))
+ {
+	const char *pivot;
+	int result;
+
+	while (num > 0) {
+		pivot = base + (num >> 1) * size;
+		result = cmp(key, pivot);
+
+		if (result == 0)
+			return (void *)pivot;
+
+		if (result > 0) {
+			base = pivot + size;
+			num--;
+		}
+		num >>= 1;
+	}
+
+	return NULL;
+ }
+}
+
 uint32_t nsSocketTransportService::gMaxCount;
 PRCallOnceType nsSocketTransportService::gMaxCountInitOnce;
 
diff --git a/netwerk/build/nsNetModule.cpp b/netwerk/build/nsNetModule.cpp
index 63d31b3..8dad43f 100644
--- a/netwerk/build/nsNetModule.cpp
+++ b/netwerk/build/nsNetModule.cpp
@@ -4,6 +4,8 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
+#pragma GCC optimize 1
+
 #include "necko-config.h"
 
 #define ALLOW_LATE_HTTPLOG_H_INCLUDE 1
diff --git a/nsprpub/pr/src/misc/prenv.c b/nsprpub/pr/src/misc/prenv.c
index cc2e198..d0fdef2 100644
--- a/nsprpub/pr/src/misc/prenv.c
+++ b/nsprpub/pr/src/misc/prenv.c
@@ -72,7 +72,7 @@ PR_IMPLEMENT(char*) PR_GetEnv(const char *var)
 
 PR_IMPLEMENT(char*) PR_GetEnvSecure(const char *var)
 {
-#ifdef HAVE_SECURE_GETENV
+#if 0//def HAVE_SECURE_GETENV
   char *ev;
 
   if (!_pr_initialized) _PR_ImplicitInitialization();
@@ -83,7 +83,7 @@ PR_IMPLEMENT(char*) PR_GetEnvSecure(const char *var)
 
   return ev;
 #else
-#ifdef XP_UNIX
+#if 1//def XP_UNIX
   /*
   ** Fall back to checking uids and gids.  This won't detect any other
   ** privilege-granting mechanisms the platform may have.  This also
diff --git a/nsprpub/pr/src/pthreads/ptthread.c b/nsprpub/pr/src/pthreads/ptthread.c
index 9e12606..d61c588 100644
--- a/nsprpub/pr/src/pthreads/ptthread.c
+++ b/nsprpub/pr/src/pthreads/ptthread.c
@@ -35,7 +35,7 @@
 #ifdef _PR_NICE_PRIORITY_SCHEDULING
 #undef _POSIX_THREAD_PRIORITY_SCHEDULING
 #include <sys/resource.h>
-#ifndef HAVE_GETTID
+#if 1//ndef HAVE_GETTID
 #define gettid() (syscall(SYS_gettid))
 #endif
 #endif
diff --git a/security/nss/cmd/shlibsign/Makefile b/security/nss/cmd/shlibsign/Makefile
index 83f90fa..5a9acf9 100644
--- a/security/nss/cmd/shlibsign/Makefile
+++ b/security/nss/cmd/shlibsign/Makefile
@@ -39,6 +39,7 @@ EXTRA_SHARED_LIBS += \
 	-lplc4 \
 	-lplds4 \
 	-lnspr4 \
+	-lrt \
 	$(NULL)
 
 endif
diff --git a/security/nss/cmd/shlibsign/mangle/Makefile b/security/nss/cmd/shlibsign/mangle/Makefile
index b52243e..ee54ee6 100644
--- a/security/nss/cmd/shlibsign/mangle/Makefile
+++ b/security/nss/cmd/shlibsign/mangle/Makefile
@@ -39,6 +39,7 @@ EXTRA_SHARED_LIBS += \
 	-lplc4 \
 	-lplds4 \
 	-lnspr4 \
+	-lrt \
 	$(NULL)
 
 endif
diff --git a/toolkit/library/libxul.mk b/toolkit/library/libxul.mk
index 9e7e8be..910479f 100644
--- a/toolkit/library/libxul.mk
+++ b/toolkit/library/libxul.mk
@@ -6,13 +6,13 @@ EXTRA_DEPS += $(topsrcdir)/toolkit/library/libxul.mk
 
 ifeq (Linux,$(OS_ARCH))
 ifneq (Android,$(OS_TARGET))
-OS_LDFLAGS += -Wl,-version-script,symverscript
+#OS_LDFLAGS += -Wl,-version-script,symverscript
 
 symverscript: $(topsrcdir)/toolkit/library/symverscript.in
 	$(call py_action,preprocessor, \
 		-DVERSION='xul$(MOZILLA_SYMBOLVERSION)' $< -o $@)
 
-EXTRA_DEPS += symverscript
+#EXTRA_DEPS += symverscript
 endif
 endif
 
@@ -34,13 +34,13 @@ endif
 # the linker script is given after crtbegin.o, and even past that, replaces
 # the default section rules with those from the script instead of
 # supplementing them. Which leads to a lib with a huge load of sections.
-ifneq (OpenBSD,$(OS_TARGET))
-ifneq (WINNT,$(OS_TARGET))
-ifdef LD_IS_BFD
-OS_LDFLAGS += $(topsrcdir)/toolkit/library/StaticXULComponents.ld
-endif
-endif
-endif
+#ifneq (OpenBSD,$(OS_TARGET))
+#ifneq (WINNT,$(OS_TARGET))
+#ifdef LD_IS_BFD
+#OS_LDFLAGS += $(topsrcdir)/toolkit/library/StaticXULComponents.ld
+#endif
+#endif
+#endif
 
 ifdef _MSC_VER
 get_first_and_last = dumpbin -exports $1 | grep _NSModule@@ | sort -k 3 | sed -n 's/^.*?\([^@]*\)@@.*$$/\1/;1p;$$p'
diff --git a/toolkit/profile/nsToolkitProfileService.cpp b/toolkit/profile/nsToolkitProfileService.cpp
index eebf078..0b3f20a 100644
--- a/toolkit/profile/nsToolkitProfileService.cpp
+++ b/toolkit/profile/nsToolkitProfileService.cpp
@@ -874,7 +874,7 @@ nsToolkitProfileService::CreateProfileInternal(nsIFile* aRootDir,
             NS_ENSURE_SUCCESS(rv, rv);
         }
         rv = rootDir->SetPermissions(0700);
-#ifndef ANDROID
+#if 0 //ndef ANDROID
         // If the profile is on the sdcard, this will fail but its non-fatal
         NS_ENSURE_SUCCESS(rv, rv);
 #endif
diff --git a/xpcom/base/nsUUIDGenerator.cpp b/xpcom/base/nsUUIDGenerator.cpp
index 2419a82..4c7bfee 100644
--- a/xpcom/base/nsUUIDGenerator.cpp
+++ b/xpcom/base/nsUUIDGenerator.cpp
@@ -16,7 +16,7 @@
 
 #include "nsUUIDGenerator.h"
 
-#ifdef ANDROID
+#if 1//def ANDROID
 extern "C" NS_EXPORT void arc4random_buf(void*, size_t);
 #endif
 
@@ -140,6 +140,7 @@ nsUUIDGenerator::GenerateUUIDInPlace(nsID* aId)
     const size_t mRBytes = 4;
 #else
     long rval = random();
+    const size_t mRBytes = 4;
 #endif
 
 
