From owner-freebsd-current@FreeBSD.ORG Mon Feb 5 12:08:30 2007 Return-Path: X-Original-To: current@freebsd.org Delivered-To: freebsd-current@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2DA8516A40E for ; Mon, 5 Feb 2007 12:08:30 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from relay02.kiev.sovam.com (relay02.kiev.sovam.com [62.64.120.197]) by mx1.freebsd.org (Postfix) with ESMTP id B2AFF13C481 for ; Mon, 5 Feb 2007 12:08:28 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from [212.82.216.227] (helo=fw.zoral.com.ua) by relay02.kiev.sovam.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.60) (envelope-from ) id 1HE2dv-000I3L-6J for current@freebsd.org; Mon, 05 Feb 2007 14:08:27 +0200 Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by fw.zoral.com.ua (8.13.4/8.13.4) with ESMTP id l15C8CNb000867 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 5 Feb 2007 14:08:12 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.13.8/8.13.8) with ESMTP id l15C8CJ7003216; Mon, 5 Feb 2007 14:08:12 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.13.8/8.13.8/Submit) id l15C8CvT003215; Mon, 5 Feb 2007 14:08:12 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Mon, 5 Feb 2007 14:08:12 +0200 From: Kostik Belousov To: Luigi Rizzo Message-ID: <20070205120812.GB3304@deviant.kiev.zoral.com.ua> References: <20070202172756.A2649@xorpc.icir.org> <20070205115553.GA3304@deviant.kiev.zoral.com.ua> <20070205040037.A35752@xorpc.icir.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="cvVnyQ+4j833TQvp" Content-Disposition: inline In-Reply-To: <20070205040037.A35752@xorpc.icir.org> User-Agent: Mutt/1.4.2.2i X-Virus-Scanned: ClamAV version 0.88.7, clamav-milter version 0.88.7 on fw.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-0.1 required=5.0 tests=ALL_TRUSTED,SPF_NEUTRAL autolearn=failed version=3.1.7 X-Spam-Checker-Version: SpamAssassin 3.1.7 (2006-10-05) on fw.zoral.com.ua X-Scanner-Signature: 1e0f9aa0c43ce3c3744db576a35a93a3 X-DrWeb-checked: yes X-SpamTest-Envelope-From: kostikbel@gmail.com X-SpamTest-Group-ID: 00000000 X-SpamTest-Info: Profiles 744 [Feb 05 2007] X-SpamTest-Info: helo_type=3 X-SpamTest-Info: {received from trusted relay: not dialup} X-SpamTest-Method: none X-SpamTest-Method: Local Lists X-SpamTest-Rate: 0 X-SpamTest-Status: Not detected X-SpamTest-Status-Extended: not_detected X-SpamTest-Version: SMTP-Filter Version 3.0.0 [0255], KAS30/Release Cc: current@freebsd.org Subject: Re: link_elf.c vs link_elf_obj.c ? 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: Mon, 05 Feb 2007 12:08:30 -0000 --cvVnyQ+4j833TQvp Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Feb 05, 2007 at 04:00:38AM -0800, Luigi Rizzo wrote: > On Mon, Feb 05, 2007 at 01:55:53PM +0200, Kostik Belousov wrote: > > On Fri, Feb 02, 2007 at 05:27:56PM -0800, Luigi Rizzo wrote: > > > does anyone know what is the difference between these two files ? > > > They seem to do two similar but slightly different things related > > > to elf file loading. > > >=20 > > > But diff shows large pieces of common code, and there is even > > > more commonality if you factor out whitespace changes and > > > variable renaming. > >=20 > > ELF specification defines 3 kinds of objects (putting core files aside); > > - executables > > - shared objects (AKA .so) > > - relocatable objects (AKA .o, created by assembler). > > Executables and .so are usually created by linker, while relocatables a= re the > > assembler output (although ld -r can glue several .o files into one). > > Executables and .so are in some sense finalized, and they contain a tab= les > > that are useful for dynamic linker. Also, they usually carry different = kind > > of relocations then relocatables. > >=20 > > Now, in-kernel dynamic linker used for linking newly-loaded kld, shall = deal > > with either .so-kind of modules (on FreeBSD, all arches except amd64), = or > > relocatables (amd64). Two linkers you found deal with .so-kind (link_el= f.c) > > or relocatables (link_elf_obj.c). > >=20 > > Reasons why amd64 cannot use shared objects for kld mostly caused by > > toolchains limitations and CPU architecture (it is impossible to create > > working non-PIC .so there). > >=20 > > Note that Solaris uses relocatables for modules. >=20 > so, if one had to write a few lines of comment on top of each > of these two files to tell what they do and how they differ, > what would you write ? As I said, link_elf.c is linker for kld's that are shared objects, while link_elf_obj.c - for relocatables. --cvVnyQ+4j833TQvp Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (FreeBSD) iD8DBQFFxx4rC3+MBN1Mb4gRAhD9AJ4o41oNLi1/E3OrYb1qmdO8/79CYQCgze3x da6lEtFyC5YAhP4pm8klK9Y= =j0nx -----END PGP SIGNATURE----- --cvVnyQ+4j833TQvp--