Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1MiVrV-0000OB-Do for mharc-grub-devel@gnu.org; Tue, 01 Sep 2009 12:05:37 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MiVrT-0000Mz-DG for grub-devel@gnu.org; Tue, 01 Sep 2009 12:05:35 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MiVrO-0000KK-Nj for grub-devel@gnu.org; Tue, 01 Sep 2009 12:05:34 -0400 Received: from [199.232.76.173] (port=38472 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MiVrO-0000KF-Jo for grub-devel@gnu.org; Tue, 01 Sep 2009 12:05:30 -0400 Received: from mail-px0-f202.google.com ([209.85.216.202]:50686) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MiVrN-0002H6-W9 for grub-devel@gnu.org; Tue, 01 Sep 2009 12:05:30 -0400 Received: by pxi40 with SMTP id 40so104063pxi.5 for ; Tue, 01 Sep 2009 09:05:28 -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=bTj2Vm3m+AgXxhe44RKiacBuhoBrmOXNHCunnW05azY=; b=I+1mD7leRuh3q0AxoCQgRvPdCceBrcvfBvwO/aArTjD6QZthqcTbr9aLlk84I9lRPp 8V1/R1bzIYNMX45d6VRWGeHEsW5w7eGB1Wj0TSlY8SSCtKpYuZz2PI5hGgsMvKBWDxgM 0u8wOt6njbAMEPeKzPFsv4c6i9nilk8EkiCHs= 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=Kjyf83JuqSc7qJc84eRuNLaKccgFCfUhLszvgg6OEEcLIE6FcccB7DzTQMnDVDAfOb keDN/lB9PJox+9/wZNNUQpmd3uz0BAMeX52Tw77S1AODBOa7DaxP+xSqQMhtZBj4LGKJ Q+iQiyyDfpuyz5CJqiXVDQYul4+98qZiTBY/o= MIME-Version: 1.0 Received: by 10.140.166.20 with SMTP id o20mr1705791rve.75.1251821128372; Tue, 01 Sep 2009 09:05:28 -0700 (PDT) In-Reply-To: References: Date: Wed, 2 Sep 2009 00:05:28 +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 16:05:35 -0000 On Tue, Sep 1, 2009 at 11:43 PM, Bean wrote: > 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. Hi, Oh BTW, I just remember a page comparing the benchmark of ubuntu, and find major slowdown in various tests after Ubuntu 7.04. Note that ubuntu 7.04 uses gcc 4.1, while ubuntu 8.04 uses gcc 4.2, could this be caused by the fact that gcc 4.2 starts to ignore some optimization flags ? http://www.phoronix.com/scan.php?page=article&item=ubuntu_bench_2008&num=1 -- Bean gitgrub home: http://github.com/grub/grub/ my fork page: http://github.com/bean123/grub/