Gentoo Archives: gentoo-commits

From: Sergei Trofimovich <slyfox@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/pax-utils:master commit in: /
Date: Thu, 10 Jun 2021 07:02:59
Message-Id: 1623308334.6012cc3584cfa18c6e37c2a1a56af08b04a9a5f6.slyfox@gentoo
1 commit: 6012cc3584cfa18c6e37c2a1a56af08b04a9a5f6
2 Author: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
3 AuthorDate: Thu Jun 10 06:58:54 2021 +0000
4 Commit: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
5 CommitDate: Thu Jun 10 06:58:54 2021 +0000
6 URL: https://gitweb.gentoo.org/proj/pax-utils.git/commit/?id=6012cc35
7
8 seccomp: fix build failure on mips (use _MIP_SIM tests)
9
10 glibc's sysdeps/mips/sgidefs.h unconditionally mips _ABI* enum values:
11 #define _ABIO32 1
12 #define _ABIN32 2
13 #define _ABI64 3
14 #define _ABIO64 4
15
16 This causes build failures on multiple definitions:
17 In file included from security.c:9:
18 seccomp-bpf.h:73:28: error: redefinition of 'seccomp_bpf_blks_base'
19 73 | static const unsigned char seccomp_bpf_blks_base[] = {
20 | ^~~~~~~~~~~~~~~~~~~~~
21
22 The fix is to test current ABI against _MIPS_SIM.
23
24 Fixed-by: Manuel Lauss
25 Bug: https://bugs.gentoo.org/795075
26 Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>
27
28 seccomp-bpf.c | 16 +++++++++-------
29 seccomp-bpf.h | 16 +++++++++-------
30 2 files changed, 18 insertions(+), 14 deletions(-)
31
32 diff --git a/seccomp-bpf.c b/seccomp-bpf.c
33 index f69e5ce..8e61f7f 100644
34 --- a/seccomp-bpf.c
35 +++ b/seccomp-bpf.c
36 @@ -28,12 +28,12 @@ static const struct {
37 #define A(arch, ifdef) { #arch, SCMP_ARCH_##arch, ifdef }
38 A(AARCH64, "defined(__aarch64__)"),
39 A(ARM, "defined(__arm__)"),
40 - A(MIPS, "defined(__mips__) && defined(__MIPSEB__) && defined(_ABIO32)"),
41 - A(MIPS64, "defined(__mips__) && defined(__MIPSEB__) && defined(_ABI64)"),
42 - A(MIPS64N32, "defined(__mips__) && defined(__MIPSEB__) && defined(_ABIN32)"),
43 - A(MIPSEL, "defined(__mips__) && defined(__MIPSEL__) && defined(_ABIO32)"),
44 - A(MIPSEL64, "defined(__mips__) && defined(__MIPSEL__) && defined(_ABI64)"),
45 - A(MIPSEL64N32, "defined(__mips__) && defined(__MIPSEL__) && defined(_ABIN32)"),
46 + A(MIPS, "defined(__mips__) && defined(__MIPSEB__) && (_MIPS_SIM == _ABIO32)"),
47 + A(MIPS64, "defined(__mips__) && defined(__MIPSEB__) && (_MIPS_SIM == _ABI64)"),
48 + A(MIPS64N32, "defined(__mips__) && defined(__MIPSEB__) && (_MIPS_SIM == _ABIN32)"),
49 + A(MIPSEL, "defined(__mips__) && defined(__MIPSEL__) && (_MIPS_SIM == _ABIO32)"),
50 + A(MIPSEL64, "defined(__mips__) && defined(__MIPSEL__) && (_MIPS_SIM == _ABI64)"),
51 + A(MIPSEL64N32, "defined(__mips__) && defined(__MIPSEL__) && (_MIPS_SIM == _ABIN32)"),
52 A(PARISC, "defined(__hppa__) && !defined(__hppa64__)"),
53 A(PARISC64, "defined(__hppa__) && defined(__hppa64__)"),
54 A(PPC, "defined(__powerpc__) && !defined(__powerpc64__) && defined(__BIG_ENDIAN__)"),
55 @@ -210,7 +210,9 @@ int main(void)
56 if (!ctx)
57 err(1, "seccomp_init failed");
58
59 - printf("/* AUTO GENERATED; see seccomp-bpf.c for details. */\n");
60 + printf("/* AUTO GENERATED FILE. To regenerate run:\n");
61 + printf("/* $ make seccomp-bpf.h\n");
62 + printf("/* See seccomp-bpf.c for details. */\n");
63 printf("#undef SECCOMP_BPF_AVAILABLE\n");
64
65 if (seccomp_arch_remove(ctx, seccomp_arch_native()) < 0)
66
67 diff --git a/seccomp-bpf.h b/seccomp-bpf.h
68 index 5966bd5..95f5bfb 100644
69 --- a/seccomp-bpf.h
70 +++ b/seccomp-bpf.h
71 @@ -1,4 +1,6 @@
72 -/* AUTO GENERATED; see seccomp-bpf.c for details. */
73 +/* AUTO GENERATED FILE. To regenerate run:
74 +/* $ make seccomp-bpf.h
75 +/* See seccomp-bpf.c for details. */
76 #undef SECCOMP_BPF_AVAILABLE
77
78 #if defined(__aarch64__)
79 @@ -23,7 +25,7 @@ static const unsigned char seccomp_bpf_blks_fork[] = {
80 };
81 #endif
82
83 -#if defined(__mips__) && defined(__MIPSEB__) && defined(_ABIO32)
84 +#if defined(__mips__) && defined(__MIPSEB__) && (_MIPS_SIM == _ABIO32)
85 /* MIPS */
86 #define SECCOMP_BPF_AVAILABLE
87 static const unsigned char seccomp_bpf_blks_base[] = {
88 @@ -34,7 +36,7 @@ static const unsigned char seccomp_bpf_blks_fork[] = {
89 };
90 #endif
91
92 -#if defined(__mips__) && defined(__MIPSEB__) && defined(_ABI64)
93 +#if defined(__mips__) && defined(__MIPSEB__) && (_MIPS_SIM == _ABI64)
94 /* MIPS64 */
95 #define SECCOMP_BPF_AVAILABLE
96 static const unsigned char seccomp_bpf_blks_base[] = {
97 @@ -45,7 +47,7 @@ static const unsigned char seccomp_bpf_blks_fork[] = {
98 };
99 #endif
100
101 -#if defined(__mips__) && defined(__MIPSEB__) && defined(_ABIN32)
102 +#if defined(__mips__) && defined(__MIPSEB__) && (_MIPS_SIM == _ABIN32)
103 /* MIPS64N32 */
104 #define SECCOMP_BPF_AVAILABLE
105 static const unsigned char seccomp_bpf_blks_base[] = {
106 @@ -56,7 +58,7 @@ static const unsigned char seccomp_bpf_blks_fork[] = {
107 };
108 #endif
109
110 -#if defined(__mips__) && defined(__MIPSEL__) && defined(_ABIO32)
111 +#if defined(__mips__) && defined(__MIPSEL__) && (_MIPS_SIM == _ABIO32)
112 /* MIPSEL */
113 #define SECCOMP_BPF_AVAILABLE
114 static const unsigned char seccomp_bpf_blks_base[] = {
115 @@ -67,7 +69,7 @@ static const unsigned char seccomp_bpf_blks_fork[] = {
116 };
117 #endif
118
119 -#if defined(__mips__) && defined(__MIPSEL__) && defined(_ABI64)
120 +#if defined(__mips__) && defined(__MIPSEL__) && (_MIPS_SIM == _ABI64)
121 /* MIPSEL64 */
122 #define SECCOMP_BPF_AVAILABLE
123 static const unsigned char seccomp_bpf_blks_base[] = {
124 @@ -78,7 +80,7 @@ static const unsigned char seccomp_bpf_blks_fork[] = {
125 };
126 #endif
127
128 -#if defined(__mips__) && defined(__MIPSEL__) && defined(_ABIN32)
129 +#if defined(__mips__) && defined(__MIPSEL__) && (_MIPS_SIM == _ABIN32)
130 /* MIPSEL64N32 */
131 #define SECCOMP_BPF_AVAILABLE
132 static const unsigned char seccomp_bpf_blks_base[] = {