Date: Sun, 27 Jan 2002 16:07:53 -0800 From: Terry Lambert <tlambert2@mindspring.com> To: Alexey Zelkin <phantom@FreeBSD.ORG> Cc: Chad David <davidc@acns.ab.ca>, "Andrey A. Chernov" <ache@nagual.pp.ru>, "Brian F. Feldman" <green@FreeBSD.ORG>, Bruce Evans <bde@zeta.org.au>, arch@FreeBSD.ORG Subject: Re: strtod() Message-ID: <3C549659.13EEA86C@mindspring.com> 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>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3C549659.13EEA86C>