Date: Tue, 24 Nov 1998 16:30:49 -0800 (PST) From: John Polstra <jdp@polstra.com> To: Joel Ray Holveck <joelh@gnu.org> Cc: current@FreeBSD.ORG Subject: Re: Elf linker question. Message-ID: <XFMail.981124163049.jdp@polstra.com> In-Reply-To: <86d86cy7do.fsf@detlev.UUCP>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?XFMail.981124163049.jdp>