From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1M7MV4-0001sL-4J for mharc-grub-devel@gnu.org; Fri, 22 May 2009 00:36:54 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1M7MV1-0001qq-U2 for grub-devel@gnu.org; Fri, 22 May 2009 00:36:52 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1M7MUw-0001ni-Up for grub-devel@gnu.org; Fri, 22 May 2009 00:36:51 -0400 Received: from [199.232.76.173] (port=55981 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1M7MUw-0001nU-L6 for grub-devel@gnu.org; Fri, 22 May 2009 00:36:46 -0400 Received: from c60.cesmail.net ([216.154.195.49]:64741) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_ARCFOUR_SHA1:16) (Exim 4.60) (envelope-from ) id 1M7MUv-0006WN-H8 for grub-devel@gnu.org; Fri, 22 May 2009 00:36:46 -0400 Received: from unknown (HELO smtprelay2.cesmail.net) ([192.168.1.112]) by c60.cesmail.net with ESMTP; 22 May 2009 00:36:44 -0400 Received: from ct.roinet.com (c-69-141-194-35.hsd1.pa.comcast.net [69.141.194.35]) by smtprelay2.cesmail.net (Postfix) with ESMTPSA id 3760D34C6A for ; Fri, 22 May 2009 00:38:11 -0400 (EDT) To: grub-devel@gnu.org From: Pavel Roskin Date: Fri, 22 May 2009 00:36:38 -0400 Message-ID: <20090522043638.10755.42855.stgit@ct.roinet.com> In-Reply-To: <20090522043632.10755.77091.stgit@ct.roinet.com> References: <20090522043632.10755.77091.stgit@ct.roinet.com> User-Agent: StGit/0.14.3.368.g58f7 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Subject: [PATCH 2/2] Eliminate incorrect check for grub_I386_CHECK_REGPARM_BUG 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: Fri, 22 May 2009 04:36:52 -0000 NESTED_FUNC_ATTR is defined to "__attribute__ ((__regparm__ (1))" for i386 targets regardless of the outcome of the test. Since NESTED_FUNC_ATTR is on the way out, a better test won't be written. To be safe, define NESTED_FUNC_ATTR whenever we are compiling the specific file for i386 architecture, even the target platform is not i386 (i.e. compiling utilities when the host is i386 and the target is not). ChangeLog: * aclocal.m4 (grub_I386_CHECK_REGPARM_BUG): Remove. * configure.ac: Don't call grub_I386_CHECK_REGPARM_BUG. Define NESTED_FUNC_ATTR by AH_BOTTOM. Base NESTED_FUNC_ATTR value solely on the compile time architecture. --- aclocal.m4 | 54 ------------------------------------------------------ configure.ac | 7 ++++++- 2 files changed, 6 insertions(+), 55 deletions(-) diff --git a/aclocal.m4 b/aclocal.m4 index 779df3d..38a9a4a 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -301,60 +301,6 @@ else fi ]) -dnl Check if the C compiler has a bug while using nested functions when -dnl mregparm is used on the i386. Some gcc versions do not pass the third -dnl parameter correctly to the nested function. -dnl Written by Marco Gerards. -AC_DEFUN(grub_I386_CHECK_REGPARM_BUG, -[AC_REQUIRE([AC_PROG_CC]) -AC_MSG_CHECKING([if GCC has the regparm=3 bug]) -AC_CACHE_VAL(grub_cv_i386_check_nested_functions, -[AC_RUN_IFELSE([AC_LANG_SOURCE( -[[ -static int -test (int *n) -{ - return *n == -1; -} - -static int -testfunc (int __attribute__ ((__regparm__ (3))) (*hook) (int a, int b, int *c)) -{ - int a = 0; - int b = 0; - int c = -1; - return hook (a, b, &c); -} - -int -main (void) -{ - int __attribute__ ((__regparm__ (3))) nestedfunc (int a, int b, int *c) - { - return a == b && test (c); - } - return testfunc (nestedfunc) ? 0 : 1; -} -]])], - [grub_cv_i386_check_nested_functions=no], - [grub_cv_i386_check_nested_functions=yes], - [grub_cv_i386_check_nested_functions=yes])]) - -AC_MSG_RESULT([$grub_cv_i386_check_nested_functions]) - -if test "x$grub_cv_i386_check_nested_functions" = xyes; then - AC_DEFINE([NESTED_FUNC_ATTR], - [__attribute__ ((__regparm__ (1)))], - [Catch gcc bug]) -else -dnl Unfortunately, the above test does not detect a bug in gcc-4.0. -dnl So use regparm 2 until a better test is found. - AC_DEFINE([NESTED_FUNC_ATTR], - [__attribute__ ((__regparm__ (1)))], - [Catch gcc bug]) -fi -]) - dnl Check if the C compiler generates calls to `__enable_execute_stack()'. AC_DEFUN(grub_CHECK_ENABLE_EXECUTE_STACK,[ AC_MSG_CHECKING([whether `$CC' generates calls to `__enable_execute_stack()']) diff --git a/configure.ac b/configure.ac index d84e2b6..0ba197e 100644 --- a/configure.ac +++ b/configure.ac @@ -391,11 +391,16 @@ if test "x$target_cpu" = xi386; then grub_I386_ASM_PREFIX_REQUIREMENT grub_I386_ASM_ADDR32 grub_I386_ASM_ABSOLUTE_WITHOUT_ASTERISK - grub_I386_CHECK_REGPARM_BUG else AC_DEFINE([NESTED_FUNC_ATTR], [], [Catch gcc bug]) fi +AH_BOTTOM([#ifdef __i386__ +#define NESTED_FUNC_ATTR __attribute__ ((__regparm__ (1))) +#else +#define NESTED_FUNC_ATTR +#endif]) + # Restore the flags. CC="$tmp_CC" CFLAGS="$tmp_CFLAGS"