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

2016-06-24 Thread Lei Zhang via cfe-commits
2016-06-24 16:02 GMT+08:00 Peter Smith :
> Hello Lei,
>
> They look good enough for me. Unless anyone else has any objections I
> think you are good to go.

I just see them committed by r273735 in clang and r273726 in LLVM.

Peter, thank you for the comments; and Rafael, thank you for
committing the patches :)


Lei
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2016-06-24 Thread Peter Smith via cfe-commits
Hello Lei,

They look good enough for me. Unless anyone else has any objections I
think you are good to go.

Peter

On 24 June 2016 at 04:25, Lei Zhang  wrote:
> 2016-06-22 16:55 GMT+08:00 Peter Smith :
>> Hello Lei,
>>
>> Thanks for all the updates. That looks good to me from an ARM perspective.
>
> Ping.
>
> Are the patches good enough to be committed?
>
>
> Lei
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2016-06-23 Thread Lei Zhang via cfe-commits
2016-06-22 16:55 GMT+08:00 Peter Smith :
> Hello Lei,
>
> Thanks for all the updates. That looks good to me from an ARM perspective.

Ping.

Are the patches good enough to be committed?


Lei
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2016-06-22 Thread Peter Smith via cfe-commits
Hello Lei,

Thanks for all the updates. That looks good to me from an ARM perspective.

Peter

On 22 June 2016 at 09:03, Lei Zhang  wrote:
> 2016-06-21 23:07 GMT+08:00 Peter Smith :
>> Hello Lei,
>>
>> The changes to llvm and clang look ok to me. I've got some suggestions
>> for testing.
>>
>> For the clang patch, it looks like there isn't a test to check that
>> musleabihf implies hard floating point. It looks like
>> Driver/arm-mfpu.c CHECK-HF might be a good candidate to add a test.
>>
>> For the llvm patch
>>
>> I think you should be able to find a test that checks the behaviour of
>> GNUEABI and GNUEABIHF for each of the properties that you've added
>> Subtarget->isTargetMuslAEABI() to or equivalent. It would be useful to
>> add a test case for MUSLEABI and/or MUSLEABIHF. For example in the
>> RTLIB case there are a large number of tests that check whether the
>> correct __aeabi_ function is called.
>>
>> Some files I came across (there are many more) that might be a good
>> place to check that musleabi and musleabihf behaves like gnueabi and
>> gnueabihf:
>> CodeGen/ARM/memfunc.ll
>> CodeGen/Thumb2/float-ops.ll
>> CodeGen/ARM/divmod-eabi.ll
>> CodeGen/ARM/fp16.ll (hard-float for HF)
>> MC/ARM/eh-directives-personalityindex.s
>
> Thanks for the pointers! Please see the refined (again) patches.
>
> As a side note, there's no "gnueabi" in float-ops.ll or
> eh-directive-personalityindex.s, so I skipped them. In addition, I
> found a few other relevant test files to patch thanks to your advice.
>
>
> Lei
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2016-06-22 Thread Lei Zhang via cfe-commits
2016-06-21 23:07 GMT+08:00 Peter Smith :
> Hello Lei,
>
> The changes to llvm and clang look ok to me. I've got some suggestions
> for testing.
>
> For the clang patch, it looks like there isn't a test to check that
> musleabihf implies hard floating point. It looks like
> Driver/arm-mfpu.c CHECK-HF might be a good candidate to add a test.
>
> For the llvm patch
>
> I think you should be able to find a test that checks the behaviour of
> GNUEABI and GNUEABIHF for each of the properties that you've added
> Subtarget->isTargetMuslAEABI() to or equivalent. It would be useful to
> add a test case for MUSLEABI and/or MUSLEABIHF. For example in the
> RTLIB case there are a large number of tests that check whether the
> correct __aeabi_ function is called.
>
> Some files I came across (there are many more) that might be a good
> place to check that musleabi and musleabihf behaves like gnueabi and
> gnueabihf:
> CodeGen/ARM/memfunc.ll
> CodeGen/Thumb2/float-ops.ll
> CodeGen/ARM/divmod-eabi.ll
> CodeGen/ARM/fp16.ll (hard-float for HF)
> MC/ARM/eh-directives-personalityindex.s

Thanks for the pointers! Please see the refined (again) patches.

As a side note, there's no "gnueabi" in float-ops.ll or
eh-directive-personalityindex.s, so I skipped them. In addition, I
found a few other relevant test files to patch thanks to your advice.


Lei


llvm-musl-arm-v3.patch
Description: Binary data


clang-musl-arm-v3.patch
Description: Binary data
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2016-06-21 Thread Peter Smith via cfe-commits
Hello Lei,

The changes to llvm and clang look ok to me. I've got some suggestions
for testing.

For the clang patch, it looks like there isn't a test to check that
musleabihf implies hard floating point. It looks like
Driver/arm-mfpu.c CHECK-HF might be a good candidate to add a test.

For the llvm patch

I think you should be able to find a test that checks the behaviour of
GNUEABI and GNUEABIHF for each of the properties that you've added
Subtarget->isTargetMuslAEABI() to or equivalent. It would be useful to
add a test case for MUSLEABI and/or MUSLEABIHF. For example in the
RTLIB case there are a large number of tests that check whether the
correct __aeabi_ function is called.

Some files I came across (there are many more) that might be a good
place to check that musleabi and musleabihf behaves like gnueabi and
gnueabihf:
CodeGen/ARM/memfunc.ll
CodeGen/Thumb2/float-ops.ll
CodeGen/ARM/divmod-eabi.ll
CodeGen/ARM/fp16.ll (hard-float for HF)
MC/ARM/eh-directives-personalityindex.s

Peter

On 21 June 2016 at 14:36, Lei Zhang  wrote:
> 2016-06-20 19:05 GMT+08:00 Lei Zhang :
>> 2016-06-18 8:52 GMT+08:00 Rafael Espíndola :
>>> 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).
>>
>> Any hints how to test the new changes? I guess merely checking clang's
>> output like the previous test cases won't suffice this time.
>
> Here're the refined patches. Please let me know if the test cases
> aren't complete.
>
> Thanks,
> Lei
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2016-06-21 Thread Lei Zhang via cfe-commits
2016-06-20 19:05 GMT+08:00 Lei Zhang :
> 2016-06-18 8:52 GMT+08:00 Rafael Espíndola :
>> 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).
>
> Any hints how to test the new changes? I guess merely checking clang's
> output like the previous test cases won't suffice this time.

Here're the refined patches. Please let me know if the test cases
aren't complete.

Thanks,
Lei


clang-musl-arm-v2.patch
Description: Binary data


llvm-musl-arm-v2.patch
Description: Binary data
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2016-06-20 Thread Lei Zhang via cfe-commits
2016-06-20 19:44 GMT+08:00 Peter Smith :
> From what I can see, the EABI type is used to decide if certain
> __aeabi_ prefixed functions such as __aeabi_idiv are available. If
> Musl differs in function availability from the GNU library here I
> think you'll need a Musl EABI type. However if there is no difference
> you should be able to use the EABI::GNU type for Musl.

I think musl and glibc is compatible on this; I'm just a little
concerned that using EABI::GNU for both GNUEABI* and MuslEABI* might
cause some confusion.

> You might find http://reviews.llvm.org/D12413 helpful here
> (introduction of -meabi option).

It seems clang's -meabi option is incompatible with gcc's.


Lei
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2016-06-20 Thread Szabolcs Nagy via cfe-commits
* Lei Zhang  [2016-06-20 18:59:20 +0800]:
> 2016-06-20 17:37 GMT+08:00 Peter Smith :
> > - isTargetEHABICompatible()
> > I'm making the assumption that musl supports the ARM exceptions EHABI,
> > if so you'll want to add MUSL and MUSLHF here.
> 
> I'm not 100% sure about this. Could some insider from musl confirm this?

musl is ehabi agnostic.

ehabi and libc should be independent.

throwing exceptions across libc boundary is undefined
behaviour, all ehabi support is in the compiler runtime.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2016-06-20 Thread Peter Smith via cfe-commits
From what I can see, the EABI type is used to decide if certain
__aeabi_ prefixed functions such as __aeabi_idiv are available. If
Musl differs in function availability from the GNU library here I
think you'll need a Musl EABI type. However if there is no difference
you should be able to use the EABI::GNU type for Musl.

You might find http://reviews.llvm.org/D12413 helpful here
(introduction of -meabi option).

Peter


On 20 June 2016 at 11:59, Lei Zhang  wrote:
> 2016-06-20 17:37 GMT+08:00 Peter Smith :
>> Hello Lei,
>
> Hi, thanks for your reply!
>
>> 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.
>
> Yes.
>
>> ToolChains.cpp
>> - 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.
>
> Actually musl's dynamic linker has a different naming scheme from
> glibc's, which is handled by an extra chunk of code in the patch. The
> code you mentioned won't be reached when musl is present, and thus
> need no change.
>
>> LLVM patch
>> ARMSubtarget.h
>> - 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
>> callsites.
>>
>> - isTargetEHABICompatible()
>> I'm making the assumption that musl supports the ARM exceptions EHABI,
>> if so you'll want to add MUSL and MUSLHF here.
>
> I'm not 100% sure about this. Could some insider from musl confirm this?
>
>> - isTargetHardFloat()
>> You'll want to add MUSLHF here.
>>
>> ARMTargetMachine.cpp
>> - computeTargetABI()
>> You'll want to add MUSL and MUSLHF alongside GNUEABI and GNUEABIHF in
>> the switch.
>>
>> Hope this helps
>
> In addition to what you mentioned, perhaps I should also add "Musl" as
> a new EABI type in TargetOptions.h (in LLVM), just side by side with
> "GNU", and change relevant bits in LLVM and clang accordingly.
>
>
> Thanks again,
> Lei
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2016-06-20 Thread Lei Zhang via cfe-commits
2016-06-18 8:52 GMT+08:00 Rafael Espíndola :
> 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).

Any hints how to test the new changes? I guess merely checking clang's
output like the previous test cases won't suffice this time.


Thanks,
Lei
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2016-06-20 Thread Lei Zhang via cfe-commits
2016-06-20 17:37 GMT+08:00 Peter Smith :
> Hello Lei,

Hi, thanks for your reply!

> 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.

Yes.

> ToolChains.cpp
> - 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.

Actually musl's dynamic linker has a different naming scheme from
glibc's, which is handled by an extra chunk of code in the patch. The
code you mentioned won't be reached when musl is present, and thus
need no change.

> LLVM patch
> ARMSubtarget.h
> - 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
> callsites.
>
> - isTargetEHABICompatible()
> I'm making the assumption that musl supports the ARM exceptions EHABI,
> if so you'll want to add MUSL and MUSLHF here.

I'm not 100% sure about this. Could some insider from musl confirm this?

> - isTargetHardFloat()
> You'll want to add MUSLHF here.
>
> ARMTargetMachine.cpp
> - computeTargetABI()
> You'll want to add MUSL and MUSLHF alongside GNUEABI and GNUEABIHF in
> the switch.
>
> Hope this helps

In addition to what you mentioned, perhaps I should also add "Musl" as
a new EABI type in TargetOptions.h (in LLVM), just side by side with
"GNU", and change relevant bits in LLVM and clang accordingly.


Thanks again,
Lei
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2016-06-20 Thread Peter Smith via cfe-commits
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.

ToolChains.cpp
- 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
ARMSubtarget.h
- 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
callsites.

- 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.

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

Hope this helps

Peter


On 18 June 2016 at 01:52, Rafael Espíndola  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  wrote:
>> 2016-06-15 16:28 GMT+08:00 Lei Zhang :
>>> 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
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2016-06-17 Thread Rafael Espíndola via cfe-commits
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  wrote:
> 2016-06-15 16:28 GMT+08:00 Lei Zhang :
>> 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
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2016-06-17 Thread Lei Zhang via cfe-commits
2016-06-15 16:28 GMT+08:00 Lei Zhang :
> 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


llvm-musl-arm.patch
Description: Binary data


clang-musl-arm.patch
Description: Binary data
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2016-06-15 Thread Rafael Espíndola via cfe-commits
r272825,

Thanks,
Rafael


On 15 June 2016 at 04:28, Lei Zhang  wrote:
> 2016-06-14 20:55 GMT+08:00 Rafael Espíndola :
>> On 13 June 2016 at 21:07, Lei Zhang  wrote:
>>> 2016-06-14 5:00 GMT+08:00 Rafael Espíndola :
 Do you need someone to commit it for you?
>>>
>>> Yes, please :)
>>
>> Committed.
>
> Thanks!
>
> 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.
>
>
> Lei
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2016-06-15 Thread Lei Zhang via cfe-commits
2016-06-14 20:55 GMT+08:00 Rafael Espíndola :
> On 13 June 2016 at 21:07, Lei Zhang  wrote:
>> 2016-06-14 5:00 GMT+08:00 Rafael Espíndola :
>>> Do you need someone to commit it for you?
>>
>> Yes, please :)
>
> Committed.

Thanks!

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.


Lei


musl-test.patch
Description: Binary data
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2016-06-14 Thread Rafael Espíndola via cfe-commits
On 13 June 2016 at 21:07, Lei Zhang  wrote:
> 2016-06-14 5:00 GMT+08:00 Rafael Espíndola :
>> Do you need someone to commit it for you?
>
> Yes, please :)

Committed.

Cheers,
Rafael
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2016-06-14 Thread Szabolcs Nagy via cfe-commits
* Rafael Esp?ndola  [2016-06-13 17:00:17 -0400]:
> Do you need someone to commit it for you?
> On Jun 13, 2016 9:50 AM, "Lei Zhang via cfe-commits" <
> > http://git.alpinelinux.org/cgit/aports/plain/main/clang/clang-0004-Add-musl-targets-and-dynamic-linker.patch
> >
> > This looks neat :)

the dynamic linker names need to be updated (ppc64*, mips64*
mips*-sf are missing) and it defaults to x86_64 which can
be bad.

there is some musl setting already for mips in the driver
which should probably be fixed.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2016-06-13 Thread Lei Zhang via cfe-commits
2016-06-14 5:00 GMT+08:00 Rafael Espíndola :
> Do you need someone to commit it for you?

Yes, please :)


Lei
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2016-06-13 Thread Rafael Espíndola via cfe-commits
Do you need someone to commit it for you?
On Jun 13, 2016 9:50 AM, "Lei Zhang via cfe-commits" <
cfe-commits@lists.llvm.org> wrote:

> 2016-06-13 21:21 GMT+08:00 Felix Janda :
> > [Added CC to the musl list]
> >
> > Lei Zhang wrote:
> >> 2016-06-13 3:07 GMT+08:00 Joerg Sonnenberger :
> >> > On Sun, Jun 12, 2016 at 10:51:11AM +0800, Lei Zhang via llvm-commits
> wrote:
> >> >> Hi,
> >> >>
> >> >> I'm replying to this thread; sorry I wasn't subscribed to the list,
> >> >> thus cannot reply to it directly.
> >> >>
> >> >>
> http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20160606/161733.html
> >> >>
> >> >> Joerg, thanks for your reply. Could you please tell me what kind of
> >> >> test cases I should prepare?
> >> >
> >> > The target/triple parser has a unit test in
> >> > unittests/ADT/TripleTest.cpp. The rest should get output validation in
> >> > clang's test/Driver directory. Not sure which one is the primary
> >> > GNU/Linux test.
> >>
> >> Thanks for the pointer :)
> >>
> >> The patches are re-attached with test cases included. Do they look sane
> enough?
> >
> >> --- lib/Driver/ToolChains.cpp   (revision 272546)
> >> +++ lib/Driver/ToolChains.cpp   (working copy)
> >> @@ -4152,6 +4152,8 @@
> >>
> >>if (Triple.isAndroid())
> >>  return Triple.isArch64Bit() ? "/system/bin/linker64" :
> "/system/bin/linker";
> >> +  else if (Triple.getEnvironment() == llvm::Triple::Musl)
> >> +return "/lib/ld-musl-" + Triple.getArchName().str() + ".so.1";
> >
> > It does not seem to me that the dynamic linker name detection will work
> > on most archs not in the test cases. For example, the arm gentoo musl
> > stage3's have the target triple
>
> You're right. Frankly I've only had x86 platforms on my mind so far;
> but I agree with Rafael that we could extend this to other archs in
> the future.
>
> > It seems difficult to get all cases right and some of them might not be
> > very interesting, but it would be nice to have a more intelligent patch.
> > See for example
> >
> >
> http://git.alpinelinux.org/cgit/aports/plain/main/clang/clang-0004-Add-musl-targets-and-dynamic-linker.patch
>
> This looks neat :)
>
>
> Lei
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2016-06-13 Thread Lei Zhang via cfe-commits
2016-06-13 21:21 GMT+08:00 Felix Janda :
> [Added CC to the musl list]
>
> Lei Zhang wrote:
>> 2016-06-13 3:07 GMT+08:00 Joerg Sonnenberger :
>> > On Sun, Jun 12, 2016 at 10:51:11AM +0800, Lei Zhang via llvm-commits wrote:
>> >> Hi,
>> >>
>> >> I'm replying to this thread; sorry I wasn't subscribed to the list,
>> >> thus cannot reply to it directly.
>> >>
>> >> http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20160606/161733.html
>> >>
>> >> Joerg, thanks for your reply. Could you please tell me what kind of
>> >> test cases I should prepare?
>> >
>> > The target/triple parser has a unit test in
>> > unittests/ADT/TripleTest.cpp. The rest should get output validation in
>> > clang's test/Driver directory. Not sure which one is the primary
>> > GNU/Linux test.
>>
>> Thanks for the pointer :)
>>
>> The patches are re-attached with test cases included. Do they look sane 
>> enough?
>
>> --- lib/Driver/ToolChains.cpp   (revision 272546)
>> +++ lib/Driver/ToolChains.cpp   (working copy)
>> @@ -4152,6 +4152,8 @@
>>
>>if (Triple.isAndroid())
>>  return Triple.isArch64Bit() ? "/system/bin/linker64" : 
>> "/system/bin/linker";
>> +  else if (Triple.getEnvironment() == llvm::Triple::Musl)
>> +return "/lib/ld-musl-" + Triple.getArchName().str() + ".so.1";
>
> It does not seem to me that the dynamic linker name detection will work
> on most archs not in the test cases. For example, the arm gentoo musl
> stage3's have the target triple

You're right. Frankly I've only had x86 platforms on my mind so far;
but I agree with Rafael that we could extend this to other archs in
the future.

> It seems difficult to get all cases right and some of them might not be
> very interesting, but it would be nice to have a more intelligent patch.
> See for example
>
> http://git.alpinelinux.org/cgit/aports/plain/main/clang/clang-0004-Add-musl-targets-and-dynamic-linker.patch

This looks neat :)


Lei
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2016-06-13 Thread Felix Janda via cfe-commits
[Added CC to the musl list]

Lei Zhang wrote:
> 2016-06-13 3:07 GMT+08:00 Joerg Sonnenberger :
> > On Sun, Jun 12, 2016 at 10:51:11AM +0800, Lei Zhang via llvm-commits wrote:
> >> Hi,
> >>
> >> I'm replying to this thread; sorry I wasn't subscribed to the list,
> >> thus cannot reply to it directly.
> >>
> >> http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20160606/161733.html
> >>
> >> Joerg, thanks for your reply. Could you please tell me what kind of
> >> test cases I should prepare?
> >
> > The target/triple parser has a unit test in
> > unittests/ADT/TripleTest.cpp. The rest should get output validation in
> > clang's test/Driver directory. Not sure which one is the primary
> > GNU/Linux test.
> 
> Thanks for the pointer :)
> 
> The patches are re-attached with test cases included. Do they look sane 
> enough?

> --- lib/Driver/ToolChains.cpp   (revision 272546)
> +++ lib/Driver/ToolChains.cpp   (working copy)
> @@ -4152,6 +4152,8 @@
>
>if (Triple.isAndroid())
>  return Triple.isArch64Bit() ? "/system/bin/linker64" : 
> "/system/bin/linker";
> +  else if (Triple.getEnvironment() == llvm::Triple::Musl)
> +return "/lib/ld-musl-" + Triple.getArchName().str() + ".so.1";

It does not seem to me that the dynamic linker name detection will work
on most archs not in the test cases. For example, the arm gentoo musl
stage3's have the target triple

armv7a-hardfloat-linux-musleabi

and the dynamic linker name

/lib/ld-musl-armhf.so.1

Generally, the dynamic linker name takes the form
"/lib/ld-musl-$ARCH$SUBARCH.so.1", where the definite source for the
values of $ARCH and $SUBARCH is musl's configure script.

It seems difficult to get all cases right and some of them might not be
very interesting, but it would be nice to have a more intelligent patch.
See for example

http://git.alpinelinux.org/cgit/aports/plain/main/clang/clang-0004-Add-musl-targets-and-dynamic-linker.patch

Felix
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits