Skip to content

Commit

Permalink
Fix __mulodi4 symbol not found build break.
Browse files Browse the repository at this point in the history
Summary:
    Error message:
    DerivedSources/ForwardingHeaders/wtf/CheckedArithmetic.h:458: error: undefined reference to '__mulodi4'

    This happens only on debug build + ARMv7

    NDK r19 did fix this:
    android/ndk#184

    To aligned NDK r17c with RN, fallback to use non bulitin overflow
    check.

    Related context:
    https://codereview.chromium.org/2011073002
  • Loading branch information
Kudo committed Apr 12, 2019
1 parent 636fa43 commit 6f70bbb
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions patches/jsc.patch
Original file line number Diff line number Diff line change
Expand Up @@ -300,3 +300,33 @@ diff -aur /dev/null target/webkit/Source/JavaScriptCore/polyfills/log2.cpp
+ return log(x) / log(2.0);
+}
+#endif
diff -aur target-org/webkit/Source/WTF/wtf/CheckedArithmetic.h target/webkit/Source/WTF/wtf/CheckedArithmetic.h
--- target-org/webkit/Source/WTF/wtf/CheckedArithmetic.h 2018-07-26 17:00:09.000000000 +0800
+++ target/webkit/Source/WTF/wtf/CheckedArithmetic.h 2019-04-12 12:03:55.000000000 +0800
@@ -317,7 +317,7 @@

static inline bool multiply(LHS lhs, RHS rhs, ResultType& result) WARN_UNUSED_RETURN
{
-#if COMPILER(GCC_OR_CLANG)
+#if COMPILER(GCC_OR_CLANG) && CPU(ARM_THUMB2) && defined(NDEBUG)
ResultType temp;
if (__builtin_mul_overflow(lhs, rhs, &temp))
return false;
@@ -390,7 +390,7 @@

static inline bool multiply(LHS lhs, RHS rhs, ResultType& result) WARN_UNUSED_RETURN
{
-#if COMPILER(GCC_OR_CLANG)
+#if COMPILER(GCC_OR_CLANG) && CPU(ARM_THUMB2) && defined(NDEBUG)
ResultType temp;
if (__builtin_mul_overflow(lhs, rhs, &temp))
return false;
@@ -453,7 +453,7 @@

static inline bool multiply(int64_t lhs, int64_t rhs, ResultType& result)
{
-#if COMPILER(GCC_OR_CLANG)
+#if COMPILER(GCC_OR_CLANG) && CPU(ARM_THUMB2) && defined(NDEBUG)
ResultType temp;
if (__builtin_mul_overflow(lhs, rhs, &temp))
return false;

0 comments on commit 6f70bbb

Please sign in to comment.