Gentoo Archives: gentoo-musl

From: "Anthony G. Basile" <blueness@g.o>
To: Lei Zhang <zhanglei.april@×××××.com>
Cc: gentoo-musl@l.g.o
Subject: Re: [gentoo-musl] [GSoC] musl and x32
Date: Fri, 03 Jun 2016 01:15:54
Message-Id: b40bd92b-94f5-0d87-5666-c6345cb81b12@gentoo.org
In Reply to: Re: [gentoo-musl] [GSoC] musl and x32 by Lei Zhang
1 On 6/2/16 9:12 PM, Lei Zhang wrote:
2 > Thanks for the explanation. Things look much clearer to me now :)
3 >
4 > BTW, is config.guess able to print "x86_64-pc-linux-musl" on a musl
5 > based system? If so, then how does it detect the presence of musl?
6
7 read the code. it doesn't detect musl, it parses the tuple.
8
9 >
10 >
11 > Lei
12 >
13 > 2016-06-02 21:28 GMT+08:00 Anthony G. Basile <blueness@g.o>:
14 >> On 6/2/16 9:17 AM, Lei Zhang wrote:
15 >>> 2016-06-02 20:53 GMT+08:00 Anthony G. Basile <blueness@g.o>:
16 >>>> On 6/2/16 8:48 AM, Lei Zhang wrote:
17 >>>>> 2016-06-02 13:13 GMT+08:00 Anthony G. Basile <blueness@g.o>:
18 >>>>>> On 6/1/16 11:35 PM, Lei Zhang wrote:
19 >>>>>>>
20 >>>>>>> Currently I'm considering introducing a new ABI type "musl" into clang, so
21 >>>>>>> we can build a native clang targeting "x86_64-linux-musl". But I notice
22 >>>>>>> there's also an ABI type specifically for x32, named "gnux32". Then what
23 >>>>>>> about musl on a x32 platform? Should I name it "muslx32" or something? I
24 >>>>>>> don't know why x86 and x86_64 can live with the same ABI name, while x32
25 >>>>>>> can't...
26 >>>>>>
27 >>>>>> 1) i tried x32 + musl + gcc and ran into quite a few issues and gave up.
28 >>>>>> i don't recall what those issues are right now, but they were basically
29 >>>>>> lost of compile time breakage of packages. since i'm not a big fan of
30 >>>>>> x32 i didn't put a lot of effort in and when i saw it was a steep climb,
31 >>>>>> i had bigger fish to fry.
32 >>>>>
33 >>>>> musl's FAQ says the support for x32 is still experimental; so the unstability
34 >>>>> is kind of expected.
35 >>>>>
36 >>>>>>
37 >>>>>> 2) i don't know what you mean by "should i name it muslx32". what is
38 >>>>>> the "it" in your sentence?
39 >>>>>
40 >>>>> I mean the ABI part in a toolchain triplet.
41 >>>>
42 >>>> there shouldn't be an abi part in the toolchain tuple. i know some have
43 >>>> done so, but its wrong for the reasons i said. a single toolchain is
44 >>>> able to emit multiple abis. which one would you like to put there?
45 >>>>
46 >>>>>
47 >>>>>> if its the the toolchain tuple, that should
48 >>>>>> not contain the abi name in it because a given toolchain is able to emit
49 >>>>>> different abis. for example gcc on x86_64 architecture can produce
50 >>>>>> three abis (if the corresponding libc's are available): gcc -m32, gcc
51 >>>>>> -m64, gcc -mx32
52 >>>>>
53 >>>>> Taking "x86_64-linux-musl" for example, the "musl" is the ABI name and
54 >>>>> should be in the triplet, right? Otherwise how do we tell which libc
55 >>>>> this toolchain
56 >>>>> is using?
57 >>>>
58 >>>> no, musl is the name of the libc. you are confusing the libc with the
59 >>>> abi. you can have multilib systems with /lib /lib64 /libx32 each with
60 >>>> their own abi version of the libc.
61 >>>
62 >>> The structure of target triplet is really confusing me... Typically a
63 >>> triplet has the form:
64 >>>
65 >>> <arch>-<vendor>-<os>
66 >>
67 >> people have not been consistent, it should be
68 >>
69 >> machine-vendor-kernel-os
70 >>
71 >> see https://wiki.gentoo.org/wiki/Embedded_Handbook/Tuples
72 >>
73 >> so like i've been saying, some people will do muslx32 for the os, like
74 >> they do uclibceabi, but its misleading and should be avoided.
75 >>
76 >> having said that it may be impractical to avoid. to answer that
77 >> question, see what is int gnuconfig right now.
78 >>
79 >>>
80 >>> Then what is "musl" or "gnu"s role in this? A part of the <os> field?
81 >>>
82 >>>>>
83 >>>>> enum EnvironmentType {
84 >>>>> UnknownEnvironment,
85 >>>>>
86 >>>>> GNU,
87 >>>>> GNUEABI,
88 >>>>> GNUEABIHF,
89 >>>>> GNUX32,
90 >>>>> CODE16,
91 >>>>> EABI,
92 >>>>> EABIHF,
93 >>>>> Android,
94 >>>>>
95 >>>>> MSVC,
96 >>>>> Itanium,
97 >>>>> Cygnus,
98 >>>>> AMDOpenCL,
99 >>>>> CoreCLR,
100 >>>>> LastEnvironmentType = CoreCLR
101 >>>>> };
102 >>>>>
103 >>>>> The "Environment" refers to the last part of a triplet.
104 >>>>
105 >>>> i'm not a clang fan. if clang insists that the abi be in the tuple
106 >>>> name, then its doing it wrong. bug upstream clang people and ask wtf
107 >>>> they are up to.
108 >>>
109 >>> But aren't names like "gnueabi" and "gnueabihf" are also used in the GCC world?
110 >>> It looks to me clang is just mimicking gcc's behavior. Or perhaps I'm
111 >>> not getting
112 >>> your point...
113 >>
114 >> i am aware. this would not be the first time a bad practice got
115 >> historically entrenched. that does not make it good.
116 >>
117 >> so where does the toolchain tuple make a difference? when running
118 >> configure the system will have to make "guesses" about you machine's
119 >> ISA, the kernel, the libc/os. configure uses config.guess to make these
120 >> guesses. take a look at how that file parses things to see what it
121 >> would do with -musl and -muslx32. my guess is that it doesn't make the
122 >> distinction because i was the guy that wrote the patch to get musl
123 >> recognition into gnuconfig and i was not worried about x32 at the time.
124 >> of course others may have contributed too, but if there is not -muslx32
125 >> in there, then i would say, let's not add it. i'd eventually like to
126 >> see a multilib amd64 musl system where we have
127 >>
128 >> /lib32 <- for 32-bit abi
129 >> /lib64 <- for 64-bit abi
130 >> /libx32 <- for x32 abi
131 >>
132 >> and tuple x86_64-gentoo-linux-musl which emits all three, with -m64 as
133 >> the default and -m32 and -mx32 as options.
134 >>
135 >> i hope this helps.
136 >>
137 >>>
138 >>>
139 >>> Lei
140 >>>
141 >>
142 >>
143 >> --
144 >> Anthony G. Basile, Ph.D.
145 >> Gentoo Linux Developer [Hardened]
146 >> E-Mail : blueness@g.o
147 >> GnuPG FP : 1FED FAD9 D82C 52A5 3BAB DC79 9384 FA6E F52D 4BBA
148 >> GnuPG ID : F52D4BBA
149
150
151 --
152 Anthony G. Basile, Ph.D.
153 Gentoo Linux Developer [Hardened]
154 E-Mail : blueness@g.o
155 GnuPG FP : 1FED FAD9 D82C 52A5 3BAB DC79 9384 FA6E F52D 4BBA
156 GnuPG ID : F52D4BBA