Current-Users archive

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

Running NetBSD-i386 images on NetBSD-amd64



I had occassion to try this recently, and it doesn't seem to work:

$ file echo
echo: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for NetBSD 6.99.17, not stripped
$ ldd echo
echo:
        -lgcc_s.1 => /usr/lib/i386/libgcc_s.so.1
        -lc.12 => /usr/lib/i386/libc.so.12
$ ktrace ./echo
/bin/sh: Cannot execute ELF binary ./echo
$ ls -l /usr/lib/i386/libgcc_s.so.1
lrwxrwxr-x  1 root  wheel  15 Oct  7 11:27 /usr/lib/i386/libgcc_s.so.1 -> 
libgcc_s.so.1.0
$ ls -l /usr/lib/i386/libc.so.12
lrwxrwxr-x  1 root  wheel  14 Oct 20 09:15 /usr/lib/i386/libc.so.12 -> 
libc.so.12.185
$

kdump doesn't seem to shed a lot of light on the subject - the relevant portion seems to be at the very end, where it reads 4 bytes from the beginning of the file and compares it with the magic number:

 15312      1 sh       CALL  open(0x7f7ffffffd08,0,0x7f7fffffdad0)
 15312      1 sh       NAMI  "./echo"
 15312      1 sh       RET   open 3
 15312      1 sh       CALL  lseek(3,0,0,0)
 15312      1 sh       RET   lseek 0
 15312      1 sh       CALL  read(3,0x7f7fffffd990,4)
 15312      1 sh       GIO   fd 3 read 4 bytes
       "\^?ELF"
 15312      1 sh       RET   read 4
 15312      1 sh       CALL  write(2,0x7f7ff7b08080,9)
 15312      1 sh       GIO   fd 2 wrote 9 bytes
       "/bin/sh: "
 15312      1 sh       RET   write 9
 15312      1 sh       CALL  write(2,0x7f7ff7b08080,0x20)
 15312      1 sh       GIO   fd 2 wrote 32 bytes
       "Cannot execute ELF binary ./echo"
 15312      1 sh       RET   write 32/0x20
 15312      1 sh       CALL  write(2,0x7f7ff7b08080,1)
 15312      1 sh       GIO   fd 2 wrote 1 bytes
       "\n"
 15312      1 sh       RET   write 1
 15312      1 sh       CALL  exit(2)

(I do have the entire ktrace.out file if anyone would like to see it.)


It looks to me like the magic number is correct:

$ hexdump -C echo | head -4
00000000  7f 45 4c 46 01 01 01 00  00 00 00 00 00 00 00 00  |.ELF............|


I'm sure I must just be doing something stupid here... Does anyone have a clue to offer?

:)



-------------------------------------------------------------------------
| Paul Goyette     | PGP Key fingerprint:     | E-mail addresses:       |
| Customer Service | FA29 0E3B 35AF E8AE 6651 | paul at whooppee.com    |
| Network Engineer | 0786 F758 55DE 53BA 7731 | pgoyette at juniper.net |
| Kernel Developer |                          | pgoyette at netbsd.org  |
-------------------------------------------------------------------------


Home | Main Index | Thread Index | Old Index