<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 - Wrong ABI used when building compiler-rt"
   href="https://bugs.llvm.org/show_bug.cgi?id=38025">38025</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Wrong ABI used when building compiler-rt
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>compiler-rt
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>All
          </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>compiler-rt
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>llozano@chromium.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=20510" name="attach_20510" title="log of compiler-rt build failure">attachment 20510</a> <a href="attachment.cgi?id=20510&action=edit" title="log of compiler-rt build failure">[details]</a></span>
log of compiler-rt build failure

While trying to build ToT compiler-rt, I get the following errors:

/usr/x86_64-pc-linux-gnu/binutils-bin/2.27.0/ld.bfd.real: i386:x86-64
architecture of input file
`/usr/lib64/clang/7.0.0/lib/linux/libclang_rt.builtins-x86_64.a(udivdi
3.c.o)' is incompatible with i386 output
/usr/x86_64-pc-linux-gnu/binutils-bin/2.27.0/ld.bfd.real: i386:x86-64
architecture of input file
`/usr/lib64/clang/7.0.0/lib/linux/libclang_rt.builtins-x86_64.a(udivmo
ddi4.c.o)' is incompatible with i386 output
projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommonSymbolizer.i386.dir/sanitizer_unwind_linux_libcdep.cc.o:
In function `__sanitizer::Unwind_GetIP(_
Unwind_Context*)':
/home/llozano/llvm-mage/llvm/projects/compiler-rt/lib/sanitizer_common/sanitizer_unwind_linux_libcdep.cc:100:
undefined reference to `_Unwind_GetIP'
projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommonSymbolizer.i386.dir/sanitizer_unwind_linux_libcdep.cc.o:
In function `Unwind_GetIP':
/home/llozano/llvm-mage/llvm/projects/compiler-rt/lib/sanitizer_common/sanitizer_unwind_linux_libcdep.cc:100:
undefined reference to `_Unwind_GetIP

It seems the build process is trying to use 64-bit ABI object files to build a
32-bit compiler-rt. 

To reproduce you need to use a clang to build compiler-rt and that clang must
use compiler-rt by default and support generating 32-ABI objects.

you can try to build your own clang build compiler or use the following from
the Chrome OS sdk.

$ gsutil cp
gs://chromiumos-sdk/2018/07/x86_64-cros-linux-gnu-2018.07.01.081213.tar.xz .
$ tar -Jxf x86_64-cros-linux-gnu-2018.07.01.081213.tar.xz

Then: 

cmake -G Ninja -DCMAKE_C_COMPILER=/path/to/sdk/usr/bin/clang
-DCMAKE_CXX_COMPILER=$HOME/path/to/sdk/usr/bin/clang++
-DCLANG_DEFAULT_CXX_STDLIB=libc++ -DCLANG_DEFAULT_RTLIB=compiler-rt  ../llvm/

and then:

ninja ubsan

I did a bisect on compiler-rt and found that the problem is with this commit:

Author: Petr Hosek <<a href="mailto:phosek@chromium.org">phosek@chromium.org</a>>
Date:   Tue May 22 22:58:48 2018 +0000

    [CMake] Support builtins as Clang default rtlib in compiler-rt

    Use compiler-rt builtins when selected as default Clang rtlib and avoid
    explicitly passing -rtlib= flag to avoid the "argument unused during
    compilation" warning.

    This is a partial alternative to D47094 that does not rely on compiler
    runtime checks.

    Differential Revision: <a href="https://reviews.llvm.org/D47115">https://reviews.llvm.org/D47115</a>

    git-svn-id: <a href="https://llvm.org/svn/llvm-project/compiler-rt/trunk@333037">https://llvm.org/svn/llvm-project/compiler-rt/trunk@333037</a>
91177308-0d34-0410-b5e6-96231b3b80d8

Therefore, I will assign to Petr. 

Attached a detailed log of the failure.</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>