24.08.2015 11:12, Andrei Borzenkov пишет:
24.08.2015 10:57, Mark H Weaver пишет:
Andrei Borzenkov <arvidj...@gmail.com> writes:
Could you paste "clang -v" output for both cases? I believe I
understand what's going on.
Okay, I've included it below. It might be relevant to mention that the
MIPS port of GNU Guix is not a 'multilib' system: it includes support
only for the N32 ABI. However, our gcc is still capable of generating
freestanding code for the O32 ABI, as demonstrated by the fact that I've
been successfully building and using GRUB on it.
Thanks,
Mark
--8<---------------cut here---------------start------------->8---
mhw@librenote:~$ clang -v -mabi=32 mips.S
clang version 3.6.0 (tags/RELEASE_360/final)
Target: mips64el-unknown-linux-gnu
Yes, as expected. clang treats mips and mips64 as two different targets
so o32 is invalid for mips64.
Could you test attached patch for both gcc and clang? Use
configure TARGET_CC=clang
Sorry, was broken, fixed version attached.
From: Andrei Borzenkov <arvidj...@gmail.com>
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 -mabi=32".
Reported-By: Mark H Weaver <m...@netris.org>
Also-By: Mark H Weaver <m...@netris.org>
---
configure.ac | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/configure.ac b/configure.ac
index c864311..2e73b3f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -597,6 +597,35 @@ 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 mips -mabi=32" ; do
+ if test x"$grub_cv_target_cc_mips_o32_abi" != xno ; then
+ break
+ fi
+ CFLAGS="$TARGET_CFLAGS $arg -Werror"
+ AC_LINK_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
+ ])
+
+ 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
--
tg: (ba218c1..) u/mips-o32 (depends on: master)
_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel