Andrew Geissler | b2fe863 | 2020-08-21 15:57:21 -0500 | [diff] [blame] | 1 | Backport patch to fix cross compile error for mips: |
| 2 | |
| 3 | | syscalls.h:44:6: error: expected identifier or '(' before numeric constant |
| 4 | | 44 | int mips; |
| 5 | | | ^~~~ |
| 6 | |
| 7 | Upstream-Status: Submitted [https://github.com/seccomp/libseccomp/pull/279/commits/04c519e5] |
| 8 | |
| 9 | Signed-off-by: Kai Kang <kai.kang@windriver.com> |
| 10 | |
| 11 | From 04c519e5b1de53592e98307813e5c6db7418f91b Mon Sep 17 00:00:00 2001 |
| 12 | From: Paul Moore <paul@paul-moore.com> |
| 13 | Date: Sun, 2 Aug 2020 09:57:39 -0400 |
| 14 | Subject: [PATCH] build: undefine "mips" to prevent build problems for MIPS |
| 15 | targets |
| 16 | |
| 17 | It turns out that the MIPS GCC compiler defines a "mips" cpp macro |
| 18 | which was resulting in build failures on MIPS so we need to |
| 19 | undefine the "mips" macro during build. As this should be safe |
| 20 | to do in all architectures, just add it to the compiler flags by |
| 21 | default. |
| 22 | |
| 23 | This was reported in the following GH issue: |
| 24 | * https://github.com/seccomp/libseccomp/issues/274 |
| 25 | |
| 26 | Reported-by: Rongwei Zhang <pudh4418@gmail.com> |
| 27 | Suggested-by: Rongwei Zhang <pudh4418@gmail.com> |
| 28 | Signed-off-by: Paul Moore <paul@paul-moore.com> |
| 29 | --- |
| 30 | configure.ac | 4 +++- |
| 31 | 1 file changed, 3 insertions(+), 1 deletion(-) |
| 32 | |
| 33 | diff --git a/configure.ac b/configure.ac |
| 34 | index 40d9dcbb..3e877348 100644 |
| 35 | --- a/configure.ac |
| 36 | +++ b/configure.ac |
| 37 | @@ -65,9 +65,11 @@ m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) |
| 38 | |
| 39 | dnl #### |
| 40 | dnl build flags |
| 41 | +dnl NOTE: the '-Umips' is here because MIPS GCC compilers "helpfully" define it |
| 42 | +dnl for us which wreaks havoc on the build |
| 43 | dnl #### |
| 44 | AM_CPPFLAGS="-I\${top_srcdir}/include -I\${top_builddir}/include" |
| 45 | -AM_CFLAGS="-Wall" |
| 46 | +AM_CFLAGS="-Wall -Umips" |
| 47 | AM_LDFLAGS="-Wl,-z -Wl,relro" |
| 48 | AC_SUBST([AM_CPPFLAGS]) |
| 49 | AC_SUBST([AM_CFLAGS]) |