From owner-freebsd-current Wed Apr 2 04:04:38 1997 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.5/8.8.5) id EAA25302 for current-outgoing; Wed, 2 Apr 1997 04:04:38 -0800 (PST) Received: from nlsystems.com (nlsys.demon.co.uk [158.152.125.33]) by freefall.freebsd.org (8.8.5/8.8.5) with ESMTP id EAA25297 for ; Wed, 2 Apr 1997 04:04:33 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by nlsystems.com (8.8.5/8.8.5) with SMTP id NAA11388; Wed, 2 Apr 1997 13:03:52 +0100 (BST) Date: Wed, 2 Apr 1997 13:03:51 +0100 (BST) From: Doug Rabson To: James da Silva cc: freebsd-current@freebsd.org Subject: Re: A new Kernel Module System In-Reply-To: <199704012328.SAA25348@bacardi.torrentnet.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-current@freebsd.org X-Loop: FreeBSD.org Precedence: bulk On Tue, 1 Apr 1997, James da Silva wrote: > >I plan to link the kernel as if it was a dynamic executable. This > >involves hacking ld(1) so that it still generates _DYNAMIC information > >even if no shared libraries are seen in the link. > > Doug, are you sure you can't do what you want with plain .o files, without > hacking ld and mucking with -Bshareable? > > I agree with John. The kernel symbol table is already loaded, or can > arrange to be loaded anyway. After that, you suck in the module .o files > whole, traversing their relocs and just applying them. The symbol tables > are pulled into a linked list of symbol tables for searching on subsequent > linking. > > This is very simple. I can dig up the code I have that does this (load .o > and reloc it against previously loaded symbols) if you want, it's less than > 8k of code. It actually seemed easier to use the symbol tables from -Bshareable. No hacking is required to ld other than a simple change to make sure it generates a symbol table and _DYNAMIC for /kernel. The rrs information has only the exported symbols from the object and includes extra useful information such as a symbol hashtable for lookups and a list of dependancies. > > What do you need that the simple method is lacking? Not much. The symbol hashtable and dependancy list should be useful though. -- Doug Rabson Mail: dfr@nlsystems.com Nonlinear Systems Ltd. Phone: +44 181 951 1891