From owner-cvs-gnu Thu Nov 2 10:48:39 1995 Return-Path: owner-cvs-gnu Received: (from root@localhost) by freefall.freebsd.org (8.6.12/8.6.6) id KAA11292 for cvs-gnu-outgoing; Thu, 2 Nov 1995 10:48:39 -0800 Received: (from nate@localhost) by freefall.freebsd.org (8.6.12/8.6.6) id KAA11239 ; Thu, 2 Nov 1995 10:48:20 -0800 Date: Thu, 2 Nov 1995 10:48:20 -0800 From: Nate Williams Message-Id: <199511021848.KAA11239@freefall.freebsd.org> To: CVS-commiters, cvs-gnu Subject: cvs commit: src/gnu/usr.bin/ld/rtld rtld.c Sender: owner-cvs-gnu@FreeBSD.org Precedence: bulk nate 95/11/02 10:48:17 Modified: gnu/usr.bin/ld/i386 md-static-funcs.c gnu/usr.bin/ld/rtld rtld.c Log: Changed the terminology for what used to be called the "memorizing" vector. Now it is called the "symbol caching" vector. This was made possible and unconfusing by other changes that allowed me to localize everything having to do with the caching vector in the function reloc_map(). Switched to alloca() for allocating the caching vector, and eliminated the special mmap-based allocation routines. Although this was motivated by performance reasons, it led to significant simplification of the code, and made it possible to confine the symbol caching code to the single function reloc_map(). Got rid of the unnecessary and inefficient division loop at the beginning of rtld(). Reduced the number of calls to getenv("LD_LIBRARY_PATH") to just 1, on suggestion from . Added breaks out of the relocation loops when the relocation address is found to be 0. A relocation address of 0 is caused by an unused relocation entry. Unused relocation entries are caused by linking a shared object with the "-Bsymbolic" switch. The runtime linker itself is linked that way, and the last 40% of its relocation entries are unused. Thus, breaking out of the loop on the first such entry is a performance win when ld.so relocates itself. As a side benefit, it permits removing a test from md_relocate_simple() in ../i386/md-static-funcs.c. Unused relocation entries in other shared objects (linked with "-Bsymbolic") caused even bigger problems in previous versions of the runtime linker. The runtime linker interpreted the unused entries as if they were valid. That caused it to perform repeated relocations of the first byte of the shared object. In order to do that, it had to remap the text segment writable. Breaking out of the loop on the first unused relocation entry solves that. Submitted by: John Polstra