[gentoo-musl] Re: Add support for musl-libc on Linux

Peter Smith via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 20 02:37:34 PDT 2016

Hello Lei,

I agree with Rafael that this is currently missing a few critical
things right now, especially in the llvm patch.

My (limited) understanding of musl is that it intends to support the
same interface as GNUEABI and GNUEABIHF, but it is obviously a
different implementation.

This is what I could find with a basic grep for GNUAEABI and working
out from there.

Clang patch
I'm assuming you are only intending to support Musl on linux, and not BSD.

- getDynamicLinker()
There is a Triple.getEnvironment() == llvm::triple::GNUEABIHF which
selects between ld-linux-armhf.so.3 or ld-linux.so.3. I think you'll
need ld-linux-armhf.so.3 for MUSLHF here as well.

LLVM patch
- isTargetGNUAEABI()
I think you'll need to check all the callsites of this function, and
check what you want isTargetMusl() to do. At present I think you'll
want them to do the same thing in all cases except finding the
implementation. There looks to be a trade off between adding MUSCL and
MUSCLHF to isTargetGNUAEABI(), adding something like
isTargetGNUAEABIInterface() and adding isTargetMusl() to all the

- isTargetEHABICompatible()
I'm making the assumption that musl supports the ARM exceptions EHABI,
if so you'll want to add MUSL and MUSLHF here.

- isTargetHardFloat()
You'll want to add MUSLHF here.

- computeTargetABI()
You'll want to add MUSL and MUSLHF alongside GNUEABI and GNUEABIHF in
the switch.

Hope this helps


On 18 June 2016 at 01:52, Rafael EspĂ­ndola <rafael.espindola at gmail.com> wrote:
> There are probably a few more places that need to be patched.
> In particular, take a look at lib/Target/ARM. There are things like
> computeTargetABI and isTargetHardFloat that probably need to be
> updated (and tested).
> CCing Peter for an arm opinion.
> Cheers,
> Rafael
> On 17 June 2016 at 05:50, Lei Zhang <zhanglei.april at gmail.com> wrote:
>> 2016-06-15 16:28 GMT+08:00 Lei Zhang <zhanglei.april at gmail.com>:
>>> Here's another patch including test cases for various non-x86 archs,
>>> which should just work with my previous patches. ARM is left out
>>> purposely since it involves extra complexity. I'll work on it later.
>> Hi,
>> Here are another two patches which add support for ARM, with some test
>> cases included.
>> They're a lot bigger than previous patches, and I'm not 100% sure if I
>> missed anything. Any comments are utterly welcome :)
>> Lei

More information about the cfe-commits mailing list