From owner-freebsd-arch Sun Jan 27 16: 8: 6 2002 Delivered-To: freebsd-arch@freebsd.org Received: from hawk.prod.itd.earthlink.net (hawk.mail.pas.earthlink.net [207.217.120.22]) by hub.freebsd.org (Postfix) with ESMTP id 5DB9C37B402; Sun, 27 Jan 2002 16:08:03 -0800 (PST) Received: from pool0437.cvx22-bradley.dialup.earthlink.net ([209.179.199.182] helo=mindspring.com) by hawk.prod.itd.earthlink.net with esmtp (Exim 3.33 #1) id 16UzL6-0000n6-00; Sun, 27 Jan 2002 16:08:01 -0800 Message-ID: <3C549659.13EEA86C@mindspring.com> Date: Sun, 27 Jan 2002 16:07:53 -0800 From: Terry Lambert X-Mailer: Mozilla 4.7 [en]C-CCK-MCD {Sony} (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: Alexey Zelkin Cc: Chad David , "Andrey A. Chernov" , "Brian F. Feldman" , Bruce Evans , arch@FreeBSD.ORG Subject: Re: strtod() References: <20020126162924.A7726@colnta.acns.ab.ca> <200201270453.g0R4rwi92912@green.bikeshed.org> <20020127070421.GA13415@nagual.pp.ru> <20020127003719.A38420@colnta.acns.ab.ca> <3C53DB0B.6547EB76@mindspring.com> <20020127172250.B14791@phantom.cris.net> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Alexey Zelkin wrote: > Heh! I'm not a linker guru, so could you please explain problem more > deeply ? And in case if it's actually problem -- it will be fixed. > > It's important now since I am going to merge many locale specific changes > to STABLE soon. And would like to have it as more clean as possible. /usr/src/lib/csu/i386-elf/ Look at how _init: is defined in crti.S, and look for the definition of "monstartup()", and its use in crt1.c. Basically, this is code that gets called before any user code. In Windows terms, this is where you would put "process attach" functions for starting things like apartment model threading for a COM/OLE component in a DLL. The "process detach" is basically the "atexit". FreeBSD and Linux still don't have a "thread attach/detach", so don't get your hopes up, if you're a Windows programmer: there's still cool things you simply can't do. 8-). The G++ abuse is for the constructors. There's a linker set called "ctor_list"; this is executed by dereferencing the function pointer from the list (not in a particular order... bad for C++, actually) from the function "do_ctors" in the file /usr/src/lib/csu/common/crtbegin.c . To "abuse" this, all you have to do is add a function to the linker set, using an asm directive, and the function will get called around the time the constructors are called. If you think it's important to call your function earlier than any constructors, this might not be the way to go. This code file, BTW, also has use of the "attribute" directive to show you how to get things into specific named sections (if you care). Bruce can probably give you better information than this (actual code snippets) that I would have to sit down an work out for 15 minutes, whereas he could provide them off the top of his head, I think. -- Terry To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message