\" $NetBSD: compat_bsdos.8,v 1.7 2020/09/02 23:38:11 uwe Exp $
\"
\" Copyright (c) 2020 The NetBSD Foundation, Inc.
\" All rights reserved.
\"
\" This code is derived from software contributed to The NetBSD Foundation
\" by Dan Plassche.
\"
\" Redistribution and use in source and binary forms, with or without
\" modification, are permitted provided that the following conditions
\" are met:
\" 1. Redistributions of source code must retain the above copyright
\"    notice, this list of conditions and the following disclaimer.
\" 2. Redistributions in binary form must reproduce the above copyright
\"    notice, this list of conditions and the following disclaimer in the
\"    documentation and/or other materials provided with the distribution.
\"
\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
\" POSSIBILITY OF SUCH DAMAGE.
\"
Dd August 27, 2020
Dt COMPAT_BSDOS 8
Os
Sh NAME
Nm compat_bsdos
Nd binary compatibility for BSDi releases
Sh DESCRIPTION
The
Dv COMPAT_NOMID
kernel option includes compatibility with
Tn BSDi Ns No \ 1. Ns Em \^x Ns \|\(en\|3. Ns Em \^x
Xr a.out 5
binaries on
Nx Ns Tn /i386
and
Nx Ns Tn /amd64 .
The option is enabled by default in the
Li GENERIC
kernel on i386,
but needs to be set along with
Dv EXEC_AOUT
on amd64.
Pp
Null memory protection must be disabled with the
Xr sysctl 7
option
Va vm.user_va0_disable
set to
Li 0
for the binaries to run successfully.
Pp
Bsx
binaries may be placed under
Pa /emul
directory to match the location of other
non-native executables
on
Nx ,
but the compatibility environment
does not automatically lookup libraries
under
Pa /emul/bsdos
as happens with the shared
libraries
for
Nx 1.0\|\(en\|1.5
Xr a.out 5
binaries under
Pa /emul/aout .
Pp
Tn BSD/386 Ns No \ 1.0\|\(en\|1.1
uses static binaries that do not
dynamically load libraries at runtime.
Pp
Bsx 2.0
introduced
Dq "static shared libraries"
as the default for standard binaries.
The shared libraries are compiled from
Pa /lib
and
Pa /usr/lib
to a custom format bound to memory
loading addresses for each library
under
Pa /shlib .
BSDi libraries
under
Pa /shlib
are not in the standard
Xr ar 5
or position-independent shared object
formats and cannot be loaded by
Xr ldconfig 8
on
Nx .
In order for BSDi executables to
access the objects at the
hardcoded
Pa /shlib
path,
the user may setup a
symbolic link from
Pa /shlib
to
Pa /emul/bsdos/shlib .
\" or run a shell under a
\" .Ic chroot
\" with the command
\" .Ic chroot "/emul/bsdos /bin/sh" .
\" One could rebuild the BSDi userland
\" from source using
\" .Pa /emul/bsdos/lib
\" and
\" .Pa /emul/bsdos/usr/lib .
\" Then adding
\" .Pa /emul/bsdos/lib
\" and
\" .Pa /emul/bsdos/usr/lib
\" to
\" .Pa /etc/ld.so.conf
\" and running
\" .Ic ldconfig
\" to regenerate
\" .Pa /var/run/ld.so.hints
\" for a new hybrid setup.
Pp
Bsx 4.0
switched to an ELF binary executable format
that does not run under the
compatibility layers currently available on
Nx .
Sh SEE ALSO
Xr ld.aout_so 1 ,
Xr options 4 ,
Xr a.out 5 ,
Xr elf 5 ,
Xr sysctl 7 ,
Xr compat_netbsd32 8 ,
Xr ldconfig 8
Sh HISTORY
Tn BSD/386 Ns No \ 1.0\|\(en\|1.1
was derived from
Bx 4.3 Tn Reno
code in the
Tn Net/2
release.
Pp
Bsx 2.0
was based on
Bx 4.4 Tn Lite ,
but added the new static shared library
format as the runtime default for executables.
The build system included the
Li shlicc
command with the
Fl Bstatic
flag that allowed reverting to the standard
library archive format that remained available
under
Pa /lib
and
Pa /usr/lib .
Pp
Nx 1.0
added shared libraries using a standard
position-independent shared object
format.
The previous default relocatable libraries
in the traditional
Xr ar 5
format remained available.
Pp
Ox 2.2\|\(en\|4.7
included a different compatibility implementation
under the
Dv COMPAT_BSDOS
kernel option.
Sh BUGS
Bsx
compatibility was broken on
Nx 5\|\(en\|6 .
Pp
Bsx 3.0
added
Tn SPARC
support, but the binaries are incorrectly recognized as
Tn SunOS
executables and fail on
Nx Ns Tn /sparc
and
Nx Ns Tn /sparc64 .