[llvm-dev] Why do we static link all llvm libraries in every executable?

242 views
Skip to first unread message

Yin Ma via llvm-dev

unread,
Jan 25, 2016, 1:14:08 PM1/25/16
to LLVM Developers Mailing List, cfe...@lists.llvm.org

Hi

 

I found basically all llvm libraries are statically linked into each executable and LLVMgold.so,

This make the clang/llvm package larger and larger with a lot of duplicated code. If I build

debug version, the disk space required is even larger. Is there any particular reason to keep

doing this way? If we separate several shared libraries something like libclang.so, libllvm.so

and let all executables and llvmgold.so just linked with .so. A lot of space could be saved and

loading performance could be improved.

 

Yin

Joerg Sonnenberger via llvm-dev

unread,
Jan 25, 2016, 1:16:49 PM1/25/16
to llvm...@lists.llvm.org, cfe...@lists.llvm.org
On Mon, Jan 25, 2016 at 10:13:35AM -0800, Yin Ma via llvm-dev wrote:
> If we separate several shared libraries something like
> libclang.so, libllvm.so and let all executables and llvmgold.so just
> linked with .so. A lot of space could be saved and
> loading performance could be improved.

There is a build option to do exactly that. It comes at a significant
price for startup, e.g. clang will take 10x as long for building a small
example.

Joerg
_______________________________________________
LLVM Developers mailing list
llvm...@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev

serge guelton via llvm-dev

unread,
Jan 25, 2016, 2:17:25 PM1/25/16
to llvm...@lists.llvm.org, cfe...@lists.llvm.org
On Mon, Jan 25, 2016 at 07:16:20PM +0100, Joerg Sonnenberger via llvm-dev wrote:
> On Mon, Jan 25, 2016 at 10:13:35AM -0800, Yin Ma via llvm-dev wrote:
> > If we separate several shared libraries something like
> > libclang.so, libllvm.so and let all executables and llvmgold.so just
> > linked with .so. A lot of space could be saved and
> > loading performance could be improved.
>
> There is a build option to do exactly that. It comes at a significant
> price for startup, e.g. clang will take 10x as long for building a small
> example.

Namely BUILD_SHARED_LIBS=ON

I find it very useful for dev builds!

Yury Gribov via llvm-dev

unread,
Jan 26, 2016, 3:44:37 AM1/26/16
to llvm...@lists.llvm.org, cfe...@lists.llvm.org
On 01/25/2016 09:16 PM, Joerg Sonnenberger via llvm-dev wrote:
> On Mon, Jan 25, 2016 at 10:13:35AM -0800, Yin Ma via llvm-dev wrote:
>> If we separate several shared libraries something like
>> libclang.so, libllvm.so and let all executables and llvmgold.so just
>> linked with .so. A lot of space could be saved and
>> loading performance could be improved.
>
> There is a build option to do exactly that. It comes at a significant
> price for startup, e.g. clang will take 10x as long for building a small
> example.

Is this to process runtime relocations or run constructors? I wonder if
Prelink or ElfHack could help.

David Blaikie via llvm-dev

unread,
Jan 26, 2016, 10:46:06 AM1/26/16
to Yury Gribov, llvm-dev, Clang Dev
On Tue, Jan 26, 2016 at 12:44 AM, Yury Gribov via cfe-dev <cfe...@lists.llvm.org> wrote:
On 01/25/2016 09:16 PM, Joerg Sonnenberger via llvm-dev wrote:
On Mon, Jan 25, 2016 at 10:13:35AM -0800, Yin Ma via llvm-dev wrote:
If we separate several shared libraries something like
libclang.so, libllvm.so and let all executables and llvmgold.so just
linked with .so. A lot of space could be saved and
loading performance could be improved.

There is a build option to do exactly that. It comes at a significant
price for startup, e.g. clang will take 10x as long for building a small
example.

Is this to process runtime relocations or run constructors? I wonder if Prelink or ElfHack could help.

Runtime relocations, I would imagine (global ctors would have to run in either mode - so shouldn't represent a difference, I would think?)
 

Joerg
_______________________________________________
LLVM Developers mailing list
llvm...@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev


_______________________________________________
cfe-dev mailing list
cfe...@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev

Reply all
Reply to author
Forward
0 new messages