From owner-freebsd-current@FreeBSD.ORG Tue May 1 05:52:56 2012 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4BC761065670 for ; Tue, 1 May 2012 05:52:56 +0000 (UTC) (envelope-from tim@kientzle.com) Received: from monday.kientzle.com (99-115-135-74.uvs.sntcca.sbcglobal.net [99.115.135.74]) by mx1.freebsd.org (Postfix) with ESMTP id 22CEC8FC1E for ; Tue, 1 May 2012 05:52:56 +0000 (UTC) Received: (from root@localhost) by monday.kientzle.com (8.14.4/8.14.4) id q415qaAk007710; Tue, 1 May 2012 05:52:37 GMT (envelope-from tim@kientzle.com) Received: from [192.168.2.143] (CiscoE3000 [192.168.1.65]) by kientzle.com with SMTP id 86z7a8ju58igtiq3iqu43a3m62; Tue, 01 May 2012 05:52:36 +0000 (UTC) (envelope-from tim@kientzle.com) Mime-Version: 1.0 (Apple Message framework v1257) Content-Type: text/plain; charset=windows-1252 From: Tim Kientzle In-Reply-To: <42D8809D-0E99-47A5-802F-71991B5B0B8D@cederstrand.dk> Date: Mon, 30 Apr 2012 22:52:35 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: References: <20120426093548.GR2358@deviant.kiev.zoral.com.ua> <20120426134140.GF14350@lo0.su> <4F99ACF9.2050609@infracaninophile.co.uk> <42D8809D-0E99-47A5-802F-71991B5B0B8D@cederstrand.dk> To: Erik Cederstrand X-Mailer: Apple Mail (2.1257) Cc: freebsd-current FreeBSD Subject: Re: [RFC] Un-staticise the toolchain X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 May 2012 05:52:56 -0000 On Apr 30, 2012, at 6:41 AM, Erik Cederstrand wrote: >=20 > 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=85. 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