Click to See Complete Forum and Search --> : How to run COFF executable in current distro?


TimSNL
01-27-2005, 07:18 PM
Hello, I hope someone can help me with this.

I am trying to get an old unix program running on a ubuntu PC. The output from the file command says, "80386 COFF executable". When I try and run the program I get the message, "cannot execute binary file".

I have had this program runnung on RH 6.1 and RH 7.0 with the help of iBCS but now I am having a hard time getting it to run on ubuntu (2.6.8.1-3-386) or suse 9.1 (2.6.4-52-default) or RH 9.0. I understand that this compatibility should be handeled by ABI and this program should be able to run on all these distros but it does not sem to be working out of the box.

Anyone know how to get this working? I need to get this old application running on a current linux distro, please help with some ideas on this.

bsm2001
01-27-2005, 07:36 PM
http://www.google.com/search?lr=&ie=UTF-8&oe=UTF-8&q=COFF

http://www.delorie.com/djgpp/doc/coff/

TimSNL
01-27-2005, 07:50 PM
Thankyou for the information, I understand what the COFF file is. I just need some help to get it runnung in a current distro, I have not been able to find that via google, can you?

bwkaz
01-28-2005, 07:35 PM
You would probably need a binfmt (binary format) driver for it in the kernel. Standard kernels come with binfmt_elf, binfmt_aout, and binfmt_misc (for ELF, a.out, and misc. binaries). I don't think I've ever seen a COFF binfmt driver for Linux.

Were these programs originally compiled on Linux? Because if not, it's highly unlikely that they'll work even if you can find a binfmt_coff driver. The system call interface is totally different between various Unix variants, for one. And even if the system call interface was the same (or the program relied on libc for all of its syscalls, like most well-behaved programs do), the rest of the userspace ABI is very likely different. For example, userspace cannot use the %fs segment register when running under modern Linuxes, because the threading library uses that register to do thread-local storage. %ebx, the second general purpose register, is also reserved for the system IIRC (for program relocations, I think).

The Linux version of gcc knows these rules, but whatever compiler was used for these programs very likely doesn't (or knows different rules). If that's the case, then even if you do get a binfmt_coff driver, the programs will very likely segfault almost immediately.