From mint-bounce@lists.fishpool.fi Fri Feb 27 07:55:30 2009 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:message-id:date:from :user-agent:mime-version:to:subject:references:in-reply-to :content-type:content-transfer-encoding; bh=zgTWiLF4geEaBJy1hsUyJ0AyGn98HR+OQCoPZDTpedI=; b=le1HOGThRh1JtFOnh+Fgk9PPliqNEOruRHZXlGsZOnpOLuZwrFpeC9YWsZUm3eAEv3 +NGVsmIW8wj3wz8rdY4D9DdFTI3l08I2PKaibVBSFVqG9p/lAefgV0HndCUQRQnlnnYV lYsQtmgf21am+M8+AuLNVnveuSGNLgES9QbjY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:message-id:date:from:user-agent:mime-version:to:subject :references:in-reply-to:content-type:content-transfer-encoding; b=no4EfopFvJtH9RVwk/miaGbrRMuO0vGTRxIynaUx1YdJt2FV8C4vjEkTy0fytVMaLG cII+PIcstfUkiIPEdTSLP5IYkSKTf/FkoGh7x/i5r+Jk+kvJ+Fr2AGLH5D3Du3BppydV 47X1yR+IZUbcIB+0dc5Dy2Fu3EMlnnxofoqQ0= Message-ID: <49A7E1F9.5070701@freesbee.fr> Date: Fri, 27 Feb 2009 13:52:09 +0100 From: =?ISO-8859-1?Q?Vincent_Rivi=E8re?= User-Agent: Thunderbird 2.0.0.19 (Windows/20081209) MIME-Version: 1.0 To: mint Subject: Re: [MiNT] sleep patch References: <49A73EBE.4070902@freesbee.fr> <1235728251.5850.46.camel@jetpack.demon.co.uk> <49A7BD66.1040106@freesbee.fr> In-Reply-To: <49A7BD66.1040106@freesbee.fr> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-ecartis-version: Ecartis v1.0.0 Sender: mint-bounce@lists.fishpool.fi Errors-to: mint-bounce@lists.fishpool.fi X-original-sender: vincent.riviere@freesbee.fr Precedence: bulk List-help: List-unsubscribe: List-Id: X-List-ID: List-subscribe: List-owner: List-post: Here is some additional information about weak aliases, since it can be useful to well understand them for porting existing software or debugging the MiNTLib. The weak behavior I described in my previous message is an extension provided by the GNU linker (ld). It is supported the a.out object file format, and by the GNU assembler (as) through the directive ".weak". The documentation in the binutils is pretty poor: http://sourceware.org/binutils/docs-2.19/as/Weak.html The syntax ".weak alias = orignal" used by the MiNTLib doesn't seem to be documented. The statement "weak_alias" used by the MiNTLib is actually a convenient macro. It is defined in mintlib/mintlib/libc-symbols.h : http://sparemint.org/cgi-bin/cvsweb/mintlib/mintlib/libc-symbols.h?rev=1.3&content-type=text/x-cvsweb-markup We can see it uses directly the ".weak" directive through inline assembly. GCC can also generate a weak alias to a function by using a prototype and the attributes "weak" and "alias" void sleep() __attribute__((weak, alias ("__sleep"))); http://gcc.gnu.org/onlinedocs/gcc-4.3.3/gcc/Function-Attributes.html#index-g_t_0040code_007balias_007d-attribute-2116 http://gcc.gnu.org/onlinedocs/gcc-4.3.3/gcc/Function-Attributes.html#index-g_t_0040code_007bweak_007d-attribute-2187 GCC can also generate weak functions, without the need for an alias: void __attribute__((weak)) sleep() { ... } GCC can also achieve the same behavior by using "#pragma weak ...", but it seems to be present only for compatibility purpose. http://gcc.gnu.org/onlinedocs/gcc-4.3.3/gcc/Weak-Pragmas.html -- Vincent Rivière