From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1ZayGG-0000qD-GO for mharc-grub-devel@gnu.org; Sat, 12 Sep 2015 23:47:28 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56019) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZayGE-0000pU-Ht for grub-devel@gnu.org; Sat, 12 Sep 2015 23:47:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZayG9-0000Ef-EJ for grub-devel@gnu.org; Sat, 12 Sep 2015 23:47:26 -0400 Received: from world.peace.net ([50.252.239.5]:56324) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZayG9-0000EU-90 for grub-devel@gnu.org; Sat, 12 Sep 2015 23:47:21 -0400 Received: from c-98-217-13-77.hsd1.ma.comcast.net ([98.217.13.77] helo=yeeloong) by world.peace.net with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1ZayFz-00062U-Q3; Sat, 12 Sep 2015 23:47:12 -0400 From: Mark H Weaver To: Andrei Borzenkov Subject: Re: [PATCH] Ensure that MIPS target code is compiled for the O32 ABI. References: <1440009323-8667-1-git-send-email-mhw@netris.org> <55D6A36D.205@gmail.com> <876147ryhy.fsf@netris.org> <55DAC58C.1030105@gmail.com> <87si79nmp3.fsf@netris.org> <55DAD1F9.7080302@gmail.com> <55DAE394.6030306@gmail.com> <87mvxfp6y8.fsf@netris.org> <55F2EDF4.4040207@gmail.com> <87a8srjb1h.fsf@netris.org> Date: Sat, 12 Sep 2015 23:46:02 -0400 In-Reply-To: <87a8srjb1h.fsf@netris.org> (Mark H. Weaver's message of "Sat, 12 Sep 2015 22:41:30 -0400") Message-ID: <87613fj81x.fsf@netris.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 50.252.239.5 Cc: The development of GNU GRUB X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Sep 2015 03:47:27 -0000 --=-=-= Content-Type: text/plain Hi Andrei, Here's a patch on top of yours that omits the link step from the new autoconf test. This eliminates the warnings I encountered before: --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=omit-link-step.patch Content-Description: [PATCH] Omit the link step in the MIPS O32 check diff --git a/configure.ac b/configure.ac index f3c9b90..cd9fa8d 100644 --- a/configure.ac +++ b/configure.ac @@ -605,14 +605,10 @@ if test "x$target_cpu" = xmips || test "x$target_cpu" = xmipsel ; then break fi CFLAGS="$TARGET_CFLAGS $arg -Werror" - AC_LINK_IFELSE([AC_LANG_PROGRAM([[ + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #if !defined(_ABIO32) || !defined(_MIPS_SIM) || (_MIPS_SIM != _ABIO32) #error not o32 ABI #endif -asm (".globl start; start:"); -void __main (void); -void __main (void) {} -int main (void); ]], [[]])], [grub_cv_target_cc_mips_o32_abi="$arg"], []) done --=-=-= Content-Type: text/plain Here's an updated version of your commit, incorporating the above patch: --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-configure-try-to-force-o32-ABI-on-MIPS.patch Content-Description: [PATCH] configure: try to force o32 ABI on MIPS >From 8adcca69d3d9aacd20010a450aa20083a834392b Mon Sep 17 00:00:00 2001 From: Andrei Borzenkov Date: Fri, 11 Sep 2015 11:28:49 -0400 Subject: [PATCH] configure: try to force o32 ABI on MIPS GRUB expects o32 ABI, in particular used assembly is valid only in this mode. Some systems (e.g. GNU Guix) default to using newer n64 or n32 ABI. Try to find suitable options to force o32. For GCC this is simply -mabi=32. While clang supports this option as well, o32 ABI is valid for MIPS target and n32/64 ABI are valid for MIPS64 target only, so use "-target mips/mipsel -mabi=32". Reported-By: Mark H Weaver Also-By: Mark H Weaver --- configure.ac | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/configure.ac b/configure.ac index c864311..cd9fa8d 100644 --- a/configure.ac +++ b/configure.ac @@ -597,6 +597,31 @@ int main (void); TARGET_LDFLAGS="$TARGET_LDFLAGS $grub_cv_target_cc_big_endian" fi +if test "x$target_cpu" = xmips || test "x$target_cpu" = xmipsel ; then + AC_CACHE_CHECK([for options to force MIPS o32 ABI], grub_cv_target_cc_mips_o32_abi, [ + grub_cv_target_cc_mips_o32_abi=no + for arg in "" "-mabi=32" "-target $target_cpu -mabi=32" ; do + if test x"$grub_cv_target_cc_mips_o32_abi" != xno ; then + break + fi + CFLAGS="$TARGET_CFLAGS $arg -Werror" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ +#if !defined(_ABIO32) || !defined(_MIPS_SIM) || (_MIPS_SIM != _ABIO32) +#error not o32 ABI +#endif +]], [[]])], + [grub_cv_target_cc_mips_o32_abi="$arg"], []) + done + ]) + + if test x"$grub_cv_target_cc_mips_o32_abi" = xno ; then + AC_MSG_ERROR([could not force MIPS o32 ABI]) + fi + + TARGET_CFLAGS="$TARGET_CFLAGS $grub_cv_target_cc_mips_o32_abi" + TARGET_CCASFLAGS="$TARGET_CCASFLAGS $grub_cv_target_cc_mips_o32_abi" +fi + AC_CACHE_CHECK([for options to compile assembly], [grub_cv_cc_target_asm_compile], [ test_program= case "x$target_cpu-$platform" in -- 2.5.0 --=-=-= Content-Type: text/plain I tested this on MIPS with GCC 5.2.0 and clang 3.6.0. It works the same as before, but the warnings are gone. What do you think? Mark --=-=-=--