[llvm-dev] libcompiler_rt.so and libcompiler_rt.a are not being built

Dmitry Golovin via llvm-dev llvm-dev at lists.llvm.org
Mon Dec 19 14:51:59 PST 2016


Thank you, I've built musl using the builtins. It was just misleading that musl's configure script tries using `-lcompiler_rt` option with linker. It works perfectly fine now.

Regards,
Dmitry

19.12.2016, 21:08, "Vedant Kumar" <vsk at apple.com>:
>>  On Dec 18, 2016, at 3:48 AM, Dmitry Golovin <dima at golovin.in> wrote:
>>
>>  16.12.2016, 18:23, "Vedant Kumar" <vsk at apple.com>:
>>>>   On Dec 16, 2016, at 7:06 AM, Dmitry Golovin via llvm-dev <llvm-dev at lists.llvm.org> wrote:
>>>>
>>>>   I want to build LLVM-based toolchain with Musl, I have LLVM sources with clang and lld (under `tools` directory) and libunwind, compiler-rt, libcxx and libcxxabi (under `projects` directory). All are the latest versions cloned from GitHub mirror, branch `master`.
>>>>
>>>>   I'm trying to configure with the following options:
>>>>      CLANG_DEFAULT_CXX_STDLIB = libc++
>>>>      CLANG_DEFAULT_RTLIB = compiler-rt
>>>>      CLANG_DEFAULT_LINKER = lld
>>>>      LLVM_DEFAULT_TARGET_TRIPLE=x86_64-pc-linux-musl
>>>>
>>>>   I use cmake to configure and ninja to build.
>>>>
>>>>   It configures fine and builds, but I need libcompiler_rt.so and it is not among build targets, so it is not built and installed.
>>>>
>>>>   I think it is a bug and libcompiler_rt.so should be built. I don't have a bugzilla account, so I would appreciate if someone reports it for me.
>>>
>>>  I don't think a single library that encompasses all of compiler-rt exists, or
>>>  even *can* exist. E.g, the runtimes for ASan and TSan both export interceptors
>>>  for common library routines which would be mutually incompatible. So, I don't
>>>  think this is a bug.
>>>
>>>  If you want to build all of compiler-rt, try building the phony 'compiler-rt'
>>>  target. All of the libraries you need will show up in:
>>>
>>>    <build-dir>/lib/clang/<version>/lib
>>>
>>>  best,
>>>  vedant
>>>
>>>>   Regards,
>>>>   Dmitry
>>
>>  I'm sure that this library can and should exist.
>
> I think we're talking about different things.
>
> It looks like you just want the builtins: this exists.
>
> E.g on Darwin, you can find muldc3 in libclang_rt.hard_pic.a.
>
>>  You can search it by it's name and it is mentioned a lot on the Internet. Now I've got a linking problem when building musl:
>>
>>     (function cpow): undefined symbol '__muldc3'
>>     (function cpowf): undefined symbol '__mulsc3'
>>     (function cpowl): undefined symbol '__mulxc3'
>>     (function csqrt): undefined symbol '__muldc3'
>>
>>  I'm pretty sure this problem is solved by just adding -lcompiler_rt to LDFLAGS.
>
> Did that work?
>
> If not, try building the builtins for your platform, e.g:
>
> $ ninja libclang_rt.builtins_x86_64_osx.a
>
> best,
> vedant


More information about the llvm-dev mailing list