Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1MiVVu-0007BI-Mz for mharc-grub-devel@gnu.org; Tue, 01 Sep 2009 11:43:18 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MiVVt-0007Aq-ND for grub-devel@gnu.org; Tue, 01 Sep 2009 11:43:17 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MiVVo-00076N-RH for grub-devel@gnu.org; Tue, 01 Sep 2009 11:43:16 -0400 Received: from [199.232.76.173] (port=58619 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MiVVo-00076K-LT for grub-devel@gnu.org; Tue, 01 Sep 2009 11:43:12 -0400 Received: from mail-pz0-f193.google.com ([209.85.222.193]:37014) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MiVVo-0005d2-1F for grub-devel@gnu.org; Tue, 01 Sep 2009 11:43:12 -0400 Received: by pzk31 with SMTP id 31so87571pzk.6 for ; Tue, 01 Sep 2009 08:43:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type; bh=aMKjppw7RAoEYTT/maYMIehBPY6pFm49Vl8jX8aiNOg=; b=tN4i3Uk1GlqhOHrWhj3Mp1oloQmu5war+zNRbzsaZ6QIhB74nV4sWZ/07onqcOz7KA OUyRrirW4UkDh0EfE9HW4qDEegG2p27hrtgB6y20EumD6O/OAzgBapbjYvJ+q/zyMT51 DfMdPdCJhH+c1AestlTVWnvb5cjP3wQASD+JU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=m9pv+fqEgWOGprdr0ahnO8iSCdcCR/tspbIk5bpxthZkW0t0WRYrdGpOFFIyDL4HsP CmOyC0+d43keK3nzmn4/TkOF2botXhUZQlS0HOEHMi4lcZlDuTd9R2h+Wf9lDUeiJKPC +nWAdByRIF3roThx4AP8mc0cz+RbS6JET/wTY= MIME-Version: 1.0 Received: by 10.140.208.12 with SMTP id f12mr231764rvg.279.1251819790829; Tue, 01 Sep 2009 08:43:10 -0700 (PDT) In-Reply-To: References: Date: Tue, 1 Sep 2009 23:43:10 +0800 Message-ID: From: Bean To: The development of GRUB 2 Content-Type: text/plain; charset=ISO-8859-1 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) Subject: Re: [RFC] Eliminate NESTED_ATTR_FUNC X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Sep 2009 15:43:17 -0000 On Tue, Sep 1, 2009 at 9:42 PM, Vladimir 'phcoder' Serbinenko wrote: > Hello. NESTED_ATTR_FUNC was introduced 6 years ago to workaround a bug > in compiler. Now it creates only problems. In particular if they are > used wrong it creates a bug of argument passing. Such bugs are > difficult to find because it usually results in strange behaviour and > in grub-emu NESTED_FUNC_ATTR is exteneded to an empty string so gdb > and valgrind can't detect any error. Should we perhaps remove it > coupled with adding a requirement for at least gcc 4.2? Can I run > s/NESTED_FUNC_ATTR//g; on entire codebase and remove corresponding > entry in configure.ac? Hi, I make an assembly dump of the code generated by gcc-4.2. Apparently, the "FIX" is achieved by ignoring the regparm attribute at all. __attribute__ ((__regparm__ (3))) doesn't have any effect any more, it always pass the parameters on the stack. This defeats the original purpose of -mregparm=3, which passes parameters using register and therefore reduce module size. In fact, if we are going to use stack, we could just remove -mregparm=3 option, this works for all version of gcc. IMO, if we are to tackle the NESTED_FUNC_ATTR issue, we should do it properly by removing nested function, this also has other advantages, like allowing to run tools on systems like OSX that doesn't allow to execute code in stack by default. -- Bean gitgrub home: http://github.com/grub/grub/ my fork page: http://github.com/bean123/grub/