app-misc/pax-utils-1.3.1 fails to build on MIPS: In file included from security.c:9: seccomp-bpf.h:73:28: error: redefinition of 'seccomp_bpf_blks_base' 73 | static const unsigned char seccomp_bpf_blks_base[] = { | ^~~~~~~~~~~~~~~~~~~~~ In file included from security.c:9: seccomp-bpf.h:62:28: note: previous definition of 'seccomp_bpf_blks_base' with type 'const unsigned char[464]' 62 | static const unsigned char seccomp_bpf_blks_base[] = { | ^~~~~~~~~~~~~~~~~~~~~ In file included from security.c:9: seccomp-bpf.h:76:28: error: redefinition of 'seccomp_bpf_blks_fork' 76 | static const unsigned char seccomp_bpf_blks_fork[] = { | ^~~~~~~~~~~~~~~~~~~~~ In file included from security.c:9: seccomp-bpf.h:65:28: note: previous definition of 'seccomp_bpf_blks_fork' with type 'const unsigned char[536]' 65 | static const unsigned char seccomp_bpf_blks_fork[] = { | ^~~~~~~~~~~~~~~~~~~~~ In file included from security.c:9: seccomp-bpf.h:84:28: error: redefinition of 'seccomp_bpf_blks_base' 84 | static const unsigned char seccomp_bpf_blks_base[] = { | ^~~~~~~~~~~~~~~~~~~~~ In file included from security.c:9: seccomp-bpf.h:73:28: note: previous definition of 'seccomp_bpf_blks_base' with type 'const unsigned char[424]' 73 | static const unsigned char seccomp_bpf_blks_base[] = { | ^~~~~~~~~~~~~~~~~~~~~ In file included from security.c:9: seccomp-bpf.h:87:28: error: redefinition of 'seccomp_bpf_blks_fork' 87 | static const unsigned char seccomp_bpf_blks_fork[] = { | ^~~~~~~~~~~~~~~~~~~~~ In file included from security.c:9: seccomp-bpf.h:76:28: note: previous definition of 'seccomp_bpf_blks_fork' with type 'const unsigned char[488]' 76 | static const unsigned char seccomp_bpf_blks_fork[] = { | ^~~~~~~~~~~~~~~~~~~~~ the "_ABI{O32,64,N32}" are always define, better to test whether "_MIPS_SIM == _ABIO32". See the attached patch, which fixes the build on my o32 environment. Reproducible: Always
Created attachment 714894 [details, diff] MIPS build fix
(In reply to Manuel Lauss from comment #0) > the "_ABI{O32,64,N32}" are always define, better to test whether "_MIPS_SIM > == _ABIO32". See the attached patch, which fixes the build on my o32 > environment. I agree the cleanup is reasonable. But is it a real issue? $ mips-unknown-linux-gnu-gcc -dM -E - </dev/null | fgrep ABI #define _ABIO32 1 #define _MIPS_SIM _ABIO32 $ mips-unknown-linux-gnu-gcc -dM -E - </dev/null -mabi=n32 | fgrep ABI #define _MIPS_SIM _ABIN32 #define _ABIN32 2 $ mips-unknown-linux-gnu-gcc -dM -E - </dev/null -mabi=64 | fgrep ABI #define _ABI64 3 #define _MIPS_SIM _ABI64 I don't see non-active ABI definition. Do you know where it comes from for you? Can you attach the build.log and `emerge --info`?
(In reply to Sergei Trofimovich from comment #2) > (In reply to Manuel Lauss from comment #0) > > the "_ABI{O32,64,N32}" are always define, better to test whether "_MIPS_SIM > > == _ABIO32". See the attached patch, which fixes the build on my o32 > > environment. > > I agree the cleanup is reasonable. But is it a real issue? > > $ mips-unknown-linux-gnu-gcc -dM -E - </dev/null | fgrep ABI > #define _ABIO32 1 > #define _MIPS_SIM _ABIO32 > > $ mips-unknown-linux-gnu-gcc -dM -E - </dev/null -mabi=n32 | fgrep ABI > #define _MIPS_SIM _ABIN32 > #define _ABIN32 2 > > $ mips-unknown-linux-gnu-gcc -dM -E - </dev/null -mabi=64 | fgrep ABI > #define _ABI64 3 > #define _MIPS_SIM _ABI64 > > I don't see non-active ABI definition. Do you know where it comes from for > you? > > Can you attach the build.log and `emerge --info`? Run gcc with "-dM" appended to the invocation of the compilation of "security.c", then you'll see that all _ABIXX are defined at the same time, with the values you saw above. It's not an issue when you invoke gcc as above, I agree. The build failure lists seccomp_bpf_blks_base twice, which means it's defined 3 times.
Oh, I see /usr/include/sgidefs.h overrides predefined ABIs: https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/mips/sgidefs.h;h=839504ca8c7bac7d25fd2723d5b29694d975db0d;hb=HEAD#l53 53 /* 54 * Subprogram calling convention 55 */ 56 #ifndef _ABIO32 57 # define _ABIO32 1 58 #endif 59 #define _MIPS_SIM_ABI32 _ABIO32 60 61 #ifndef _ABIN32 62 # define _ABIN32 2 63 #endif 64 #define _MIPS_SIM_NABI32 _ABIN32 65 66 #ifndef _ABI64 67 # define _ABI64 3 68 #endif 69 #define _MIPS_SIM_ABI64 _ABI64 70 71 #ifndef _ABIO64 72 # define _ABIO64 4 73 #endif
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/proj/pax-utils.git/commit/?id=6012cc3584cfa18c6e37c2a1a56af08b04a9a5f6 commit 6012cc3584cfa18c6e37c2a1a56af08b04a9a5f6 Author: Sergei Trofimovich <slyfox@gentoo.org> AuthorDate: 2021-06-10 06:58:54 +0000 Commit: Sergei Trofimovich <slyfox@gentoo.org> CommitDate: 2021-06-10 06:58:54 +0000 seccomp: fix build failure on mips (use _MIP_SIM tests) glibc's sysdeps/mips/sgidefs.h unconditionally mips _ABI* enum values: #define _ABIO32 1 #define _ABIN32 2 #define _ABI64 3 #define _ABIO64 4 This causes build failures on multiple definitions: In file included from security.c:9: seccomp-bpf.h:73:28: error: redefinition of 'seccomp_bpf_blks_base' 73 | static const unsigned char seccomp_bpf_blks_base[] = { | ^~~~~~~~~~~~~~~~~~~~~ The fix is to test current ABI against _MIPS_SIM. Fixed-by: Manuel Lauss Bug: https://bugs.gentoo.org/795075 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org> seccomp-bpf.c | 16 +++++++++------- seccomp-bpf.h | 16 +++++++++------- 2 files changed, 18 insertions(+), 14 deletions(-)
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b390c1cbeb6ea6ea68b361342f872e5ab275ba8c commit b390c1cbeb6ea6ea68b361342f872e5ab275ba8c Author: Sergei Trofimovich <slyfox@gentoo.org> AuthorDate: 2021-06-10 07:21:17 +0000 Commit: Sergei Trofimovich <slyfox@gentoo.org> CommitDate: 2021-06-10 07:21:33 +0000 app-misc/pax-utils: bump up to 1.3.2 Two new changes: - lddtree: respect (destination) root with --argv0 interp probing - seccomp: fix build failure on mips (use _MIP_SIM tests) Fixed-by: Manuel Lauss Closes: https://bugs.gentoo.org/795075 Package-Manager: Portage-3.0.19, Repoman-3.0.3 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org> app-misc/pax-utils/Manifest | 1 + app-misc/pax-utils/pax-utils-1.3.2.ebuild | 75 +++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+)