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

Replies

Subject Author
Re: [gentoo-musl] [GSoC] musl and x32 Lei Zhang <zhanglei.april@×××××.com>