From: Mark H Weaver <mhw@netris.org>
To: Andrei Borzenkov <arvidjaar@gmail.com>
Cc: The development of GNU GRUB <grub-devel@gnu.org>
Subject: Re: [PATCH] Ensure that MIPS target code is compiled for the O32 ABI.
Date: Sat, 12 Sep 2015 23:46:02 -0400 [thread overview]
Message-ID: <87613fj81x.fsf@netris.org> (raw)
In-Reply-To: <87a8srjb1h.fsf@netris.org> (Mark H. Weaver's message of "Sat, 12 Sep 2015 22:41:30 -0400")
[-- Attachment #1: Type: text/plain, Size: 149 bytes --]
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:
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: [PATCH] Omit the link step in the MIPS O32 check --]
[-- Type: text/x-patch, Size: 630 bytes --]
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
[-- Attachment #3: Type: text/plain, Size: 75 bytes --]
Here's an updated version of your commit, incorporating the above patch:
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #4: [PATCH] configure: try to force o32 ABI on MIPS --]
[-- Type: text/x-patch, Size: 2024 bytes --]
From 8adcca69d3d9aacd20010a450aa20083a834392b Mon Sep 17 00:00:00 2001
From: Andrei Borzenkov <arvidjaar@gmail.com>
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 <mhw@netris.org>
Also-By: Mark H Weaver <mhw@netris.org>
---
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
[-- Attachment #5: Type: text/plain, Size: 144 bytes --]
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
next prev parent reply other threads:[~2015-09-13 3:47 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-19 18:35 [PATCH] Ensure that MIPS target code is compiled for the O32 ABI Mark H Weaver
2015-08-21 4:05 ` Andrei Borzenkov
2015-08-22 18:04 ` Mark H Weaver
2015-08-23 9:51 ` Andrei Borzenkov
2015-08-23 17:27 ` Mark H Weaver
2015-08-24 6:50 ` [PATCH v2] " Mark H Weaver
2015-09-08 17:11 ` Vladimir 'φ-coder/phcoder' Serbinenko
2015-09-09 1:37 ` Mark H Weaver
2015-09-13 6:32 ` Andrei Borzenkov
2015-10-09 21:14 ` Vladimir 'φ-coder/phcoder' Serbinenko
2015-10-10 0:28 ` Vladimir 'φ-coder/phcoder' Serbinenko
2015-10-14 4:49 ` Andrei Borzenkov
2015-10-14 12:16 ` Vladimir 'phcoder' Serbinenko
2015-10-14 17:57 ` Andrei Borzenkov
2015-08-24 7:19 ` [PATCH] " Andrei Borzenkov
2015-08-24 7:57 ` Mark H Weaver
2015-08-24 8:12 ` Andrei Borzenkov
2015-08-24 9:27 ` Andrei Borzenkov
2015-08-25 18:18 ` Mark H Weaver
2015-09-11 15:06 ` Andrei Borzenkov
2015-09-13 2:41 ` Mark H Weaver
2015-09-13 3:46 ` Mark H Weaver [this message]
2015-09-13 14:10 ` Andrei Borzenkov
2015-09-13 23:37 ` Mark H Weaver
2015-09-20 4:44 ` Andrei Borzenkov
2015-09-21 16:09 ` Mark H Weaver
2015-09-21 17:56 ` Andrei Borzenkov
2015-09-22 15:03 ` Mark H Weaver
2015-09-22 17:26 ` Andrei Borzenkov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87613fj81x.fsf@netris.org \
--to=mhw@netris.org \
--cc=arvidjaar@gmail.com \
--cc=grub-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).