xref: /OK3568_Linux_fs/buildroot/package/libffi/0002-Fix-use-of-compact-eh-frames-on-MIPS.patch (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1From 31b6b6bc14197cd4183bdbd311fddeb36b5ae100 Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?J=C3=B6rg=20Krause?= <joerg.krause@embedded.rocks>
3Date: Sat, 19 Sep 2015 22:53:29 +0200
4Subject: [PATCH] Fix use of compact eh frames on MIPS
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9Newer MIPS toolchains use a different (compact) eh_frame format.
10libffi don't like them, so we have to switch to the older format.
11
12This patch add -mno-compact-eh to CFLAGS when compiling for
13Mips and compiler support it.
14
15Signed-off-by: Jérôme Pouiller <jezz@sysmic.org>
16[unfuzz for 3.2.1]
17Signed-off-by: Jörg Krause <joerg.krause@embedded.rocks>
18---
19 configure.ac | 10 ++++++++++
20 1 file changed, 10 insertions(+)
21
22diff --git a/configure.ac b/configure.ac
23index a7bf5ee..36cd0d4 100644
24--- a/configure.ac
25+++ b/configure.ac
26@@ -469,6 +469,16 @@ esac
27 AM_CONDITIONAL(FFI_EXEC_TRAMPOLINE_TABLE, test x$FFI_EXEC_TRAMPOLINE_TABLE = x1)
28 AC_SUBST(FFI_EXEC_TRAMPOLINE_TABLE)
29
30+if test x$TARGET = xMIPS; then
31+    save_CFLAGS="$CFLAGS"
32+    CFLAGS=-mno-compact-eh
33+    AC_MSG_CHECKING([whether the C compiler needs -mno-compact-eh])
34+    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
35+                      [AC_MSG_RESULT([yes])]; [save_CFLAGS="$save_CFLAGS -mno-compact-eh"],
36+                      [AC_MSG_RESULT([no])])
37+    CFLAGS="$save_CFLAGS"
38+fi
39+
40 if test x$TARGET = xX86_64; then
41     AC_CACHE_CHECK([toolchain supports unwind section type],
42 	libffi_cv_as_x86_64_unwind_section_type, [
43--
442.5.3
45
46