Subject: Re: namei() for binary emulations
To: Quentin Garnier <cube@cubidou.net>
From: Pavel Cahyna <pavel.cahyna@st.mff.cuni.cz>
List: tech-kern
Date: 07/04/2005 19:09:16
Hello,

On Mon, 04 Jul 2005 01:35:13 +0200, Quentin Garnier wrote:

> 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.

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
/usr/lib64 or /usr/lib32 and /usr/lib64)?

(Excuse my ignorance, I don't have any 64-bit machine yet.)

IRIX has /usr/lib for O32 ABI, /usr/lib32 for N32 ABI, and /usr/lib64 for
64-bit ABI:

$ file /var/netscape/communicator/netscape 
/var/netscape/communicator/netscape:    ELF 32-bit MSB mips-2 dynamic executable MIPS - version 1
$ readelf -x1 /var/netscape/communicator/netscape 

Hex dump of section '.interp':
  0x00400134 2f757372 2f6c6962 2f6c6962 632e736f /usr/lib/libc.so
  0x00400144 2e3100                              .1.

$ file $(which xclipboard)
/usr/bin/X11/xclipboard:        ELF N32 MSB mips-3 dynamic executable MIPS - version 1
$ readelf -x1 $(which xclipboard)

Hex dump of section '.interp':
  0x10000114 2f757372 2f6c6962 33322f6c 6962632e /usr/lib32/libc.
  0x10000124 736f2e31 00                         so.1.

$ file ./integral
./integral:     ELF 64-bit MSB mips-4 dynamic executable (not stripped) MIPS - version 1
$ readelf -x1 ./integral

Hex dump of section '.interp':
  0x10000190 2f757372 2f6c6962 36342f6c 6962632e /usr/lib64/libc.
  0x100001a0 736f2e31 00                         so.1.

Bye	Pavel