[gentoo-musl] Re: Add support for musl-libc on Linux

Lei Zhang via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 13 06:50:16 PDT 2016


2016-06-13 21:21 GMT+08:00 Felix Janda <felix.janda at posteo.de>:
> [Added CC to the musl list]
>
> Lei Zhang wrote:
>> 2016-06-13 3:07 GMT+08:00 Joerg Sonnenberger <joerg at bec.de>:
>> > On Sun, Jun 12, 2016 at 10:51:11AM +0800, Lei Zhang via llvm-commits wrote:
>> >> Hi,
>> >>
>> >> I'm replying to this thread; sorry I wasn't subscribed to the list,
>> >> thus cannot reply to it directly.
>> >>
>> >> http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20160606/161733.html
>> >>
>> >> Joerg, thanks for your reply. Could you please tell me what kind of
>> >> test cases I should prepare?
>> >
>> > The target/triple parser has a unit test in
>> > unittests/ADT/TripleTest.cpp. The rest should get output validation in
>> > clang's test/Driver directory. Not sure which one is the primary
>> > GNU/Linux test.
>>
>> Thanks for the pointer :)
>>
>> The patches are re-attached with test cases included. Do they look sane enough?
>
>> --- lib/Driver/ToolChains.cpp   (revision 272546)
>> +++ lib/Driver/ToolChains.cpp   (working copy)
>> @@ -4152,6 +4152,8 @@
>>
>>    if (Triple.isAndroid())
>>      return Triple.isArch64Bit() ? "/system/bin/linker64" : "/system/bin/linker";
>> +  else if (Triple.getEnvironment() == llvm::Triple::Musl)
>> +    return "/lib/ld-musl-" + Triple.getArchName().str() + ".so.1";
>
> It does not seem to me that the dynamic linker name detection will work
> on most archs not in the test cases. For example, the arm gentoo musl
> stage3's have the target triple

You're right. Frankly I've only had x86 platforms on my mind so far;
but I agree with Rafael that we could extend this to other archs in
the future.

> It seems difficult to get all cases right and some of them might not be
> very interesting, but it would be nice to have a more intelligent patch.
> See for example
>
> http://git.alpinelinux.org/cgit/aports/plain/main/clang/clang-0004-Add-musl-targets-and-dynamic-linker.patch

This looks neat :)


Lei


More information about the llvm-commits mailing list