1.\" $NetBSD: compat_netbsd32.8,v 1.13 2019/01/17 07:05:24 gutteridge Exp $ 2.\" 3.\" Copyright (c) 2001, 2019 Matthew R. Green 4.\" All rights reserved. 5.\" 6.\" Redistribution and use in source and binary forms, with or without 7.\" modification, are permitted provided that the following conditions 8.\" are met: 9.\" 1. Redistributions of source code must retain the above copyright 10.\" notice, this list of conditions and the following disclaimer. 11.\" 2. Redistributions in binary form must reproduce the above copyright 12.\" notice, this list of conditions and the following disclaimer in the 13.\" documentation and/or other materials provided with the distribution. 14.\" 15.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 16.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 20.\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 22.\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 23.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25.\" SUCH DAMAGE. 26.\" 27.Dd January 17, 2019 28.Dt COMPAT_NETBSD32 8 29.Os 30.Sh NAME 31.Nm compat_netbsd32 32.Nd setup procedure for 32-bit compatibility on 64-bit platforms 33.Sh DESCRIPTION 34The 35.Nm 36module allows 37.Nx Ns Tn /sparc64 38to run 39.Nx Ns Tn /sparc 40executables, 41.Nx Ns Tn /aarch64 42to run 43.Nx Ns Tn /arm 44executables, 45.Nx Ns Tn /mips64 46to run 47.Nx Ns Tn /mips 48executables, and 49.Nx Ns Tn /amd64 50to run 51.Nx Ns Tn /i386 52executables. 53On 54.Nx Ns Tn /mips64 55the default userland is N32 which is a handled by 56.Nm 57framework, and 64-bit binaries are handled similarly to the setup 58for 32-bit compatibility. 59It also provides compatibility between OABI and EABI binaries on 32-bit 60.Nx Ns Tn /arm 61ports. 62.Pp 63To use 64.Nm , 65one must either have 66.Dv COMPAT_NETBSD32 67and 68.Dv EXEC_ELF32 69in the kernel, or load the compat_netbsd32 and exec_elf32 kernel 70modules. 71.Pp 72Static executables typically need no additional setup. 73Dynamic binaries require the dynamic linker plus shared libraries. 74.Pp 75Since 76.Nx 5.0 77the base system has directly included support for 32-bit compatibility 78by installing 32-bit libraries and dynamic linker into 79.Pa /usr . 80This includes compiler support for compiling 32-bit applications 81on platforms where this is supported. 82.Pp 83For a.out compatibility, 84.Pa /usr/libexec/ld.so 85from a 32-bit distribution is required to exist, and the a.out 86shared libraries must be found in 87.Pa /emul/aout 88as normal for a.out compatibility. 89For 32-bit (64-bit on 90.Nx Ns Tn /mips64 ) 91ELF compatibility, the relevant 92.Pa /usr/libexec/ld.elf_so 93needs to be found in 94.Bl -column -offset indent "powerpc64" "powerpc" "" 95.It Sy Port Ta Sy Target Ta Sy Path 96.It Li amd64 Ta i386 Ta /usr/libexec/ld.elf_so-i386 97.It Li sparc64 Ta sparc Ta /usr/libexec/ld.elf_so-sparc 98.It Li mips64 Ta O32 Ta /usr/libexec/ld.elf_so-o32 99.It Li mips64 Ta N64 Ta /usr/libexec/ld.elf_so-64 100.It Li powerpc64 Ta powerpc Ta /usr/libexec/ld.elf_so-powerpc 101.It Li arm64 Ta eabi Ta /usr/libexec/ld.elf_so-eabi 102.El 103.Pp 104Note that the kernel handles rewriting the builting ELF interpreter 105to the above path. 106.Pp 107Before 108.Nx 5.0 109all of these files needed to be placed under 110.Pa /emul/netbsd32 . 111.Pp 112The shared libraries for a.out binaries do not live under the 113.Pa /emul/netbsd32 114directory, but under the 115.Pa /emul/aout 116directory, where the a.out dynamic linker will find them. 117.Sh BUGS 118A list of things which fail to work in compatibility mode should 119be here. 120.Pp 121.Xr aio 3 122is not supported. 123.Pp 124Some 125.Xr ioctl 2 126commands are not supported, including 127.Xr drm 4 . 128