summaryrefslogtreecommitdiffstats
path: root/patches/libseccomp-2.5.0/0002-build-undefine-mips-to-prevent-build-problems-for-MI.patch
blob: 971afb1fb2a5aa1dbd9ae8139790bf66ea5d2764 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
From: Paul Moore <paul@paul-moore.com>
Date: Sun, 2 Aug 2020 09:57:39 -0400
Subject: [PATCH] build: undefine "mips" to prevent build problems for MIPS
 targets

It turns out that the MIPS GCC compiler defines a "mips" cpp macro
which was resulting in build failures on MIPS so we need to
undefine the "mips" macro during build.  As this should be safe
to do in all architectures, just add it to the compiler flags by
default.

This was reported in the following GH issue:
* https://github.com/seccomp/libseccomp/issues/274

Reported-by: Rongwei Zhang <pudh4418@gmail.com>
Suggested-by: Rongwei Zhang <pudh4418@gmail.com>
Acked-by: Tom Hromatka <tom.hromatka@oracle.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
---
 configure.ac    | 4 +++-
 src/Makefile.am | 2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index d47c25cabd38..7b91c7af7be3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -65,9 +65,11 @@ m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
 
 dnl ####
 dnl build flags
+dnl NOTE: the '-Umips' is here because MIPS GCC compilers "helpfully" define it
+dnl       for us which wreaks havoc on the build
 dnl ####
 AM_CPPFLAGS="-I\${top_srcdir}/include -I\${top_builddir}/include"
-AM_CFLAGS="-Wall"
+AM_CFLAGS="-Wall -Umips"
 AM_LDFLAGS="-Wl,-z -Wl,relro"
 AC_SUBST([AM_CPPFLAGS])
 AC_SUBST([AM_CFLAGS])
diff --git a/src/Makefile.am b/src/Makefile.am
index 8d8b97ff936e..10154e14fcda 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -61,7 +61,7 @@ lib_LTLIBRARIES = libseccomp.la
 arch_syscall_dump_SOURCES = arch-syscall-dump.c ${SOURCES_ALL}
 
 arch_syscall_check_SOURCES = arch-syscall-check.c ${SOURCES_ALL}
-arch_syscall_check_CFLAGS = ${CODE_COVERAGE_CFLAGS}
+arch_syscall_check_CFLAGS = ${AM_CFLAGS} ${CODE_COVERAGE_CFLAGS}
 arch_syscall_check_LDFLAGS = ${CODE_COVERAGE_LDFLAGS}
 
 libseccomp_la_SOURCES = ${SOURCES_ALL}