From owner-freebsd-alpha Mon Jun 21 9:52:27 1999 Delivered-To: freebsd-alpha@freebsd.org Received: from wall.polstra.com (rtrwan160.accessone.com [206.213.115.74]) by hub.freebsd.org (Postfix) with ESMTP id 73D2D14A14 for ; Mon, 21 Jun 1999 09:52:23 -0700 (PDT) (envelope-from jdp@polstra.com) Received: from vashon.polstra.com (vashon.polstra.com [206.213.73.13]) by wall.polstra.com (8.9.3/8.9.1) with ESMTP id JAA11004 for ; Mon, 21 Jun 1999 09:52:23 -0700 (PDT) (envelope-from jdp@polstra.com) Received: (from jdp@localhost) by vashon.polstra.com (8.9.3/8.9.1) id JAA01318 for alpha@freebsd.org; Mon, 21 Jun 1999 09:52:23 -0700 (PDT) (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 Date: Mon, 21 Jun 1999 09:52:23 -0700 (PDT) Organization: Polstra & Co., Inc. From: John Polstra To: alpha@freebsd.org Subject: ld-elf.so.1 performance fix for large programs on Alpha Sender: owner-freebsd-alpha@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org Yesterday I implemented a fix for the problem reported by Hidetoshi Shimokawa , in which very large programs (e.g., gdb) ran very slowly on the Alpha due to a dynamic linker problem. It passed the make world test, but I'd feel better if somebody could review it before I commit it. If any of you are willing to do that, please drop me a line and I'll send you the diffs. A brief description of the problem: Large programs on the Alpha exceed the maximum GOT size of 64K. In that case, the linker uses multiple GOTs. Thus two or more GOT entries might point to the same lazy binding stub in the PLT. But on the first call to a lazily bound function, it is only possible for the dynamic linker to find the first GOT entry and fix it up to point directly at the target function. Calls through the other GOT entries still go to the stub code in the PLT. As a result, the dynamic linker goes through the entire lazy binding process on every call that goes through an auxiliary GOT entry. Since that involves searching a bunch of symbol tables, it's very slow. The fix was to rewrite the stubs in the PLT itself during lazy binding. The dynamic linker overwrites the original stub with code that jumps to the target function. With that change, even calls through the auxiliary GOT entries can bypass the lazy binding code. Each PLT entry has room for 3 instructions, and I was able to find a way to generate a jump to the target function in that amount of space, no matter how far away the function is. I believe the rewriting is done in a threadsafe and MP-safe manner, and an IMB instruction is executed after the rewriting is finished to flush the instruction cache. It was a major change, and breaking the dynamic linker is a one-way journey to the fixit floppy. I'd appreciate a review if any of you have the time. John --- John Polstra jdp@polstra.com John D. Polstra & Co., Inc. Seattle, Washington USA "Self-interest is the aphrodisiac of belief." -- James V. DeLong To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-alpha" in the body of the message