Date: Mon, 5 Feb 2007 14:08:12 +0200 From: Kostik Belousov <kostikbel@gmail.com> To: Luigi Rizzo <rizzo@icir.org> Cc: current@freebsd.org Subject: Re: link_elf.c vs link_elf_obj.c ? Message-ID: <20070205120812.GB3304@deviant.kiev.zoral.com.ua> In-Reply-To: <20070205040037.A35752@xorpc.icir.org> References: <20070202172756.A2649@xorpc.icir.org> <20070205115553.GA3304@deviant.kiev.zoral.com.ua> <20070205040037.A35752@xorpc.icir.org>
next in thread | previous in thread | raw e-mail | index | archive | help
--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--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070205120812.GB3304>