<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - Link error: undefined reference to `__mulodi4' with Clang 32-bit (x86-64 works)"
   href="https://bugs.llvm.org/show_bug.cgi?id=35922">35922</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Link error: undefined reference to `__mulodi4' with Clang 32-bit (x86-64 works)
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>4.0
          </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>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>lukebenes@hotmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The following commit
<a href="https://cgit.freedesktop.org/libreoffice/core/commit/?id=4f0b226600fdad4e5aef9313fe8754c765cfee42">https://cgit.freedesktop.org/libreoffice/core/commit/?id=4f0b226600fdad4e5aef9313fe8754c765cfee42</a>
causes the following error:

/core/workdir/CxxObject/tools/source/generic/fract.o: In function
`Fraction::operator*=(Fraction const&)': 
/core/tools/source/generic/fract.cxx:(.text+0x695): undefined reference to
`__mulodi4' 
/core/tools/source/generic/fract.cxx:(.text+0x70a): undefined reference to
`__mulodi4' 
[build CXX] svl/source/config/asiancfg.cxx 
clang-5.0: error: linker command failed with exit code 1 (use -v to see
invocation) 
/core/tools/Library_tl.mk:20: recipe for target
'/core/instdir/program/libtllo.so' failed 
make[1]: *** [/core/instdir/program/libtllo.so] Error 1 

The problem is this code:

#elif (defined __GNUC__ && __GNUC__ >= 5) ||
(__has_builtin(__builtin_mul_overflow))

template<typename T> inline bool checked_multiply(T a, T b, T& result)
{
    return __builtin_mul_overflow(a, b, &result);
}


Steps to reproduce on with 32-bit clang machine:
1. $ git clone git://anongit.freedesktop.org/libreoffice/core
2. $ apt-get build-dep libreoffice 
3. create file autogen.input with CC=clang and CXX=clang++
4 ./autogen.sh && make ENVCFLAGS="-mllvm -no-x86-call-frame-opt"
ENVCFLAGSCXX="-mllvm -no-x86-call-frame-opt"</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>