From owner-freebsd-current Wed Nov 25 08:13:33 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id IAA17555 for freebsd-current-outgoing; Wed, 25 Nov 1998 08:13:33 -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 IAA17549 for ; Wed, 25 Nov 1998 08:13:29 -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 IAA07245; Wed, 25 Nov 1998 08:13:20 -0800 (PST) (envelope-from jdp@polstra.com) Received: (from jdp@localhost) by vashon.polstra.com (8.9.1/8.9.1) id IAA02426; Wed, 25 Nov 1998 08:13:20 -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: <86btlwxv7p.fsf@detlev.UUCP> Date: Wed, 25 Nov 1998 08:13:20 -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 If you follow up to this, let's drop it off the mailing list. It's getting pretty far off topic. On 25-Nov-98 Joel Ray Holveck wrote: >>> 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. > > Oh, so it doesn't snap the pointer in the code? It just leaves it > pointing to the stub? That's right. The whole point of PIC is that you don't relocate anything in the text (code) segment. That way, all the processes using a given shared library can share the exact same copy of the code. Once the lazy binding has already been done for a given function, the "stub" hardly deserves the name. It's nothing more than an indirect jump through a location that contains a pointer to the real function's entry point. 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