NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

kern/52247: Problem with running NetBSD/i386 1.0 programs on NetBSD/amd64 7.99.72



>Number:         52247
>Category:       kern
>Synopsis:       Problem with running NetBSD/i386 1.0 programs on NetBSD/amd64 7.99.72
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat May 20 01:25:00 +0000 2017
>Originator:     Kamil Rytarowski
>Release:        NetBSD 7.99.72 amd64
>Organization:
TNF
>Environment:
NetBSD compaq 7.99.72 NetBSD 7.99.72 (GENERIC) #31: Fri May 19 18:58:50 CEST 2017  root@chieftec:/public/netbsd-root/sys/arch/amd64/compile/GENERIC amd64
>Description:
I'm attempting to run dynamic executables a.out format files from NetBSD/i386 1.0 on recent NetBSD/amd64.

My goal is to use through netbsd32 compat layer gcc/gas/gnuld/etc from NetBSD 1.0. (I need it to bootstrap easily old project from NetBSD 0.9 attempting to run a.out toolchain).

I downloaded NetBSD 1.0 sets, unpacked to /emul/netbsd32, copied libraries (usr/lib) to /emul/aout/usr/lib (and a copy to /emul/aout, /emul/aout/lib...).

I failed so far to convince dynamic linker to find appropriate libraries:

$ /emul/netbsd32/usr/bin/machine
ld.so: machine: libc.so.12.0: No such file or directory

I tried to run /emul/netbsd32/sbin/ldconfig but it does not help afterwards.

ktruss from ldconfig:
$ ktruss /emul/netbsd32/sbin/ldconfig 
 14395      1 ktruss   fcntl(0x4, 0x3, 0)          = 4194305
 14395      1 ktruss   emul(netbsd)
 14395      1 ktruss   fcntl(0x4, 0x4, 0x400001)   = 0
 14395      1 ldconfig execve("/emul/netbsd32/sbin/ldconfig", 0x7f7fff24afc0, 0x7f7fff24afd0) JUSTRETURN
 14395      1 ldconfig emul(netbsd32)
 14395      1 ldconfig netbsd32___sysctl(0xffffffffffffeca8, 0x2, 0xffffffffffffecb4, 0xffffffffffffecb0, 0, 0) = 0
 14395      1 ldconfig netbsd32_break(0xce34)      = 0
 14395      1 ldconfig netbsd32_break(0xcffc)      = 0
 14395      1 ldconfig netbsd32_break(0xdffc)      = 0
 14395      1 ldconfig netbsd32_break(0xeffc)      = 0
 14395      1 ldconfig netbsd32_break(0xfffc)      = 0
 14395      1 ldconfig netbsd32_open("/emul/netbsd32/usr/lib", 0, 0) = 3
 14395      1 ldconfig compat_12_netbsd32_fstat12(0x3, 0xffffffffffffe458) = 0
 14395      1 ldconfig netbsd32_fcntl(0x3, 0x2, 0x1) = 0
 14395      1 ldconfig netbsd32_break(0x11ffc)     = 0
 14395      1 ldconfig compat_12_netbsd32_getdirentries(0x3, 0x10000, 0x1000, 0xf034) = 1644
 14395      1 ldconfig netbsd32_break(0x12ffc)     = 0
 14395      1 ldconfig compat_12_netbsd32_getdirentries(0x3, 0x10000, 0x1000, 0xf034) = 0
 14395      1 ldconfig netbsd32_open("/emul/netbsd32/usr/X386/lib", 0, 0x1) Err#2 ENOENT
 14395      1 ldconfig netbsd32_break(0x13ffc)     = 0
 14395      1 ldconfig netbsd32_open("/emul/netbsd32/var/run/ld.so.hints+", 0x602, 0x124) = 4
 14395      1 ldconfig netbsd32_write(0x4, 0xffffffffffffece4, 0x1c) = 28
       "iHDL\^A\0\0\0\^\\0\0\0\^O\0\0\0\M-l\^B\0\0\^Y\^B\0\0\^E\^E\0\0"
 14395      1 ldconfig netbsd32_write(0x4, 0x13000, 0x2d0) = 720
       "\M^U\0\0\0\M^Z\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\^A\0\0\0\M-X\0\0\0\M-]\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
 14395      1 ldconfig netbsd32_write(0x4, 0x13400, 0x219) = 537
       "curses\0/usr/lib/libcurses.so.2.1.a\M^V\M^@9!a\0c\0/usr/lib/libc.so.12.0.2.1:!a\0crypt\0/usr/lib/libcrypt.so.0.01>!a\0gnumalloc\0/usr/lib/libgnumalloc.so.0.0\M^@<!a\0edit\0/usr/li"
 14395      1 ldconfig netbsd32_close(0x4)         = 0
 14395      1 ldconfig netbsd32_unlink("/emul/netbsd32/var/run/ld.so.hints") = 0
 14395      1 ldconfig netbsd32_rename("/emul/netbsd32/var/run/ld.so.hints+", "/emul/netbsd32/var/run/ld.so.hints") = 0
 14395      1 ldconfig netbsd32_exit(0xffffffffffffffff)

.....

After struggling I managed to start "machine" with renaming libc: cp -- libc.so.12.0 libc.so.12.0.2.1:!a

I noted that resolution of file/dir names is slightly broken in these binaries.

Example:

compaq$ sudo chroot /emul/netbsd32/ /bin/sh                                                                                                                                                  
# ls
..&#65533;     .m      altroot&#65533;binr    devn    etcn    homeo   mntn    rootd   sbino   stando  sys&#65533;    tmpt    usr&#65533;    var


I think there are few problems:
 - filename/dirname resolution with trailing trash
 - a.out libraries shall be in /emul/aout not /emul/netbsd32 according to the documentation
>How-To-Repeat:
1. Fetch NetBSD 1.0 sets.
2. Untarball them to /emul/netbsd32
3. Copy libraries to /emul/aout
4. Try to run /emul/netbsd/usr/bin/ programs
>Fix:
N/A



Home | Main Index | Thread Index | Old Index