Tue Jan 5 11:08:00 2021 UTC ()
Use the compat machinery to build "native" IPF binaries as ipfilter
doesn't use compat32 64-bit alignment/size safe structures.

Fixes IPF on at least mips64.


(simonb)
diff -r1.4 -r1.5 src/compat/exec.mk
diff -r1.5 -r1.6 src/external/bsd/ipf/Makefile.inc

cvs diff -r1.4 -r1.5 src/compat/exec.mk (expand / switch to unified diff)

--- src/compat/exec.mk 2018/09/20 02:51:21 1.4
+++ src/compat/exec.mk 2021/01/05 11:08:00 1.5
@@ -1,38 +1,41 @@ @@ -1,38 +1,41 @@
1# $NetBSD: exec.mk,v 1.4 2018/09/20 02:51:21 macallan Exp $ 1# $NetBSD: exec.mk,v 1.5 2021/01/05 11:08:00 simonb Exp $
2 2
3# this makefile fragment can be included to modify the default 3# this makefile fragment can be included to modify the default
4# ABI a program is compiled with. this is designed to be used 4# ABI a program is compiled with. this is designed to be used
5# by tools that must match the kernel image like savecore(8) 5# by tools that must match the kernel image like savecore(8)
6# and kvm(3) using tools. 6# and kvm(3) using tools.
7 7
8# currently this file is used by these Makefiles: 8# currently this file is used by these Makefiles:
9# 9#
 10# external/bsd/ipf/Makefile.inc
10# sbin/savecore/Makefile 11# sbin/savecore/Makefile
11# usr.bin/fstat/Makefile 12# usr.bin/fstat/Makefile
12# usr.bin/netstat/Makefile 13# usr.bin/netstat/Makefile
13# usr.bin/pmap/Makefile 14# usr.bin/pmap/Makefile
14# usr.bin/systat/Makefile 15# usr.bin/systat/Makefile
15# usr.bin/vmstat/Makefile 16# usr.bin/vmstat/Makefile
16# usr.sbin/crash/Makefile 17# usr.sbin/crash/Makefile
17# usr.sbin/kgmon/Makefile 18# usr.sbin/kgmon/Makefile
18# usr.sbin/pstat/Makefile 19# usr.sbin/pstat/Makefile
19# usr.sbin/trpt/Makefile 20# usr.sbin/trpt/Makefile
20# 21#
21# of these, savecore, crash and kgmon are the only ones that 22# of these, savecore, crash and kgmon are the only ones that
22# can be considered "not a bug". all the *stat tools should 23# can be considered "not a bug". all the *stat tools should
23# be converted to use sysctl(3) on the running kernel, and 24# be converted to use sysctl(3) on the running kernel, and
24# anyone who needs kvm-access on crash dumps can build their 25# anyone who needs kvm-access on crash dumps can build their
25# own 64 bit version as necessary. 26# own 64 bit version as necessary. ipfilter doesn't use
 27# 64-bit alignment/size safe structures.
 28#
26 29
27# mips64 defaults to 32 bit userland, but with a 64 bit kernel 30# mips64 defaults to 32 bit userland, but with a 64 bit kernel
28# most kvm-using tools are happier with 64 bit. 31# most kvm-using tools are happier with 64 bit.
29 32
30.if ${MACHINE_ARCH} == "mips64el" || (${MACHINE_ARCH} == "mips64eb" && ${MACHINE} != "sgimips") 33.if ${MACHINE_ARCH} == "mips64el" || (${MACHINE_ARCH} == "mips64eb" && ${MACHINE} != "sgimips")
31 34
32# XXX -pie makes n64 crash 35# XXX -pie makes n64 crash
33NOPIE=1 36NOPIE=1
34# XXX interesting dynamic binaries crash (hello.c works.) 37# XXX interesting dynamic binaries crash (hello.c works.)
35LDSTATIC=-static 38LDSTATIC=-static
36 39
37. include <bsd.own.mk> 40. include <bsd.own.mk>
38 41

cvs diff -r1.5 -r1.6 src/external/bsd/ipf/Makefile.inc (expand / switch to unified diff)

--- src/external/bsd/ipf/Makefile.inc 2020/09/06 07:20:26 1.5
+++ src/external/bsd/ipf/Makefile.inc 2021/01/05 11:07:59 1.6
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1# $NetBSD: Makefile.inc,v 1.5 2020/09/06 07:20:26 mrg Exp $ 1# $NetBSD: Makefile.inc,v 1.6 2021/01/05 11:07:59 simonb Exp $
2 2
3WARNS?= 1 # XXX -Wcast-qual -Wshadow 3WARNS?= 1 # XXX -Wcast-qual -Wshadow
4CWARNFLAGS.clang+= -Wno-format -Wno-tautological-compare \ 4CWARNFLAGS.clang+= -Wno-format -Wno-tautological-compare \
5 -Wno-self-assign -Wno-array-bounds \ 5 -Wno-self-assign -Wno-array-bounds \
6 -Wno-error=unused-const-variable \ 6 -Wno-error=unused-const-variable \
7 -Wno-error=address-of-packed-member 7 -Wno-error=address-of-packed-member
8CWARNFLAGS.gcc+= ${GCC_NO_ADDR_OF_PACKED_MEMBER} 8CWARNFLAGS.gcc+= ${GCC_NO_ADDR_OF_PACKED_MEMBER}
9 9
10.include <bsd.own.mk> 10.include <bsd.own.mk>
11 11
12USE_FORT?= yes # network client/server 12USE_FORT?= yes # network client/server
13 13
14UDIST=${NETBSDSRCDIR}/external/bsd/ipf/dist 14UDIST=${NETBSDSRCDIR}/external/bsd/ipf/dist
@@ -29,13 +29,15 @@ CPPFLAGS+= -DINET6 @@ -29,13 +29,15 @@ CPPFLAGS+= -DINET6
29 29
30IPFOBJDIR!= cd ${UDIST}/../lib && ${PRINTOBJDIR} 30IPFOBJDIR!= cd ${UDIST}/../lib && ${PRINTOBJDIR}
31DPADD+= ${IPFOBJDIR}/libipf.a ${LIBKVM} 31DPADD+= ${IPFOBJDIR}/libipf.a ${LIBKVM}
32LDADD+= -L${IPFOBJDIR} -lipf -lkvm 32LDADD+= -L${IPFOBJDIR} -lipf -lkvm
33 33
34CLEANFILES+= y.tab.c y.tab.h 34CLEANFILES+= y.tab.c y.tab.h
35 35
36COPTS+= ${GCC_NO_STRINGOP_TRUNCATION} 36COPTS+= ${GCC_NO_STRINGOP_TRUNCATION}
37 37
38.PATH: ${UDIST} \ 38.PATH: ${UDIST} \
39 ${UDIST}/lib \ 39 ${UDIST}/lib \
40 ${UDIST}/tools \ 40 ${UDIST}/tools \
41 ${UDIST}/man 41 ${UDIST}/man
 42
 43.include "../../compat/exec.mk"