COMPAT_NETBSD32(8) | System Manager's Manual | COMPAT_NETBSD32(8)

# NAME

`compat_netbsd32` — setup procedure for 32-bit compatibility on 64-bit platforms

# DESCRIPTION

The `compat_netbsd32` module allows NetBSD/sparc64 to run NetBSD/sparc executables, NetBSD/aarch64 to run NetBSD/arm executables, NetBSD/mips64 to run NetBSD/mips executables, and NetBSD/amd64 to run NetBSD/i386 executables. On NetBSD/mips64 the default userland is N32 which is a handled by `compat_netbsd32` framework, and 64-bit binaries are handled similarly to the setup for 32-bit compatibility. It also provides compatibility between OABI and EABI binaries on 32-bit NetBSD/arm ports.

To use `compat_netbsd32`, one must either have `COMPAT_NETBSD32` and `EXEC_ELF32` in the kernel, or load the compat_netbsd32 and exec_elf32 kernel modules.

Static executables typically need no additional setup. Dynamic binaries require the dynamic linker plus shared libraries.

Since NetBSD 5.0 the base system has directly included support for 32-bit compatibility by installing 32-bit libraries and dynamic linker into /usr. This includes compiler support for compiling 32-bit applications on platforms where this is supported.

For a.out compatibility, /usr/libexec/ld.so from a 32-bit distribution is required to exist, and the a.out shared libraries must be found in /emul/aout as normal for a.out compatibility. For 32-bit (64-bit on NetBSD/mips64) ELF compatibility, the relevant /usr/libexec/ld.elf_so needs to be found in

Port | Target | Path
`amd64` | i386 | /usr/libexec/ld.elf_so-i386
`sparc64` | sparc | /usr/libexec/ld.elf_so-sparc
`mips64` | O32 | /usr/libexec/ld.elf_so-o32
`mips64` | N64 | /usr/libexec/ld.elf_so-64
`powerpc64` | powerpc | /usr/libexec/ld.elf_so-powerpc
`arm64` | eabi | /usr/libexec/ld.elf_so-eabi

Note that the kernel handles rewriting the builting ELF interpreter to the above path.

Before NetBSD 5.0 all of these files needed to be placed under /emul/netbsd32.

The shared libraries for a.out binaries do not live under the /emul/netbsd32 directory, but under the /emul/aout directory, where the a.out dynamic linker will find them.

# BUGS

A list of things which fail to work in compatibility mode should be here.

aio(3) is not supported.

Some ioctl(2) commands are not supported, including drm(4).

January 17, 2019 | NetBSD 11.99