Support for running Linux binaries under emulation is going away.
The patch below removes "option COMPAT_LINUX" and everything directly
tied to it (kernel configuration, #ifdef sections, etc.) from the
kernel tree and the corresponding man page documentation.
Further, these files
sys/arch/i386/i386/linux_machdep.c
sys/arch/i386/include/linux_machdep.h
sys/sys/ioctl_compat.h
share/man/man8/compat_linux.8
can be removed. (Not part of the patch.)
The actual compat/* code is left untouched since other components
are still entangled with it.
Index: sys/arch/i386/conf/GENERIC
===================================================================
RCS file: /cvs/src/sys/arch/i386/conf/GENERIC,v
retrieving revision 1.811
diff -u -p -r1.811 GENERIC
--- sys/arch/i386/conf/GENERIC 11 Jan 2016 22:00:16 -0000 1.811
+++ sys/arch/i386/conf/GENERIC 27 Feb 2016 14:32:50 -0000
@@ -24,8 +24,6 @@ option MTRR # CPU memory range
attribu
#option KGDB # Remote debugger support; exclusive of
DDB
#option "KGDB_DEVNAME=\"com\"",KGDBADDR=0x2f8,KGDBRATE=9600
-option COMPAT_LINUX # binary compatibility with Linux
-
option NTFS # NTFS support
option HIBERNATE # Hibernate support
Index: sys/arch/i386/conf/files.i386
===================================================================
RCS file: /cvs/src/sys/arch/i386/conf/files.i386,v
retrieving revision 1.228
diff -u -p -r1.228 files.i386
--- sys/arch/i386/conf/files.i386 8 Jan 2016 15:54:13 -0000 1.228
+++ sys/arch/i386/conf/files.i386 27 Feb 2016 14:33:30 -0000
@@ -258,10 +258,6 @@ file arch/i386/i386/vm86.c vm86
file arch/i386/i386/kvm86.c kvm86
file arch/i386/i386/kvm86call.S kvm86
-# Linux binary compatibility (COMPAT_LINUX)
-include "compat/linux/files.linux"
-file arch/i386/i386/linux_machdep.c compat_linux
-
device bios {}
attach bios at mainbus
file arch/i386/i386/bios.c bios needs-count
Index: sys/arch/i386/i386/genassym.cf
===================================================================
RCS file: /cvs/src/sys/arch/i386/i386/genassym.cf,v
retrieving revision 1.37
diff -u -p -r1.37 genassym.cf
--- sys/arch/i386/i386/genassym.cf 12 Apr 2015 18:37:53 -0000 1.37
+++ sys/arch/i386/i386/genassym.cf 27 Feb 2016 14:34:19 -0000
@@ -48,10 +48,6 @@ include <machine/pmap.h>
include <machine/vmparam.h>
include <machine/mutex.h>
-if COMPAT_LINUX > 0
-include <machine/linux_machdep.h>
-endif
-
if MULTIPROCESSOR
include <machine/cpu.h>
endif
@@ -131,14 +127,6 @@ struct mbuf
member m_next
member m_data
member m_len
-
-# Linux frame offsets
-ifdef COMPAT_LINUX
-struct linux_sigframe LINUX_SIGF_
-member HANDLER sf_handler
-member SC sf_sc
-struct linux_sigcontext LINUX_
-endif
# Interrupt metering
if NISA > 0
Index: sys/arch/i386/i386/locore.s
===================================================================
RCS file: /cvs/src/sys/arch/i386/i386/locore.s,v
retrieving revision 1.163
diff -u -p -r1.163 locore.s
--- sys/arch/i386/i386/locore.s 26 Feb 2016 02:25:09 -0000 1.163
+++ sys/arch/i386/i386/locore.s 27 Feb 2016 14:36:51 -0000
@@ -46,9 +46,6 @@
#include <sys/errno.h>
#include <sys/syscall.h>
-#ifdef COMPAT_LINUX
-#include <compat/linux/linux_syscall.h>
-#endif
#include <machine/codepatch.h>
#include <machine/cputypes.h>
@@ -704,27 +701,6 @@ NENTRY(sigcode)
int $0x80 # exit if sigreturn fails
.globl _C_LABEL(esigcode)
_C_LABEL(esigcode):
-
-/*****************************************************************************/
-
-/*****************************************************************************/
-
-#ifdef COMPAT_LINUX
-/*
- * Signal trampoline; copied to top of user stack.
- */
-NENTRY(linux_sigcode)
- call *LINUX_SIGF_HANDLER(%esp)
- leal LINUX_SIGF_SC(%esp),%ebx # scp (the call may have clobbered the
- # copy at SIGF_SCP(%esp))
- pushl %eax # junk to fake return address
- movl $LINUX_SYS_sigreturn,%eax
- int $0x80 # enter kernel with args on stack
- movl $LINUX_SYS_exit,%eax
- int $0x80 # exit if sigreturn fails
- .globl _C_LABEL(linux_esigcode)
-_C_LABEL(linux_esigcode):
-#endif
/*****************************************************************************/
Index: sys/arch/i386/i386/trap.c
===================================================================
RCS file: /cvs/src/sys/arch/i386/i386/trap.c,v
retrieving revision 1.123
diff -u -p -r1.123 trap.c
--- sys/arch/i386/i386/trap.c 28 Jun 2015 01:11:27 -0000 1.123
+++ sys/arch/i386/i386/trap.c 27 Feb 2016 14:38:07 -0000
@@ -67,10 +67,6 @@
#endif
#include <sys/exec.h>
-#ifdef COMPAT_LINUX
-#include <compat/linux/linux_syscall.h>
-extern struct emul emul_linux_elf;
-#endif
#ifdef KVM86
#include <machine/kvm86.h>
#define KVM86MODE (kvm86_incall)
@@ -582,11 +578,6 @@ syscall(struct trapframe *frame)
switch (code) {
case SYS_syscall:
-#ifdef COMPAT_LINUX
- /* Linux has a special system setup call as number 0 */
- if (p->p_p->ps_emul == &emul_linux_elf)
- break;
-#endif
/*
* Code is first argument, followed by actual args.
*/
@@ -611,36 +602,6 @@ syscall(struct trapframe *frame)
else
callp += code;
argsize = callp->sy_argsize;
-#ifdef COMPAT_LINUX
- /* XXX extra if() for every emul type.. */
- if (p->p_p->ps_emul == &emul_linux_elf) {
- /*
- * Linux passes the args in ebx, ecx, edx, esi, edi, ebp, in
- * increasing order.
- */
- switch (argsize) {
- case 24:
- args[5] = frame->tf_ebp;
- case 20:
- args[4] = frame->tf_edi;
- case 16:
- args[3] = frame->tf_esi;
- case 12:
- args[2] = frame->tf_edx;
- case 8:
- args[1] = frame->tf_ecx;
- case 4:
- args[0] = frame->tf_ebx;
- case 0:
- break;
- default:
- panic("linux syscall with weird argument size %d",
- argsize);
- break;
- }
- }
- else
-#endif
if (argsize && (error = copyin(params, args, argsize)))
goto bad;
Index: sys/conf/files
===================================================================
RCS file: /cvs/src/sys/conf/files,v
retrieving revision 1.611
diff -u -p -r1.611 files
--- sys/conf/files 18 Feb 2016 01:23:05 -0000 1.611
+++ sys/conf/files 27 Feb 2016 14:39:47 -0000
@@ -976,7 +976,6 @@ file net/pfkeyv2_convert.c key | ipsec
# COMPAT_* support code (base and other shared code)
file compat/common/compat_util.c !small_kernel
-file compat/common/compat_dir.c !small_kernel & compat_linux
# libx86emu
file dev/x86emu/x86emu.c x86emu
Index: sys/kern/exec_conf.c
===================================================================
RCS file: /cvs/src/sys/kern/exec_conf.c,v
retrieving revision 1.33
diff -u -p -r1.33 exec_conf.c
--- sys/kern/exec_conf.c 18 Jul 2015 00:15:10 -0000 1.33
+++ sys/kern/exec_conf.c 27 Feb 2016 14:40:23 -0000
@@ -39,11 +39,7 @@
#include <sys/exec_elf.h>
#endif
-#ifdef COMPAT_LINUX
-#include <compat/linux/linux_exec.h>
-#endif
-
-extern struct emul emul_native, emul_linux_elf;
+extern struct emul emul_native;
struct execsw execsw[] = {
{ EXEC_SCRIPT_HDRSZ, exec_script_makecmds, &emul_native, }, /*
shell scripts */
@@ -53,9 +49,6 @@ struct execsw execsw[] = {
#ifdef _KERN_DO_ELF64
{ sizeof(Elf64_Ehdr), exec_elf64_makecmds, &emul_native }, /* elf
binaries */
#endif /* ELF64 */
-#ifdef COMPAT_LINUX
- { sizeof(Elf32_Ehdr), exec_linux_elf32_makecmds, &emul_linux_elf },
-#endif
};
int nexecs = (sizeof execsw / sizeof(*execsw));
int exec_maxhdrsz;
Index: sys/kern/exec_elf.c
===================================================================
RCS file: /cvs/src/sys/kern/exec_elf.c,v
retrieving revision 1.119
diff -u -p -r1.119 exec_elf.c
--- sys/kern/exec_elf.c 2 Nov 2015 16:31:55 -0000 1.119
+++ sys/kern/exec_elf.c 27 Feb 2016 14:41:28 -0000
@@ -92,18 +92,11 @@
#include <machine/reg.h>
#include <machine/exec.h>
-#ifdef COMPAT_LINUX
-#include <compat/linux/linux_exec.h>
-#endif
-
struct ELFNAME(probe_entry) {
int (*func)(struct proc *, struct exec_package *, char *,
u_long *);
} ELFNAME(probes)[] = {
/* XXX - bogus, shouldn't be size independent.. */
-#ifdef COMPAT_LINUX
- { linux_elf_probe },
-#endif
{ NULL }
};
Index: sys/net/if.c
===================================================================
RCS file: /cvs/src/sys/net/if.c,v
retrieving revision 1.425
diff -u -p -r1.425 if.c
--- sys/net/if.c 9 Dec 2015 03:22:39 -0000 1.425
+++ sys/net/if.c 27 Feb 2016 14:43:12 -0000
@@ -1548,9 +1548,6 @@ ifioctl(struct socket *so, u_long cmd, c
switch (cmd) {
case SIOCGIFCONF:
-#ifdef COMPAT_LINUX
- case OSIOCGIFCONF:
-#endif
return (ifconf(cmd, data));
}
ifr = (struct ifreq *)data;
@@ -1980,9 +1977,6 @@ ifconf(u_long cmd, caddr_t data)
TAILQ_FOREACH(ifa,
&ifp->if_addrlist, ifa_list) {
sa = ifa->ifa_addr;
-#ifdef COMPAT_LINUX
- if (cmd != OSIOCGIFCONF)
-#endif
if (sa->sa_len > sizeof(*sa))
space += sa->sa_len -
sizeof(*sa);
@@ -2011,16 +2005,6 @@ ifconf(u_long cmd, caddr_t data)
if (space < sizeof(ifr))
break;
-#ifdef COMPAT_LINUX
- if (cmd == OSIOCGIFCONF) {
- ifr.ifr_addr = *sa;
- *(u_int16_t *)&ifr.ifr_addr =
- sa->sa_family;
- error = copyout((caddr_t)&ifr,
- (caddr_t)ifrp, sizeof (ifr));
- ifrp++;
- } else
-#endif
if (sa->sa_len <= sizeof(*sa)) {
ifr.ifr_addr = *sa;
error = copyout((caddr_t)&ifr,
Index: sys/sys/ioctl.h
===================================================================
RCS file: /cvs/src/sys/sys/ioctl.h,v
retrieving revision 1.16
diff -u -p -r1.16 ioctl.h
--- sys/sys/ioctl.h 21 Jan 2015 23:06:53 -0000 1.16
+++ sys/sys/ioctl.h 27 Feb 2016 14:43:55 -0000
@@ -53,7 +53,3 @@ int ioctl(int, unsigned long, ...);
__END_DECLS
#endif /* !_KERNEL */
#endif /* !_SYS_IOCTL_H_ */
-
-#if defined(COMPAT_LINUX)
-#include <sys/ioctl_compat.h>
-#endif
Index: share/man/man4/options.4
===================================================================
RCS file: /cvs/src/share/man/man4/options.4,v
retrieving revision 1.240
diff -u -p -r1.240 options.4
--- share/man/man4/options.4 1 Oct 2015 20:42:58 -0000 1.240
+++ share/man/man4/options.4 27 Feb 2016 00:43:19 -0000
@@ -52,17 +52,6 @@ for information on how to configure and
options are passed to the compile process as
.Fl D
flags to the C compiler.
-.Sh COMPATIBILITY OPTIONS
-.Bl -ohang
-.It Cd option COMPAT_LINUX
-On those architectures that support it, this enables binary
-compatibility with
-.Em Linux
-ELF applications built for the same architecture.
-This option is supported on the i386 architecture.
-See
-.Xr compat_linux 8 .
-.El
.Sh DEBUGGING OPTIONS
.Bl -ohang
.It Cd makeoptions DEBUG="-g"
Index: share/man/man8/Makefile
===================================================================
RCS file: /cvs/src/share/man/man8/Makefile,v
retrieving revision 1.89
diff -u -p -r1.89 Makefile
--- share/man/man8/Makefile 1 Dec 2015 07:50:05 -0000 1.89
+++ share/man/man8/Makefile 27 Feb 2016 00:42:15 -0000
@@ -3,7 +3,7 @@
# @(#)Makefile 8.1 (Berkeley) 6/5/93
MAN= afterboot.8 autoinstall.8 boot_config.8 \
- compat_linux.8 crash.8 daily.8 \
+ crash.8 daily.8 \
diskless.8 genassym.sh.8 intro.8 netstart.8 rc.8 \
rc.conf.8 rc.d.8 rc.shutdown.8 rc.subr.8 release.8 \
security.8 ssl.8 starttls.8 sticky.8 yp.8
Index: usr.bin/kdump/Makefile
===================================================================
RCS file: /cvs/src/usr.bin/kdump/Makefile,v
retrieving revision 1.30
diff -u -p -r1.30 Makefile
--- usr.bin/kdump/Makefile 5 Jan 2016 19:41:15 -0000 1.30
+++ usr.bin/kdump/Makefile 27 Feb 2016 15:30:11 -0000
@@ -11,7 +11,6 @@ CLEANFILES+=ioctl.c kdump_subr.c
ioctl.c: ${.CURDIR}/Makefile ${.CURDIR}/mkioctls
CC="${CC}" \
/bin/sh ${.CURDIR}/mkioctls ${SYS_DIR}/sys/ioctl.h \
- ${SYS_DIR}/sys/ioctl_compat.h \
${SYS_DIR}/dev/biovar.h \
${SYS_DIR}/dev/systrace.h \
${SYS_DIR}/dev/wscons/wsconsio.h \
--
Christian "naddy" Weisgerber [email protected]