From owner-freebsd-current Tue Nov 24 16:30:56 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id QAA00925 for freebsd-current-outgoing; Tue, 24 Nov 1998 16:30:56 -0800 (PST) (envelope-from owner-freebsd-current@FreeBSD.ORG) Received: from wall.polstra.com (rtrwan160.accessone.com [206.213.115.74]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id QAA00916 for ; Tue, 24 Nov 1998 16:30:54 -0800 (PST) (envelope-from jdp@polstra.com) Received: from vashon.polstra.com (vashon.polstra.com [206.213.73.13]) by wall.polstra.com (8.9.1/8.9.1) with ESMTP id QAA03405; Tue, 24 Nov 1998 16:30:50 -0800 (PST) (envelope-from jdp@polstra.com) Received: (from jdp@localhost) by vashon.polstra.com (8.9.1/8.9.1) id QAA01461; Tue, 24 Nov 1998 16:30:49 -0800 (PST) (envelope-from jdp@polstra.com) Message-ID: X-Mailer: XFMail 1.3 [p0] on FreeBSD X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit MIME-Version: 1.0 In-Reply-To: <86d86cy7do.fsf@detlev.UUCP> Date: Tue, 24 Nov 1998 16:30:49 -0800 (PST) Organization: Polstra & Co., Inc. From: John Polstra To: Joel Ray Holveck Subject: Re: Elf linker question. Cc: current@FreeBSD.ORG Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On 24-Nov-98 Joel Ray Holveck wrote: >> No, you're exactly right. But lazy binding applies only to function >> calls. There are also data references that have to be relocated. >> Those can't be done lazily. > > How are things like: > sighander_t mysig = libsig; > handled? Any time you take the address of a function, the linker actually fills in the address of a little stub routine. It's the same stub that gets called when you call an external function. The first time it is executed, the stub jumps to code in the dynamic linker that does the lazy binding to whatever function is being called. Then it rewires itself (an indirect jump is used) so that all future calls will go straight to the target function. I'm glossing over some details. But anyway, you get the address of the stub, not the address of the actual function. John --- John Polstra jdp@polstra.com John D. Polstra & Co., Inc. Seattle, Washington USA "Nobody ever went broke underestimating the taste of the American public." -- H. L. Mencken To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message