<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - Clang generates calls to __mulodi4() for ARM even when not using compiler-rt"
   href="https://llvm.org/bugs/show_bug.cgi?id=28629">28629</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Clang generates calls to __mulodi4() for ARM even when not using compiler-rt
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>-New Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>srhines@google.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>arnaud.degrandmaison@arm.com, llvm-bugs@lists.llvm.org, pirama@google.com, renato.golin@linaro.org, silviu.baranga@arm.com
          </td>
        </tr>

        <tr>
          <th>Blocks</th>
          <td>21420
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The instructions use NDK version r11c, but the latest version r12/r13beta also
reproduce this issue.

STEPS TO REPRODUCE:
1. make standalone toolchain using the following command

    ./build/tools/make-standalone-toolchain.sh \
        --use-llvm              \
        --arch=arm64    \
        --platform=android-24 \
        --install_dir=$TOOLCHAIN_DIR

2.  compile the Skia test executables using the instructions found at
<a href="https://skia.org/user/quick/android">https://skia.org/user/quick/android</a>
3.  push the executable to the device and run.

EXPECTED RESULTS:
executable runs to completion

OBSERVED RESULTS:
crashes on launch with the following error message

dlopen failed: cannot locate symbol "__mulodi4" referenced by
“libskia_android.so"

ADDITIONAL INFORMATION:
In step 2, if we use the gcc binaries included with the toolchain then the
executable runs with no issues.  We have a quick hack at
<a href="https://codereview.chromium.org/2011073002/">https://codereview.chromium.org/2011073002/</a> that attempts to work around the
issue but is not desireable.

<a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED WORKSFORME - multiplying long long with fsanitize=integer fails with undefined reference to __mulodi4"
   href="show_bug.cgi?id=17693">https://llvm.org/bugs/show_bug.cgi?id=17693</a> seems similar, but this is not for
sanitizer code, so we should be able to use a different rtlib than compiler-rt.
Is it expected for clang to lower sequences of __builtin_smull_overflow
(<a href="https://android.googlesource.com/platform/external/dng_sdk.git/+/master/source/dng_safe_arithmetic.h#112">https://android.googlesource.com/platform/external/dng_sdk.git/+/master/source/dng_safe_arithmetic.h#112</a>)
to __mulodi4 in all cases? It is known that libgcc won't provide this symbol,
so at the very least, clang should warn/error that the rtlib selected won't be
able to resolve this symbol at runtime.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>