From owner-freebsd-current@FreeBSD.ORG Mon Feb 5 12:26:20 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 1C4A316A400 for ; Mon, 5 Feb 2007 12:26:19 +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 B85C113C461 for ; Mon, 5 Feb 2007 12:26:18 +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 1HE2S5-000Cea-2J for current@freebsd.org; Mon, 05 Feb 2007 13:56:13 +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 l15BtsGc000602 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 5 Feb 2007 13:55:54 +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 l15Btste050141; Mon, 5 Feb 2007 13:55:54 +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 l15Btrbg050092; Mon, 5 Feb 2007 13:55:53 +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 13:55:53 +0200 From: Kostik Belousov To: Luigi Rizzo Message-ID: <20070205115553.GA3304@deviant.kiev.zoral.com.ua> References: <20070202172756.A2649@xorpc.icir.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="mP3DRpeJDSE+ciuQ" Content-Disposition: inline In-Reply-To: <20070202172756.A2649@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: f2683d8df775da069012ccac6e6e6321 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:26:20 -0000 --mP3DRpeJDSE+ciuQ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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. 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 are t= he assembler output (although ld -r can glue several .o files into one). Executables and .so are in some sense finalized, and they contain a tables that are useful for dynamic linker. Also, they usually carry different kind of relocations then relocatables. 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_elf.c) or relocatables (link_elf_obj.c). 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). Note that Solaris uses relocatables for modules. --mP3DRpeJDSE+ciuQ Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (FreeBSD) iD8DBQFFxxtIC3+MBN1Mb4gRApokAJ9gQRV7hR3HBqDKihgmqZaK19x8qwCg8zdI PnHUzZ1t+lxphs6HAbZifGU= =Gbkf -----END PGP SIGNATURE----- --mP3DRpeJDSE+ciuQ--