All of lore.kernel.org
 help / color / mirror / Atom feed
* [meta-clang] LLVM shared library support
@ 2017-03-03 19:15 Martin Kelly
  2017-03-03 20:09 ` Khem Raj
  0 siblings, 1 reply; 6+ messages in thread
From: Martin Kelly @ 2017-03-03 19:15 UTC (permalink / raw)
  To: openembedded-core

Hi,

I noticed that meta-clang builds only static LLVM libraries, unlike the 
meta-oe version of LLVM 3.3, which builds shared libraries. In fact, 
this appears to be the LLVM upstream default as well.

What is the reason for the difference? Shared versions of LLVM would be 
useful for reducing the size of programs linked to it and making smaller 
filesystem images.

Thanks,
Martin


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [meta-clang] LLVM shared library support
  2017-03-03 19:15 [meta-clang] LLVM shared library support Martin Kelly
@ 2017-03-03 20:09 ` Khem Raj
  2017-03-09 21:06   ` Khem Raj
  0 siblings, 1 reply; 6+ messages in thread
From: Khem Raj @ 2017-03-03 20:09 UTC (permalink / raw)
  To: Martin Kelly; +Cc: Patches and discussions about the oe-core layer

On Fri, Mar 3, 2017 at 11:15 AM, Martin Kelly <mkelly@xevo.com> wrote:
> Hi,
>
> I noticed that meta-clang builds only static LLVM libraries, unlike the
> meta-oe version of LLVM 3.3, which builds shared libraries. In fact, this
> appears to be the LLVM upstream default as well.
>
> What is the reason for the difference? Shared versions of LLVM would be
> useful for reducing the size of programs linked to it and making smaller
> filesystem images.

meta-clang has only provided static compiler thus far, so using shared
or static did not matter as much in fact it could be helping with
faster compile
times that we see with clang. However, there is no binding to keep it static
link. Feel free to send a pull request to change it.

>
> Thanks,
> Martin


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [meta-clang] LLVM shared library support
  2017-03-03 20:09 ` Khem Raj
@ 2017-03-09 21:06   ` Khem Raj
  2017-03-09 21:32     ` Martin Kelly
  0 siblings, 1 reply; 6+ messages in thread
From: Khem Raj @ 2017-03-09 21:06 UTC (permalink / raw)
  To: Martin Kelly; +Cc: Patches and discussions about the oe-core layer

On Fri, Mar 3, 2017 at 12:09 PM, Khem Raj <raj.khem@gmail.com> wrote:
> On Fri, Mar 3, 2017 at 11:15 AM, Martin Kelly <mkelly@xevo.com> wrote:
>> Hi,
>>
>> I noticed that meta-clang builds only static LLVM libraries, unlike the
>> meta-oe version of LLVM 3.3, which builds shared libraries. In fact, this
>> appears to be the LLVM upstream default as well.
>>
>> What is the reason for the difference? Shared versions of LLVM would be
>> useful for reducing the size of programs linked to it and making smaller
>> filesystem images.
>
> meta-clang has only provided static compiler thus far, so using shared
> or static did not matter as much in fact it could be helping with
> faster compile
> times that we see with clang. However, there is no binding to keep it static
> link. Feel free to send a pull request to change it.

I did try this and I see a considerable slowdown in compiler speed. I changed
two things at a time so may be its the other

diff --git a/recipes-devtools/clang/clang_git.bb
b/recipes-devtools/clang/clang_git.bb
index 6c6e66a..7de2be1 100644
--- a/recipes-devtools/clang/clang_git.bb
+++ b/recipes-devtools/clang/clang_git.bb
@@ -73,7 +73,8 @@ EXTRA_OECMAKE_append_class-nativesdk = "\
                -DCLANG_TABLEGEN=${STAGING_BINDIR_NATIVE}/clang-tblgen \
 "
 EXTRA_OECMAKE_append_class-target = "\
-               -DLLVM_ENABLE_PIC=False \
+               -DBUILD_SHARED_LIBS=ON \
+               -DLLVM_ENABLE_PIC=ON \
                -DLLVM_TABLEGEN=${STAGING_BINDIR_NATIVE}/llvm-tblgen \
                -DCLANG_TABLEGEN=${STAGING_BINDIR_NATIVE}/clang-tblgen \
                -DLLVM_TARGETS_TO_BUILD=${@get_clang_target_arch(bb, d)} \

>
>>
>> Thanks,
>> Martin


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [meta-clang] LLVM shared library support
  2017-03-09 21:06   ` Khem Raj
@ 2017-03-09 21:32     ` Martin Kelly
  2017-03-10  5:20       ` Khem Raj
  0 siblings, 1 reply; 6+ messages in thread
From: Martin Kelly @ 2017-03-09 21:32 UTC (permalink / raw)
  To: Khem Raj; +Cc: Patches and discussions about the oe-core layer

On 03/09/2017 01:06 PM, Khem Raj wrote:
> On Fri, Mar 3, 2017 at 12:09 PM, Khem Raj <raj.khem@gmail.com> wrote:
>>
>> meta-clang has only provided static compiler thus far, so using shared
>> or static did not matter as much in fact it could be helping with
>> faster compile
>> times that we see with clang. However, there is no binding to keep it static
>> link. Feel free to send a pull request to change it.
>
> I did try this and I see a considerable slowdown in compiler speed. I changed
> two things at a time so may be its the other
>
> diff --git a/recipes-devtools/clang/clang_git.bb
> b/recipes-devtools/clang/clang_git.bb
> index 6c6e66a..7de2be1 100644
> --- a/recipes-devtools/clang/clang_git.bb
> +++ b/recipes-devtools/clang/clang_git.bb
> @@ -73,7 +73,8 @@ EXTRA_OECMAKE_append_class-nativesdk = "\
>                 -DCLANG_TABLEGEN=${STAGING_BINDIR_NATIVE}/clang-tblgen \
>  "
>  EXTRA_OECMAKE_append_class-target = "\
> -               -DLLVM_ENABLE_PIC=False \
> +               -DBUILD_SHARED_LIBS=ON \
> +               -DLLVM_ENABLE_PIC=ON \
>                 -DLLVM_TABLEGEN=${STAGING_BINDIR_NATIVE}/llvm-tblgen \
>                 -DCLANG_TABLEGEN=${STAGING_BINDIR_NATIVE}/clang-tblgen \
>                 -DLLVM_TARGETS_TO_BUILD=${@get_clang_target_arch(bb, d)} \
>
>>

Those are the exact changes I have been testing with; 
-DLLVM_ENABLE_PIC=ON is certainly necessary to prevent QA errors 
regarding text relocation, so you can't really make the changes in 
isolation. That said, the change is still very useful, as there are some 
programs that use only shared libLLVM.so, and without them you can't 
really use them with bitbake.

I hope to have a pull request for you soon once I iron out the rest of 
the issues.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [meta-clang] LLVM shared library support
  2017-03-09 21:32     ` Martin Kelly
@ 2017-03-10  5:20       ` Khem Raj
  2017-03-10  5:59         ` Martin Kelly
  0 siblings, 1 reply; 6+ messages in thread
From: Khem Raj @ 2017-03-10  5:20 UTC (permalink / raw)
  To: Martin Kelly; +Cc: Patches and discussions about the oe-core layer

On Thu, Mar 9, 2017 at 1:32 PM, Martin Kelly <mkelly@xevo.com> wrote:
> On 03/09/2017 01:06 PM, Khem Raj wrote:
>>
>> On Fri, Mar 3, 2017 at 12:09 PM, Khem Raj <raj.khem@gmail.com> wrote:
>>>
>>>
>>> meta-clang has only provided static compiler thus far, so using shared
>>> or static did not matter as much in fact it could be helping with
>>> faster compile
>>> times that we see with clang. However, there is no binding to keep it
>>> static
>>> link. Feel free to send a pull request to change it.
>>
>>
>> I did try this and I see a considerable slowdown in compiler speed. I
>> changed
>> two things at a time so may be its the other
>>
>> diff --git a/recipes-devtools/clang/clang_git.bb
>> b/recipes-devtools/clang/clang_git.bb
>> index 6c6e66a..7de2be1 100644
>> --- a/recipes-devtools/clang/clang_git.bb
>> +++ b/recipes-devtools/clang/clang_git.bb
>> @@ -73,7 +73,8 @@ EXTRA_OECMAKE_append_class-nativesdk = "\
>>                 -DCLANG_TABLEGEN=${STAGING_BINDIR_NATIVE}/clang-tblgen \
>>  "
>>  EXTRA_OECMAKE_append_class-target = "\
>> -               -DLLVM_ENABLE_PIC=False \
>> +               -DBUILD_SHARED_LIBS=ON \
>> +               -DLLVM_ENABLE_PIC=ON \
>>                 -DLLVM_TABLEGEN=${STAGING_BINDIR_NATIVE}/llvm-tblgen \
>>                 -DCLANG_TABLEGEN=${STAGING_BINDIR_NATIVE}/clang-tblgen \
>>                 -DLLVM_TARGETS_TO_BUILD=${@get_clang_target_arch(bb, d)} \
>>
>>>
>
> Those are the exact changes I have been testing with; -DLLVM_ENABLE_PIC=ON
> is certainly necessary to prevent QA errors regarding text relocation, so
> you can't really make the changes in isolation. That said, the change is
> still very useful, as there are some programs that use only shared
> libLLVM.so, and without them you can't really use them with bitbake.
>

slow down is 6x when using clang to compile on target, I dont know if such
a patch would be a good thing from compiler pov.

> I hope to have a pull request for you soon once I iron out the rest of the
> issues.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [meta-clang] LLVM shared library support
  2017-03-10  5:20       ` Khem Raj
@ 2017-03-10  5:59         ` Martin Kelly
  0 siblings, 0 replies; 6+ messages in thread
From: Martin Kelly @ 2017-03-10  5:59 UTC (permalink / raw)
  To: Khem Raj; +Cc: Patches and discussions about the oe-core layer

On 03/09/2017 09:20 PM, Khem Raj wrote:
>
> slow down is 6x when using clang to compile on target, I dont know if such
> a patch would be a good thing from compiler pov.
>

I definitely understand the drawbacks of a slowdown. That said, some 
programs (such as the one I'm working on packaging) don't support static 
libLLVM at all, so without such a patch you cannot use them in Yocto, 
which is sad. In addition, using the shared version helps reduce disk 
and memory usage if you have multiple programs using it. These of course 
are always good things in an embedded context.

Would it be possible to somehow split the shared and static versions 
into separate recipes, or somehow trigger the choice from local 
configuration? That could provide the best of both worlds.


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-03-10  6:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-03 19:15 [meta-clang] LLVM shared library support Martin Kelly
2017-03-03 20:09 ` Khem Raj
2017-03-09 21:06   ` Khem Raj
2017-03-09 21:32     ` Martin Kelly
2017-03-10  5:20       ` Khem Raj
2017-03-10  5:59         ` Martin Kelly

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.