From owner-freebsd-current@FreeBSD.ORG Thu Apr 17 17:32:05 2003 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 230C537B405 for ; Thu, 17 Apr 2003 17:32:05 -0700 (PDT) Received: from stork.mail.pas.earthlink.net (stork.mail.pas.earthlink.net [207.217.120.188]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8CFC543FBD for ; Thu, 17 Apr 2003 17:32:04 -0700 (PDT) (envelope-from tlambert2@mindspring.com) Received: from pool0101.cvx22-bradley.dialup.earthlink.net ([209.179.198.101] helo=mindspring.com) by stork.mail.pas.earthlink.net with asmtp (SSLv3:RC4-MD5:128) (Exim 3.33 #1) id 196JnM-00009l-00; Thu, 17 Apr 2003 17:32:01 -0700 Message-ID: <3E9F4731.2627885E@mindspring.com> Date: Thu, 17 Apr 2003 17:30:41 -0700 From: Terry Lambert X-Mailer: Mozilla 4.79 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: John Polstra References: <20030417141133.GA4155@madman.celabo.org> <20030417144449.GA4530@madman.celabo.org> <200304171535.h3HFZEFs094589@strings.polstra.com> <200304171944.h3HJi1jK095151@strings.polstra.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-ELNK-Trace: b1a02af9316fbb217a47c185c03b154d40683398e744b8a4a048fd8ed6dd21c4beb61f101365336e350badd9bab72f9c350badd9bab72f9c350badd9bab72f9c cc: current@freebsd.org Subject: Re: HEADS UP: new NSS X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Apr 2003 00:32:05 -0000 John Polstra wrote: > In article <20030418014500.B94094@iclub.nsu.ru>, > Max Khon wrote: > > we need either allow dlopen(3) to be used in statically linked programs > > or move to dynamically linked /. > > Moving to a fully dynamically linked system sounds easier to me. > But in the past there has been strong opposition to the idea every > time it has been proposed. FWIW, I have some static "libdlopen" patches, but you have to modify the internal compiler glue to use them. The problem is that you can't have multiple init sections, only multiple inits, and that that only really works with C++, if you want to put them in your code. The main modification is to stuff the dlopen stuff into the __CTOR_LIST__, and then make __ctors() pass an argument to the constructor. That's because __do_dynamic_link() needs an argument (it calls it "argv", but it's really "all the data you need to fill out "crt_ldso"). If you look in /usr/src/lib/csu/i386/crt0.c, and in the code in /usr/src/lib/csu/i386/c++rt0.c, you'll see what I mean. The actual modifications aren't hard; but you will have to give up resolving symbols in your own binary, as the price (i.e. the .init on the .so you load will have to call a "well known callback"; this is pretty easy: add a parameter to the passing of the dlopen() call into the .so you are loading of a function to call to register to get symbols; or you could just use statically linked PIC binaries with symbols attached, and open them as .so's, even though they are not named that way). -- Terry