1 |
[Added CC to the musl list] |
2 |
|
3 |
Lei Zhang wrote: |
4 |
> 2016-06-13 3:07 GMT+08:00 Joerg Sonnenberger <joerg@×××.de>: |
5 |
> > On Sun, Jun 12, 2016 at 10:51:11AM +0800, Lei Zhang via llvm-commits wrote: |
6 |
> >> Hi, |
7 |
> >> |
8 |
> >> I'm replying to this thread; sorry I wasn't subscribed to the list, |
9 |
> >> thus cannot reply to it directly. |
10 |
> >> |
11 |
> >> http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20160606/161733.html |
12 |
> >> |
13 |
> >> Joerg, thanks for your reply. Could you please tell me what kind of |
14 |
> >> test cases I should prepare? |
15 |
> > |
16 |
> > The target/triple parser has a unit test in |
17 |
> > unittests/ADT/TripleTest.cpp. The rest should get output validation in |
18 |
> > clang's test/Driver directory. Not sure which one is the primary |
19 |
> > GNU/Linux test. |
20 |
> |
21 |
> Thanks for the pointer :) |
22 |
> |
23 |
> The patches are re-attached with test cases included. Do they look sane enough? |
24 |
|
25 |
> --- lib/Driver/ToolChains.cpp (revision 272546) |
26 |
> +++ lib/Driver/ToolChains.cpp (working copy) |
27 |
> @@ -4152,6 +4152,8 @@ |
28 |
> |
29 |
> if (Triple.isAndroid()) |
30 |
> return Triple.isArch64Bit() ? "/system/bin/linker64" : "/system/bin/linker"; |
31 |
> + else if (Triple.getEnvironment() == llvm::Triple::Musl) |
32 |
> + return "/lib/ld-musl-" + Triple.getArchName().str() + ".so.1"; |
33 |
|
34 |
It does not seem to me that the dynamic linker name detection will work |
35 |
on most archs not in the test cases. For example, the arm gentoo musl |
36 |
stage3's have the target triple |
37 |
|
38 |
armv7a-hardfloat-linux-musleabi |
39 |
|
40 |
and the dynamic linker name |
41 |
|
42 |
/lib/ld-musl-armhf.so.1 |
43 |
|
44 |
Generally, the dynamic linker name takes the form |
45 |
"/lib/ld-musl-$ARCH$SUBARCH.so.1", where the definite source for the |
46 |
values of $ARCH and $SUBARCH is musl's configure script. |
47 |
|
48 |
It seems difficult to get all cases right and some of them might not be |
49 |
very interesting, but it would be nice to have a more intelligent patch. |
50 |
See for example |
51 |
|
52 |
http://git.alpinelinux.org/cgit/aports/plain/main/clang/clang-0004-Add-musl-targets-and-dynamic-linker.patch |
53 |
|
54 |
Felix |