[llvm-bugs] [Bug 38025] New: Wrong ABI used when building compiler-rt

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Jul 2 16:55:14 PDT 2018


https://bugs.llvm.org/show_bug.cgi?id=38025

            Bug ID: 38025
           Summary: Wrong ABI used when building compiler-rt
           Product: compiler-rt
           Version: unspecified
          Hardware: All
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: compiler-rt
          Assignee: unassignedbugs at nondot.org
          Reporter: llozano at chromium.org
                CC: llvm-bugs at lists.llvm.org

Created attachment 20510
  --> https://bugs.llvm.org/attachment.cgi?id=20510&action=edit
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 <phosek at chromium.org>
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: https://reviews.llvm.org/D47115

    git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@333037
91177308-0d34-0410-b5e6-96231b3b80d8

Therefore, I will assign to Petr. 

Attached a detailed log of the failure.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180702/672b2f0f/attachment-0001.html>


More information about the llvm-bugs mailing list