Date: Mon, 30 Apr 2012 22:52:35 -0700 From: Tim Kientzle <tim@kientzle.com> To: Erik Cederstrand <erik@cederstrand.dk> Cc: freebsd-current FreeBSD <freebsd-current@freebsd.org> Subject: Re: [RFC] Un-staticise the toolchain Message-ID: <A79EE48D-A2AC-4D35-B156-1F58D17F77DD@kientzle.com> In-Reply-To: <42D8809D-0E99-47A5-802F-71991B5B0B8D@cederstrand.dk> References: <20120426093548.GR2358@deviant.kiev.zoral.com.ua> <20120426134140.GF14350@lo0.su> <CADLo838sdUT2e%2B7j8vCyOmDithLsh3kwDd_z04dWaPoiMphPDQ@mail.gmail.com> <4F99ACF9.2050609@infracaninophile.co.uk> <CADLo83_sr=13H=9nnrdge0jJaOh5Bk2N_gg=Gf-uYhwM8jm7Xg@mail.gmail.com> <42D8809D-0E99-47A5-802F-71991B5B0B8D@cederstrand.dk>
index | next in thread | previous in thread | raw e-mail
On Apr 30, 2012, at 6:41 AM, Erik Cederstrand wrote:
>
> Can anyone explain to me why the dynamically linked version is significantly slower? What are the extra steps involved compared to a statically linked binary?
At the risk of dramatically over-simplifying….
When a static binary is started by the kernel, it does the following:
* Initializes some libc internals.
* Calls main.
When a dynamic binary is started by the kernel, it does the following:
* Initializes some libc internals.
* For every dynamic library referenced by this executable:
- loads the dynamic library into memory
- fixes up references
* Calls main
The process of loading the required libraries and fixing up references
can be quite time-consuming.
Cheers,
Tim
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?A79EE48D-A2AC-4D35-B156-1F58D17F77DD>
