Skip to content

Commit b25b09e

Browse files
heicarstJames Morris
authored andcommitted
samples/seccomp: fix 31 bit build on s390
On s390 the flag to force 31 builds is -m31 instead of -m32 unlike on all (?) other architectures. Fixes this compile error: HOSTCC samples/seccomp/bpf-direct.o cc1: error: unrecognized command line option "-m32" make[2]: *** [samples/seccomp/bpf-direct.o] Error 1 Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Acked-by: Kees Cook <keescook@chromium.org> Signed-off-by: James Morris <james.l.morris@oracle.com>
1 parent 2e4930e commit b25b09e

1 file changed

Lines changed: 16 additions & 8 deletions

File tree

‎samples/seccomp/Makefile‎

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,22 @@ HOSTCFLAGS_bpf-direct.o += -idirafter $(objtree)/include
1818
bpf-direct-objs := bpf-direct.o
1919

2020
# Try to match the kernel target.
21-
ifeq ($(CONFIG_64BIT),)
22-
HOSTCFLAGS_bpf-direct.o += -m32
23-
HOSTCFLAGS_dropper.o += -m32
24-
HOSTCFLAGS_bpf-helper.o += -m32
25-
HOSTCFLAGS_bpf-fancy.o += -m32
26-
HOSTLOADLIBES_bpf-direct += -m32
27-
HOSTLOADLIBES_bpf-fancy += -m32
28-
HOSTLOADLIBES_dropper += -m32
21+
ifndef CONFIG_64BIT
22+
23+
# s390 has -m31 flag to build 31 bit binaries
24+
ifndef CONFIG_S390
25+
MFLAG = -m32
26+
else
27+
MFLAG = -m31
28+
endif
29+
30+
HOSTCFLAGS_bpf-direct.o += $(MFLAG)
31+
HOSTCFLAGS_dropper.o += $(MFLAG)
32+
HOSTCFLAGS_bpf-helper.o += $(MFLAG)
33+
HOSTCFLAGS_bpf-fancy.o += $(MFLAG)
34+
HOSTLOADLIBES_bpf-direct += $(MFLAG)
35+
HOSTLOADLIBES_bpf-fancy += $(MFLAG)
36+
HOSTLOADLIBES_dropper += $(MFLAG)
2937
endif
3038

3139
# Tell kbuild to always build the programs

0 commit comments

Comments
 (0)