summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormrg <mrg@NetBSD.org>2016-12-23 10:19:57 +0000
committermrg <mrg@NetBSD.org>2016-12-23 10:19:57 +0000
commit01a36c7d6d2a14fc530864e315a712cc139b8b43 (patch)
tree06be54f15829edd09e67d9a483b9bba521b05eae
parent03fc4f5fc379a825e5969239ad5c6bcae4d671ee (diff)
for 64 bit mips platforms where we built userland largely as n32 by
default, build a handful of tools as n64 so they work properly. unfortunately, they're also static as dynamic n64 has a problem. of these tools pstat is probably the lowest hanging fruit to convert to sysctl. systat would be close were it not for the netstat screen, which includes netstat itself. the rest are difficult to perhaps foolish. the upside is that netstat, pmap and fstat all work properly now.
-rw-r--r--compat/exec.mk42
-rw-r--r--sbin/savecore/Makefile4
-rw-r--r--usr.bin/fstat/Makefile4
-rw-r--r--usr.bin/netstat/Makefile4
-rw-r--r--usr.bin/pmap/Makefile4
-rw-r--r--usr.bin/systat/Makefile4
-rw-r--r--usr.sbin/crash/Makefile4
-rw-r--r--usr.sbin/kgmon/Makefile4
-rw-r--r--usr.sbin/pstat/Makefile4
-rw-r--r--usr.sbin/trpt/Makefile4
10 files changed, 69 insertions, 9 deletions
diff --git a/compat/exec.mk b/compat/exec.mk
new file mode 100644
index 00000000000..2abcb3c3035
--- /dev/null
+++ b/compat/exec.mk
@@ -0,0 +1,42 @@
+# $NetBSD: exec.mk,v 1.1 2016/12/23 10:19:57 mrg Exp $
+
+# this makefile fragment can be included to modify the default
+# ABI a program is compiled with. this is designed to be used
+# by tools that must match the kernel image like savecore(8)
+# and kvm(3) using tools.
+
+# currently this file is used by these Makefiles:
+#
+# sbin/savecore/Makefile
+# usr.bin/fstat/Makefile
+# usr.bin/netstat/Makefile
+# usr.bin/pmap/Makefile
+# usr.bin/systat/Makefile
+# usr.sbin/crash/Makefile
+# usr.sbin/kgmon/Makefile
+# usr.sbin/pstat/Makefile
+# usr.sbin/trpt/Makefile
+#
+# of these, savecore, crash and kgmon are the only ones that
+# can be considered "not a bug". all the *stat tools should
+# be converted to use sysctl(3) on the running kernel, and
+# anyone who needs kvm-access on crash dumps can build their
+# own 64 bit version as necessary.
+
+# mips64 defaults to 32 bit userland, but with a 64 bit kernel
+# most kvm-using tools are happier with 64 bit.
+
+.if ${MACHINE_ARCH} == "mips64el" || ${MACHINE_ARCH} == "mips64eb"
+
+# XXX -pie makes n64 crash
+NOPIE=1
+# XXX interesting dynamic binaries crash (hello.c works.)
+LDSTATIC=-static
+
+. include <bsd.own.mk>
+
+. if ${MKCOMPAT} != "no" && !defined(RESCUEDIR)
+. include "${.PARSEDIR}/mips64/64/bsd.64.mk"
+. endif # ${MKCOMPAT} != "no"
+
+.endif # mips64
diff --git a/sbin/savecore/Makefile b/sbin/savecore/Makefile
index 673dc27254e..fbbdf973309 100644
--- a/sbin/savecore/Makefile
+++ b/sbin/savecore/Makefile
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.25 2001/06/13 23:16:27 wiz Exp $
+# $NetBSD: Makefile,v 1.26 2016/12/23 10:19:57 mrg Exp $
# @(#)Makefile 8.2 (Berkeley) 4/17/94
PROG= savecore
@@ -9,4 +9,6 @@ MAN= savecore.8
LDADD= -lkvm -lutil -lz
DPADD= ${LIBKVM} ${LIBUTIL} ${LIBZ}
+.include "../../compat/exec.mk"
+
.include <bsd.prog.mk>
diff --git a/usr.bin/fstat/Makefile b/usr.bin/fstat/Makefile
index e76577fb043..db2df9eac44 100644
--- a/usr.bin/fstat/Makefile
+++ b/usr.bin/fstat/Makefile
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.24 2016/01/23 16:12:03 christos Exp $
+# $NetBSD: Makefile,v 1.25 2016/12/23 10:19:57 mrg Exp $
# from: @(#)Makefile 8.1 (Berkeley) 6/6/93
.include <bsd.own.mk>
@@ -21,4 +21,6 @@ CPPFLAGS+=-D_KMEMUSER
LDADD+=-lutil
DPADD+=${LIBUTIL}
+.include "../../compat/exec.mk"
+
.include <bsd.prog.mk>
diff --git a/usr.bin/netstat/Makefile b/usr.bin/netstat/Makefile
index 9f03a7150d9..d00027b8147 100644
--- a/usr.bin/netstat/Makefile
+++ b/usr.bin/netstat/Makefile
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.43 2015/06/06 13:48:37 joerg Exp $
+# $NetBSD: Makefile,v 1.44 2016/12/23 10:19:57 mrg Exp $
# from: @(#)Makefile 8.1 (Berkeley) 6/12/93
.include <bsd.own.mk>
@@ -28,4 +28,6 @@ RUMPSRCS+= if_indextoname.c getifaddrs.c getnameinfo.c
CPPFLAGS+= -DINET6
.endif
+.include "../../compat/exec.mk"
+
.include <bsd.prog.mk>
diff --git a/usr.bin/pmap/Makefile b/usr.bin/pmap/Makefile
index c1dcf3fb56b..d78662fccf9 100644
--- a/usr.bin/pmap/Makefile
+++ b/usr.bin/pmap/Makefile
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.7 2016/01/23 21:22:49 christos Exp $
+# $NetBSD: Makefile,v 1.8 2016/12/23 10:19:57 mrg Exp $
USE_FORT?= yes # setgid
PROG= pmap
@@ -11,4 +11,6 @@ DPADD= ${LIBUTIL} ${LIBKVM}
CWARNFLAGS.clang+= -Wno-format-extra-args
CPPFLAGS+= -D_KMEMUSER
+.include "../../compat/exec.mk"
+
.include <bsd.prog.mk>
diff --git a/usr.bin/systat/Makefile b/usr.bin/systat/Makefile
index ecdee19f4a8..780ea93710f 100644
--- a/usr.bin/systat/Makefile
+++ b/usr.bin/systat/Makefile
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.39 2016/08/02 15:56:09 scole Exp $
+# $NetBSD: Makefile,v 1.40 2016/12/23 10:19:57 mrg Exp $
# @(#)Makefile 8.1 (Berkeley) 6/6/93
.include <bsd.own.mk>
@@ -27,4 +27,6 @@ CPPFLAGS+=-DINET6
SRCS+= ip6.c
.endif
+.include "../../compat/exec.mk"
+
.include <bsd.prog.mk>
diff --git a/usr.sbin/crash/Makefile b/usr.sbin/crash/Makefile
index e261765ead7..b5a24ec6677 100644
--- a/usr.sbin/crash/Makefile
+++ b/usr.sbin/crash/Makefile
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.32 2016/12/10 10:42:43 mrg Exp $
+# $NetBSD: Makefile,v 1.33 2016/12/23 10:19:57 mrg Exp $
PROG= crash
MAN= crash.8
@@ -97,5 +97,7 @@ SRCS+= unsupported.c
.endif # }
+.include "../../compat/exec.mk"
+
.include <bsd.prog.mk>
.include <bsd.klinks.mk>
diff --git a/usr.sbin/kgmon/Makefile b/usr.sbin/kgmon/Makefile
index cd7244dfc75..287c67c762e 100644
--- a/usr.sbin/kgmon/Makefile
+++ b/usr.sbin/kgmon/Makefile
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.10 2009/04/22 15:23:04 lukem Exp $
+# $NetBSD: Makefile,v 1.11 2016/12/23 10:19:57 mrg Exp $
# from: @(#)Makefile 8.1 (Berkeley) 6/6/93
PROG= kgmon
@@ -13,4 +13,6 @@ LDADD= -lkvm
#BINOWN=root
#BINMODE=4555
+.include "../../compat/exec.mk"
+
.include <bsd.prog.mk>
diff --git a/usr.sbin/pstat/Makefile b/usr.sbin/pstat/Makefile
index 72c2203a4d8..7ce94bf3fab 100644
--- a/usr.sbin/pstat/Makefile
+++ b/usr.sbin/pstat/Makefile
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.16 2013/01/02 10:43:11 dsl Exp $
+# $NetBSD: Makefile,v 1.17 2016/12/23 10:19:57 mrg Exp $
# from: @(#)Makefile 8.1 (Berkeley) 6/6/93
.include <bsd.own.mk>
@@ -19,4 +19,6 @@ CPPFLAGS+=-D_KMEMUSER
.PATH: ${NETBSDSRCDIR}/sbin/swapctl
+.include "../../compat/exec.mk"
+
.include <bsd.prog.mk>
diff --git a/usr.sbin/trpt/Makefile b/usr.sbin/trpt/Makefile
index e43d22e3fda..db85b85098e 100644
--- a/usr.sbin/trpt/Makefile
+++ b/usr.sbin/trpt/Makefile
@@ -1,5 +1,5 @@
# @(#)Makefile 8.1 (Berkeley) 6/6/93
-# $NetBSD: Makefile,v 1.10 2007/05/28 12:06:42 tls Exp $
+# $NetBSD: Makefile,v 1.11 2016/12/23 10:19:58 mrg Exp $
.include <bsd.own.mk>
@@ -15,4 +15,6 @@ LDADD= -lkvm
CPPFLAGS+= -DINET6
.endif
+.include "../../compat/exec.mk"
+
.include <bsd.prog.mk>