Gentoo Archives: gentoo-musl

From: Lei Zhang <zhanglei.april@×××××.com>
To: Peter Smith <peter.smith@××××××.org>
Cc: "Rafael Espíndola" <rafael.espindola@×××××.com>, llvm-commits <llvm-commits@××××××××××.org>, musl@××××××××××××××.com, gentoo-musl@l.g.o, cfe-commits cfe <cfe-commits@××××××××××.org>
Subject: Re: [gentoo-musl] Re: Add support for musl-libc on Linux
Date: Mon, 20 Jun 2016 10:59:23
Message-Id: CAOYuCc2yxgYFSzDjJP0SJho5Hs=zb635ysinwbg=SZ=CZJt9_Q@mail.gmail.com
1 2016-06-20 17:37 GMT+08:00 Peter Smith <peter.smith@××××××.org>:
2 > Hello Lei,
3
4 Hi, thanks for your reply!
5
6 > I agree with Rafael that this is currently missing a few critical
7 > things right now, especially in the llvm patch.
8 >
9 > My (limited) understanding of musl is that it intends to support the
10 > same interface as GNUEABI and GNUEABIHF, but it is obviously a
11 > different implementation.
12 >
13 > This is what I could find with a basic grep for GNUAEABI and working
14 > out from there.
15 >
16 > Clang patch
17 > I'm assuming you are only intending to support Musl on linux, and not BSD.
18
19 Yes.
20
21 > ToolChains.cpp
22 > - getDynamicLinker()
23 > There is a Triple.getEnvironment() == llvm::triple::GNUEABIHF which
24 > selects between ld-linux-armhf.so.3 or ld-linux.so.3. I think you'll
25 > need ld-linux-armhf.so.3 for MUSLHF here as well.
26
27 Actually musl's dynamic linker has a different naming scheme from
28 glibc's, which is handled by an extra chunk of code in the patch. The
29 code you mentioned won't be reached when musl is present, and thus
30 need no change.
31
32 > LLVM patch
33 > ARMSubtarget.h
34 > - isTargetGNUAEABI()
35 > I think you'll need to check all the callsites of this function, and
36 > check what you want isTargetMusl() to do. At present I think you'll
37 > want them to do the same thing in all cases except finding the
38 > implementation. There looks to be a trade off between adding MUSCL and
39 > MUSCLHF to isTargetGNUAEABI(), adding something like
40 > isTargetGNUAEABIInterface() and adding isTargetMusl() to all the
41 > callsites.
42 >
43 > - isTargetEHABICompatible()
44 > I'm making the assumption that musl supports the ARM exceptions EHABI,
45 > if so you'll want to add MUSL and MUSLHF here.
46
47 I'm not 100% sure about this. Could some insider from musl confirm this?
48
49 > - isTargetHardFloat()
50 > You'll want to add MUSLHF here.
51 >
52 > ARMTargetMachine.cpp
53 > - computeTargetABI()
54 > You'll want to add MUSL and MUSLHF alongside GNUEABI and GNUEABIHF in
55 > the switch.
56 >
57 > Hope this helps
58
59 In addition to what you mentioned, perhaps I should also add "Musl" as
60 a new EABI type in TargetOptions.h (in LLVM), just side by side with
61 "GNU", and change relevant bits in LLVM and clang accordingly.
62
63
64 Thanks again,
65 Lei