Gentoo Archives: gentoo-musl

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

Replies

Subject Author
Re: [gentoo-musl] [GSoC] musl and x32 "Anthony G. Basile" <blueness@g.o>