From owner-cvs-all Tue Jul 25 21:24:48 2000 Delivered-To: cvs-all@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (Postfix) with ESMTP id 0B71537BDD4; Tue, 25 Jul 2000 21:24:42 -0700 (PDT) (envelope-from jdp@FreeBSD.org) Received: (from jdp@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id VAA41799; Tue, 25 Jul 2000 21:24:41 -0700 (PDT) (envelope-from jdp@FreeBSD.org) Message-Id: <200007260424.VAA41799@freefall.freebsd.org> From: John Polstra Date: Tue, 25 Jul 2000 21:24:41 -0700 (PDT) To: cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: cvs commit: src/libexec/rtld-elf rtld.c rtld.h X-FreeBSD-CVS-Branch: HEAD Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG jdp 2000/07/25 21:24:41 PDT Modified files: libexec/rtld-elf rtld.c rtld.h Log: Revamp the code that calls shared libraries' init and fini functions. Formerly the init functions were called in the opposite of the order in which libraries were loaded, and libraries were loaded according to a breadth-first traversal of the dependency graph. That ordering came from SVR4.0, and it was easy to implement but not always sensible. Now we do a depth-first walk over the dependency graph and call the init functions in an order such that each shared object's needed objects are initialized before the shared object itself. At the same time we build a list of finalization (fini) functions in the opposite order, to guarantee correct C++ destructor ordering whenever possible. (It may not be possible if dlopen and dlclose are used in strange ways, but we come as close as one can come.) The need for this renovation has become apparent as more programs have started using multithreading. The multithreaded C library libc_r requires initialization, whereas the standard libc does not. Since virtually every other object depends on the C library, it is important that it get initialized first. Revision Changes Path 1.47 +184 -99 src/libexec/rtld-elf/rtld.c 1.19 +3 -9 src/libexec/rtld-elf/rtld.h To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message