Subject: Re: namei() for binary emulations
To: Pavel Cahyna <pavel.cahyna@st.mff.cuni.cz>
From: Quentin Garnier <cube@cubidou.net>
List: tech-kern
Date: 07/04/2005 20:02:37
--j3olVFx0FsM75XyV
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Mon, Jul 04, 2005 at 07:09:16PM +0200, Pavel Cahyna wrote:
> Hello,
>=20
> On Mon, 04 Jul 2005 01:35:13 +0200, Quentin Garnier wrote:
>=20
> > While it doesn't usually break very foreign emulations such as Linux,
> > it is not the same for COMPAT_NETBSD32:  binaries in /usr/bin have
> > /usr/libexec/ld.so_elf as their interpreter, which is an absolute
> > link to /libexec/ld.so_elf.  Therefore, executing a binary from
> > /emul/netbsd32/usr/bin fails, because emul_find() finds the ld.so_elf
> > from the native system, not the netbsd32 one.
>=20
> Is supporting 32-bit binaries with namei hacks and /emul/netbsd32 a good
> idea? Wouldn't be better to have /usr/lib and /usr/lib32 (or /usr/lib and

The issue with namei() is not specific to COMPAT_NETBSD32, it's just
that it is very annoying for that emulation.

> /usr/lib64 or /usr/lib32 and /usr/lib64)?

This is what a lot of systems do.  But see below.

> (Excuse my ignorance, I don't have any 64-bit machine yet.)
>=20
> IRIX has /usr/lib for O32 ABI, /usr/lib32 for N32 ABI, and /usr/lib64 for
> 64-bit ABI:
>=20
> $ file /var/netscape/communicator/netscape=20
> /var/netscape/communicator/netscape:    ELF 32-bit MSB mips-2 dynamic exe=
cutable MIPS - version 1
> $ readelf -x1 /var/netscape/communicator/netscape=20
>=20
> Hex dump of section '.interp':
>   0x00400134 2f757372 2f6c6962 2f6c6962 632e736f /usr/lib/libc.so
>   0x00400144 2e3100                              .1.
>=20
> $ file $(which xclipboard)
> /usr/bin/X11/xclipboard:        ELF N32 MSB mips-3 dynamic executable MIP=
S - version 1
> $ readelf -x1 $(which xclipboard)
>=20
> Hex dump of section '.interp':
>   0x10000114 2f757372 2f6c6962 33322f6c 6962632e /usr/lib32/libc.
>   0x10000124 736f2e31 00                         so.1.
>=20
> $ file ./integral
> ./integral:     ELF 64-bit MSB mips-4 dynamic executable (not stripped) M=
IPS - version 1
> $ readelf -x1 ./integral
>=20
> Hex dump of section '.interp':
>   0x10000190 2f757372 2f6c6962 36342f6c 6962632e /usr/lib64/libc.
>   0x100001a0 736f2e31 00                         so.1.

As you pointed out, it implies radically changing our directory
layout, just for the sake of being able to run 32 bits binaries.

I think it is a completely different issue.  The current problem with
COMPAT_NETBSD32 is a side-effect of the way we do binary emulations.

--=20
Quentin Garnier - cube@cubidou.net - cube@NetBSD.org
"When I find the controls, I'll go where I like, I'll know where I want
to be, but maybe for now I'll stay right here on a silent sea."
KT Tunstall, Silent Sea, Eye to the Telescope, 2004.

--j3olVFx0FsM75XyV
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (NetBSD)

iQEVAwUBQsl5vdgoQloHrPnoAQJWRAgAyg4NO55/vjO+2RUIXdcC9Mi7TdVhzwno
nIUkbhARPJzStuGF42fINvwwfEYPIa9I9otLBSta2F+U47zKdTRtGX8RegL0bXOB
dMl+GzujGKlSB2qhgZg6Ej2EEPCrb4/iygHy7dXOFZBZE3/So7XScQJ6mQgy9zwn
j2NPeZWKHZDQZcbwN206AaS3LMxMdrzUvSrimJfkT3p61OyvDydWfEsqvUFYJuqs
I/Ax8Jlr+4lMBOt2eqFvV4cnRjVOh9aOD/KGIjflcBIJ0H254ep6Z7BCRnGuQWEc
WTGC5flibs6yv9RRrGsaMpedqoOKOB91zl7DFz8nejBVjxSrzvZYAA==
=lK9Q
-----END PGP SIGNATURE-----

--j3olVFx0FsM75XyV--