1*9eac6fa1Sgutteridge.\" $NetBSD: compat_netbsd32.8,v 1.13 2019/01/17 07:05:24 gutteridge Exp $ 249a10e62Smrg.\" 3754a5dbbSmrg.\" Copyright (c) 2001, 2019 Matthew R. Green 449a10e62Smrg.\" All rights reserved. 549a10e62Smrg.\" 649a10e62Smrg.\" Redistribution and use in source and binary forms, with or without 749a10e62Smrg.\" modification, are permitted provided that the following conditions 849a10e62Smrg.\" are met: 949a10e62Smrg.\" 1. Redistributions of source code must retain the above copyright 1049a10e62Smrg.\" notice, this list of conditions and the following disclaimer. 1149a10e62Smrg.\" 2. Redistributions in binary form must reproduce the above copyright 1249a10e62Smrg.\" notice, this list of conditions and the following disclaimer in the 1349a10e62Smrg.\" documentation and/or other materials provided with the distribution. 1449a10e62Smrg.\" 1549a10e62Smrg.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 1649a10e62Smrg.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 1749a10e62Smrg.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 1849a10e62Smrg.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 1949a10e62Smrg.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 2049a10e62Smrg.\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 2149a10e62Smrg.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 2249a10e62Smrg.\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 2349a10e62Smrg.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2449a10e62Smrg.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2549a10e62Smrg.\" SUCH DAMAGE. 2649a10e62Smrg.\" 27*9eac6fa1Sgutteridge.Dd January 17, 2019 2849a10e62Smrg.Dt COMPAT_NETBSD32 8 2949a10e62Smrg.Os 3049a10e62Smrg.Sh NAME 3149a10e62Smrg.Nm compat_netbsd32 32c7e46fd2Swiz.Nd setup procedure for 32-bit compatibility on 64-bit platforms 3349a10e62Smrg.Sh DESCRIPTION 3449a10e62SmrgThe 3549a10e62Smrg.Nm 3649a10e62Smrgmodule allows 3749a10e62Smrg.Nx Ns Tn /sparc64 3849a10e62Smrgto run 3949a10e62Smrg.Nx Ns Tn /sparc 40324197e3Sryoexecutables, 41324197e3Sryo.Nx Ns Tn /aarch64 42324197e3Sryoto run 43324197e3Sryo.Nx Ns Tn /arm 44754a5dbbSmrgexecutables, 45754a5dbbSmrg.Nx Ns Tn /mips64 46754a5dbbSmrgto run 47754a5dbbSmrg.Nx Ns Tn /mips 481fce7b09Swizexecutables, and 491fce7b09Swiz.Nx Ns Tn /amd64 501fce7b09Swizto run 511fce7b09Swiz.Nx Ns Tn /i386 5249a10e62Smrgexecutables. 53754a5dbbSmrgOn 54754a5dbbSmrg.Nx Ns Tn /mips64 55754a5dbbSmrgthe default userland is N32 which is a handled by 56754a5dbbSmrg.Nm 57754a5dbbSmrgframework, and 64-bit binaries are handled similarly to the setup 58754a5dbbSmrgfor 32-bit compatibility. 59*9eac6fa1SgutteridgeIt also provides compatibility between OABI and EABI binaries on 32-bit 60*9eac6fa1Sgutteridge.Nx Ns Tn /arm 61*9eac6fa1Sgutteridgeports. 6249a10e62Smrg.Pp 6349a10e62SmrgTo use 64990562bfSwiz.Nm , 6549a10e62Smrgone must either have 6649a10e62Smrg.Dv COMPAT_NETBSD32 679622e4afSjschaumaand 689622e4afSjschauma.Dv EXEC_ELF32 69754a5dbbSmrgin the kernel, or load the compat_netbsd32 and exec_elf32 kernel 7049a10e62Smrgmodules. 7149a10e62Smrg.Pp 7249a10e62SmrgStatic executables typically need no additional setup. 731fce7b09SwizDynamic binaries require the dynamic linker plus shared libraries. 7449a10e62Smrg.Pp 75754a5dbbSmrgSince 76754a5dbbSmrg.Nx 5.0 77754a5dbbSmrgthe base system has directly included support for 32-bit compatibility 78754a5dbbSmrgby installing 32-bit libraries and dynamic linker into 79754a5dbbSmrg.Pa /usr . 80754a5dbbSmrgThis includes compiler support for compiling 32-bit applications 81754a5dbbSmrgon platforms where this is supported. 8249a10e62Smrg.Pp 8349a10e62SmrgFor a.out compatibility, 8449a10e62Smrg.Pa /usr/libexec/ld.so 85754a5dbbSmrgfrom a 32-bit distribution is required to exist, and the a.out 86754a5dbbSmrgshared libraries must be found in 87e8920d82Swiz.Pa /emul/aout 88754a5dbbSmrgas normal for a.out compatibility. 89754a5dbbSmrgFor 32-bit (64-bit on 90754a5dbbSmrg.Nx Ns Tn /mips64 ) 91754a5dbbSmrgELF compatibility, the relevant 9249a10e62Smrg.Pa /usr/libexec/ld.elf_so 93754a5dbbSmrgneeds to be found in 94754a5dbbSmrg.Bl -column -offset indent "powerpc64" "powerpc" "" 95754a5dbbSmrg.It Sy Port Ta Sy Target Ta Sy Path 96754a5dbbSmrg.It Li amd64 Ta i386 Ta /usr/libexec/ld.elf_so-i386 97754a5dbbSmrg.It Li sparc64 Ta sparc Ta /usr/libexec/ld.elf_so-sparc 98754a5dbbSmrg.It Li mips64 Ta O32 Ta /usr/libexec/ld.elf_so-o32 99754a5dbbSmrg.It Li mips64 Ta N64 Ta /usr/libexec/ld.elf_so-64 100754a5dbbSmrg.It Li powerpc64 Ta powerpc Ta /usr/libexec/ld.elf_so-powerpc 101754a5dbbSmrg.It Li arm64 Ta eabi Ta /usr/libexec/ld.elf_so-eabi 102754a5dbbSmrg.El 103754a5dbbSmrg.Pp 104754a5dbbSmrgNote that the kernel handles rewriting the builting ELF interpreter 105754a5dbbSmrgto the above path. 106754a5dbbSmrg.Pp 107754a5dbbSmrgBefore 108754a5dbbSmrg.Nx 5.0 109754a5dbbSmrgall of these files needed to be placed under 110754a5dbbSmrg.Pa /emul/netbsd32 . 11149a10e62Smrg.Pp 1127dff71bcSwizThe shared libraries for a.out binaries do not live under the 11349a10e62Smrg.Pa /emul/netbsd32 11449a10e62Smrgdirectory, but under the 11549a10e62Smrg.Pa /emul/aout 1168de2ac78Sjdolecekdirectory, where the a.out dynamic linker will find them. 11749a10e62Smrg.Sh BUGS 11849a10e62SmrgA list of things which fail to work in compatibility mode should 11949a10e62Smrgbe here. 12049a10e62Smrg.Pp 121754a5dbbSmrg.Xr aio 3 122754a5dbbSmrgis not supported. 12349a10e62Smrg.Pp 124754a5dbbSmrgSome 125754a5dbbSmrg.Xr ioctl 2 126e8920d82Swizcommands are not supported, including 127754a5dbbSmrg.Xr drm 4 . 128