[llvm-dev] Trying to create a pure LLVM toolchain on musl based distribution

Petr Hosek via llvm-dev llvm-dev at lists.llvm.org
Mon Mar 25 07:54:54 PDT 2019


On Mon, Mar 25, 2019 at 7:05 AM David Demelier via llvm-dev <
llvm-dev at lists.llvm.org> wrote:

> Le 25/03/2019 à 14:41, Peter Smith a écrit :
> > Hello David,
> >
> > I don't know much about the specifics of Musl, so I'm responding
> generally.
> >
> > As I understand it, clang expects to find the compiler-rt libraries
> > relative to the resource directory, which you can find out the
> > location of with clang --print-resource-dir . By default it is
> > lib/clang/9.0.0 assuming you are building from master. I think that
> > -DCMAKE_INSTALL_PREFIX=/usr has broken that assumption. I think that
> > you would either need to take out the CMAKE_INSTALL_PREFIX or change
> > the location of the resource directory, which I think that you can
> > alter at build time.
> >
>
> You're right, I've just checked both packages in Alpine and Arch and
> they indeed move the /usr/lib/linux directory under the clang's one.
> I've fixed that it worked, now I still have to find the solution
> regarding crtbeginS.so and crtendS.so.
>

https://reviews.llvm.org/D28791 should address this. We're still discussing
some related aspects on https://reviews.llvm.org/D59264, but I'm hoping to
reach a conclusion and land these changes this week.


> Thanks :)
>
> > I don't think that there is a way of preventing clang adding
> > crtbeginS.o and crtendS.o without --nostdlib or --nostartfiles but
> > using these options will also not add the other crt*.o files that you
> > may be expecting.
> >
> > There is a line in lib/Driver/Toolchains/Gnu.cpp which the Linux driver
> uses:
> > const bool HasCRTBeginEndFiles =
> >        ToolChain.getTriple().hasEnvironment() ||
> >        (ToolChain.getTriple().getVendor() !=
> llvm::Triple::MipsTechnologies);
> > It looks like Musl may need to be included there?
>
> I'll have a look, I don't know much the lowest part of the toolchain
> build process so I don't understand very much what's going on there.
> Hopefully someone that has better low-level knowledges and use musl will
> be able to guide me for this.
>
> What can I tell is that musl provide those files:
>
> usr/lib/Scrt1.o
> usr/lib/crt1.o
> usr/lib/crti.o
> usr/lib/crtn.o
> usr/lib/ld-musl-x86_64.so.1
>
> Regards,
>
> --
> David
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190325/6d0ff34f/attachment.html>


More information about the llvm-dev mailing list