Subject: svr4 emulation (LONG)
To: None <port-sparc@NetBSD.ORG>
From: Grey Wolf <greywolf@captech.com>
List: port-sparc
Date: 05/05/1997 23:58:17
[Please be sure you trim down all irrelevant parts when replying
as this post is loong]
Okay, I have 

        options         EMUL_SVR4
        options         EXEC_ELF32

in my kernel.

/emul/svr4/ is populated with just about every shared library known
to man.

I'm trying to run netscrape for solaris because netscrape for
sunos is unreliable (to say the least).

Solaris says:

netscape.d301g:  ELF 32-bit MSB executable SPARC Version 1, dynamically
linked, stripped

NetBSD says:
netscape.d301g: ELF 32-bit MSB executable, SPARC, version 1


However, it refuses to run.  '/emul/svr4/usr/bin/ldd' produces this
when run on netscape.d301g:

 21750 ktrace   RET   ktrace 0
 21750 ktrace   CALL  execve(0xf7fff4d3,0xf7fff3e8,0xf7fff3f4)
 21750 ktrace   NAMI  "/emul/svr4/usr/bin/ldd"
 21750 ktrace   NAMI  "/emul/svr4/usr/lib/ld.so.1"
 21750 ktrace   NAMI  "/emul/svr4"
 21750 ktrace   NAMI  "/emul/svr4/usr/lib/ld.so.1"
 21750 ldd      EMUL  "svr4"
 21750 ldd      RET   execve 0
 21750 ldd      CALL  open(0x10013ae8,0,0x9)
 21750 ldd      NAMI  "/emul/svr4/dev/zero"
 21750 ldd      NAMI  "/dev/zero"
 21750 ldd      RET   open 3
 21750 ldd      CALL  mmap(0,0x1000,0x7,0x80000002,0x3,0)
 21750 ldd      RET   mmap 268632064/0x10030000
 21750 ldd      CALL  getuid
 21750 ldd      RET   getuid 511/0x1ff
 21750 ldd      CALL  getuid
 21750 ldd      RET   getuid 511/0x1ff
 21750 ldd      CALL  getgid
 21750 ldd      RET   getgid 20/0x14
 21750 ldd      CALL  getgid
 21750 ldd      RET   getgid 20/0x14
 21750 ldd      CALL  open(0x10025218,0,0x1002566c)
 21750 ldd      NAMI  "/emul/svr4/usr/lib/libelf.so.1"
 21750 ldd      NAMI  "/emul/svr4"
 21750 ldd      NAMI  "/emul/svr4/usr/lib/libelf.so.1"
 21750 ldd      RET   open 4
 21750 ldd      CALL  fstat(0x4,0xf7fff05c)
 21750 ldd      RET   fstat 0
 21750 ldd      CALL  mmap(0,0x1000,0x5,0x80000001,0x4,0)
 21750 ldd      RET   mmap 268697600/0x10040000
 21750 ldd      CALL  mmap(0,0x1e000,0x5,0x80000002,0x4,0)
 21750 ldd      RET   mmap 268763136/0x10050000
 21750 ldd      CALL  munmap(0x1005d000,0xf000)
 21750 ldd      RET   munmap 0
 21750 ldd      CALL  mmap(0x1006c000,0x110c,0x7,0x80000012,0x4,0xc000)
 21750 ldd      RET   mmap 268877824/0x1006c000
 21750 ldd      CALL  close(0x4)
 21750 ldd      RET   close 0
 21750 ldd      CALL  open(0x10025218,0,0x1002566c)
 21750 ldd      NAMI  "/emul/svr4/usr/lib/libc.so.1"
 21750 ldd      NAMI  "/emul/svr4"
 21750 ldd      NAMI  "/emul/svr4/usr/lib/libc.so.1"
 21750 ldd      RET   open 4
 21750 ldd      CALL  fstat(0x4,0xf7fff05c)
 21750 ldd      RET   fstat 0
 21750 ldd      CALL  mmap(0x10040000,0x1000,0x5,0x80000011,0x4,0)
 21750 ldd      RET   mmap 268697600/0x10040000
 21750 ldd      CALL  mmap(0,0x97000,0x5,0x80000002,0x4,0)
 21750 ldd      RET   mmap 268894208/0x10070000
 21750 ldd      CALL  munmap(0x100ee000,0xf000)
 21750 ldd      RET   munmap 0
 21750 ldd      CALL  mmap(0x100fd000,0x7060,0x7,0x80000012,0x4,0x7d000)
 21750 ldd      RET   mmap 269471744/0x100fd000
 21750 ldd      CALL  mmap(0x10105000,0x12b8,0x7,0x80000012,0x3,0)
 21750 ldd      RET   mmap 269504512/0x10105000
 21750 ldd      CALL  close(0x4)
 21750 ldd      RET   close 0
 21750 ldd      CALL  open(0x10025218,0,0x1002566c)
 21750 ldd      NAMI  "/emul/svr4/usr/lib/libdl.so.1"
 21750 ldd      NAMI  "/emul/svr4"
 21750 ldd      NAMI  "/emul/svr4/usr/lib/libdl.so.1"
 21750 ldd      RET   open 4
 21750 ldd      CALL  fstat(0x4,0xf7fff05c)
 21750 ldd      RET   fstat 0
 21750 ldd      CALL  mmap(0x10040000,0x1000,0x5,0x80000011,0x4,0)
 21750 ldd      RET   mmap 268697600/0x10040000
 21750 ldd      CALL  close(0x4)
 21750 ldd      RET   close 0
 21750 ldd      CALL  systeminfo(0x201,0x10025bcc,0x101)
 21750 ldd      RET   systeminfo 0
 21750 ldd      CALL  open(0x10025ce0,0,0xffffffff)
 21750 ldd      NAMI  "/emul/svr4/usr/platform/W8601/8701 or MB86903 @ 40 MHz, on-chip FPU/lib/libc_psr.so.1"
 21750 ldd      NAMI  "/usr/platform/W8601/8701 or MB86903 @ 40 MHz, on-chip FPU/lib/libc_psr.so.1"
 21750 ldd      RET   open -1 errno 2 I can't find it
 21750 ldd      CALL  close(0x3)
 21750 ldd      RET   close 0
 21750 ldd      CALL  break(0x21e78)
 21750 ldd      RET   break 0
 21750 ldd      CALL  break(0x23e78)
 21750 ldd      RET   break 0
 21750 ldd      CALL  open(0xf7fff4e7,0,0x1)
 21750 ldd      NAMI  "/emul/svr4/usr/lib/X11/netscape/netscape.d301g"
 21750 ldd      NAMI  "/usr/lib/X11/netscape/netscape.d301g"
 21750 ldd      RET   open 3
 21750 ldd      CALL  lseek(0x3,0,0x2)
 21750 ldd      RET   lseek 131328/0x20100
 21750 ldd      CALL  mmap(0,0x20100,0x1,0x80000002,0x3,0)
 21750 ldd      RET   mmap 269549568/0x10110000
 21750 ldd      CALL  write(0x2,0xf7fff4d0,0x16)
 21750 ldd      GIO   fd 2 wrote 22 bytes
       "/emul/svr4/usr/bin/ldd"
 21750 ldd      RET   write 22/0x16
 21750 ldd      CALL  write(0x2,0x10102e64,0x2)
 21750 ldd      GIO   fd 2 wrote 2 bytes
       ": "
 21750 ldd      RET   write 2
 21750 ldd      CALL  write(0x2,0xf7fff4e7,0x24)
 21750 ldd      GIO   fd 2 wrote 36 bytes
       "/usr/lib/X11/netscape/netscape.d301g"
 21750 ldd      RET   write 36/0x24
 21750 ldd      CALL  write(0x2,0x11886,0x18)
 21750 ldd      GIO   fd 2 wrote 24 bytes
       ": can't read ELF header
       "
 21750 ldd      RET   write 24/0x18
 21750 ldd      CALL  munmap(0x10110000,0x20100)
 21750 ldd      RET   munmap 0
 21750 ldd      CALL  close(0x3)
 21750 ldd      RET   close 0
 21750 ldd      CALL  lseek(0,0,0x1)
 21750 ldd      RET   lseek 590/0x24e
 21750 ldd      CALL  exit(0x1)

Running ktrace on netscape.d301g itself produces:
 21818 ktrace   RET   ktrace 0
 21818 ktrace   CALL  execve(0xf7fff56f,0xf7fff488,0xf7fff490)
 21818 ktrace   NAMI  "/usr/lib/X11/netscape/netscape.d301g"
 21818 ktrace   NAMI  "/emul/svr4/usr/lib/ld.so.1"
 21818 ktrace   NAMI  "/emul/svr4"
 21818 ktrace   NAMI  "/emul/svr4/usr/lib/ld.so.1"

If not ktraced, it dies with SIGABRT.

Any clues?  What am I doing wrong?

Any more information needed?

The libs in /emul/svr4/usr/lib are Solaris 2.5.1 vintage:
-rwxr-xr-x  1 root  wheel   24576 May  5 23:04 ld.so
-rwxr-xr-x  1 root  wheel  106768 May  5 23:24 ld.so.1
-rwxr-xr-x  1 bin   bin    664048 Oct 27  1995 libc.so.1
-rwxr-xr-x  1 bin   bin      2568 Oct 25  1995 libdl.so.1
-rw-r--r--  1 root  wheel   66644 May  5 23:29 libelf.so.1
-rwxr-xr-x  1 bin   bin     15304 Oct 25  1995 libintl.so.1
-rwxr-xr-x  1 bin   bin    110820 Aug 17  1995 libm.so.1
-rwxr-xr-x  1 bin   bin     15720 Oct 25  1995 libmp.so.1
-rwxr-xr-x  1 bin   bin    565500 Oct 25  1995 libnsl.so.1
-rwxr-xr-x  1 bin   bin     34652 Oct 25  1995 libresolv.so.1
-rwxr-xr-x  1 bin   bin     68780 Oct 25  1995 libsocket.so.1
-rwxr-xr-x  1 bin   bin     39340 Oct 25  1995 libw.so.1

...and they work, of course, just fine on the slowaris box.  The problem
is...well, have you ever tried to remote-display something thru PPP?

It's.

Amazingly.

Slow.

It makes thorazine look like a stimulant.

Any further questions?

[Can't do BSDI 'cos I don't have their libs; can't do FreeBSD
'caus they don't support SPARC.  Linux hardly seems like an option...]

Any help at all is appreciated.




				--*greywolf;