Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Mon, 13 Jun 2016 15:21:55 +0200
From: Felix Janda <felix.janda@...teo.de>
To: Lei Zhang <zhanglei.april@...il.com>
Cc: llvm-commits@...ts.llvm.org, cfe-commits@...ts.llvm.org,
	gentoo-musl@...ts.gentoo.org, musl@...ts.openwall.com
Subject: Re: [gentoo-musl] Re: Add support for musl-libc on Linux

[Added CC to the musl list]

Lei Zhang wrote:
> 2016-06-13 3:07 GMT+08:00 Joerg Sonnenberger <joerg@....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

armv7a-hardfloat-linux-musleabi

and the dynamic linker name

/lib/ld-musl-armhf.so.1

Generally, the dynamic linker name takes the form
"/lib/ld-musl-$ARCH$SUBARCH.so.1", where the definite source for the
values of $ARCH and $SUBARCH is musl's configure script.

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

Felix

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.