From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1ZTsat-00059e-W2 for mharc-grub-devel@gnu.org; Mon, 24 Aug 2015 10:19:28 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47172) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZTlb1-0005Bi-NR for grub-devel@gnu.org; Mon, 24 Aug 2015 02:51:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZTlay-0002Y9-Ha for grub-devel@gnu.org; Mon, 24 Aug 2015 02:51:07 -0400 Received: from world.peace.net ([50.252.239.5]:53934) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZTlay-0002WL-DN for grub-devel@gnu.org; Mon, 24 Aug 2015 02:51:04 -0400 Received: from [10.1.10.32] (helo=yeeloong) by world.peace.net with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1ZTlag-0001jP-Kx; Mon, 24 Aug 2015 02:50:46 -0400 From: Mark H Weaver To: Andrei Borzenkov Subject: [PATCH v2] 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> <55D99791.4080104@gmail.com> Date: Mon, 24 Aug 2015 02:50:23 -0400 In-Reply-To: <55D99791.4080104@gmail.com> (Andrei Borzenkov's message of "Sun, 23 Aug 2015 12:51:13 +0300") Message-ID: <87a8thuqmo.fsf_-_@netris.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain 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: Mon, 24 Aug 2015 06:51:08 -0000 Include -mabi=32 in CFLAGS_PLATFORM and CCASFLAGS_PLATFORM to compile code for the O32 ABI when targetting MIPS, since the MIPS assembly code in GRUB assumes this. This flag is also needed when compiling asm-tests/mips.S from configure, because GNU as rejects MIPS register names such as $t2 unless the O32 ABI is selected. This is needed when using a compiler that defaults to one of the newer MIPS ABIs such as N32 or N64, e.g. when natively compiling on a system that uses one of these newer MIPS ABIs. --- conf/Makefile.common | 4 ++++ configure.ac | 7 +++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/conf/Makefile.common b/conf/Makefile.common index fcb8d2e..bd125da 100644 --- a/conf/Makefile.common +++ b/conf/Makefile.common @@ -20,6 +20,10 @@ endif if COND_powerpc_ieee1275 CFLAGS_PLATFORM += -mcpu=powerpc endif +if COND_mips + CFLAGS_PLATFORM += -mabi=32 + CCASFLAGS_PLATFORM = -mabi=32 +endif #FIXME: discover and check XEN headers CPPFLAGS_XEN = -I/usr/include diff --git a/configure.ac b/configure.ac index c864311..1f5e8a2 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,8 @@ # Process this file with autoconf to produce a configure script. -# Copyright (C) 2002,2003,2004,2005,2006,2007,2008,2009,2010 Free Software Foundation, Inc. +# Copyright (C) 2002,2003,2004,2005,2006,2007,2008,2009,2010,2011, +# 2012,2013,2014,2015 Free Software Foundation, Inc. # # This configure.ac is free software; the author # gives unlimited permission to copy and/or distribute it, @@ -599,9 +600,11 @@ fi AC_CACHE_CHECK([for options to compile assembly], [grub_cv_cc_target_asm_compile], [ test_program= +test_ccasflags= case "x$target_cpu-$platform" in xmips-* | xmipsel-*) test_program=mips + test_ccasflags=-mabi=32 ;; xi386-pc) test_program=i386-pc @@ -618,7 +621,7 @@ if test x"$test_program" = x ; then else found=no for arg in "" "-no-integrated-as"; do - cmdline="$TARGET_CC -c -o /dev/null $TARGET_CCASFLAGS $arg $TARGET_CPPFLAGS $srcdir/asm-tests/$test_program.S" + cmdline="$TARGET_CC -c -o /dev/null $TARGET_CCASFLAGS $test_ccasflags $arg $TARGET_CPPFLAGS $srcdir/asm-tests/$test_program.S" echo "Running $cmdline" >&AS_MESSAGE_LOG_FD if $cmdline >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then grub_cv_cc_target_asm_compile="$arg" -- 2.5.0