Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 26 Apr 2012 12:53:45 +0100
From:      David Chisnall <theraven@theravensnest.org>
To:        Bob Bishop <rb@gid.co.uk>
Cc:        Konstantin Belousov <kostikbel@gmail.com>, toolchain@freebsd.org, current@freebsd.org
Subject:   Re: [RFC] Un-staticise the toolchain
Message-ID:  <E8ED244D-E692-4772-907E-3D9AFEDFD435@theravensnest.org>
In-Reply-To: <5BCE2E77-2B45-43B7-AB1F-6E6C13B87B34@gid.co.uk>
References:  <20120426093548.GR2358@deviant.kiev.zoral.com.ua> <5BCE2E77-2B45-43B7-AB1F-6E6C13B87B34@gid.co.uk>

next in thread | previous in thread | raw e-mail | index | archive | help
On 26 Apr 2012, at 12:38, Bob Bishop wrote:

> Hi,
>=20
> On 26 Apr 2012, at 10:35, Konstantin Belousov wrote:
>=20
>> I think it is time to stop building the toolchain static. I was told =
that
>> original reasoning for static linking was the fear of loosing the =
ability
>> to recompile if some problem appears with rtld and any required =
dynamic
>> library. Apparently, current dependencies are much more spread, e.g. =
/bin/sh
>> is dynamically linked [etc]
>=20
> That seems like a bad mistake, because it would prevent even booting =
single-user if rtld/libraries are broken.

That's what /rescue is for.  You will find statically linked tools there =
that are just about to repair a broken system (a static nc would also be =
nice...).

I did some benchmarks a little while ago, and there was, I think, about =
a 5% slowdown on buildworld with a dynamically linked clang vs a =
statically linked one on x86-64.  Ideally, I'd want the bootstrap =
compiler to be statically linked but the installed one to be dynamic. =20=


The advantage of dynamic linking is small now, but as we add more LLVM =
and clang-based tools to the base system (e.g. LLVM-based firewall JIT, =
clang-based indent replacement) we're going to see lots of simple tools =
being 5-10MB if we enforce static linking. =20

We'll probably get a much bigger speed win from clangd (hopefully =
appearing in time for LLVM 3.2) avoiding the need to spawn a new process =
for every compiler invocation than we'll save from static linking. =20

As to compiling things when rtld is broken... clang in the base system =
currently dynamically links to lib[std]c++, libgcc_s, libm and libc, it =
only statically links to the clang and LLVM libraries.

David=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?E8ED244D-E692-4772-907E-3D9AFEDFD435>