tags:

views:

1156

answers:

4

As all linux distributions use the same linux kernel, is there any difference between their executable binary files?

If yes, what are the main differences? Or does that mean we can build a universal linux executable file?

A: 

Almost all linux program files use the ELF standard.

Martin Beckett
I think you mean ELF
1800 INFORMATION
Thanks - finger trouble!
Martin Beckett
+5  A: 
ephemient
But is that possible to make a universal linux binary?
Mickey Shine
Thanks for your answer
Mickey Shine
+3  A: 

All Linux distributions use the same binary format ELF, but there is still some differences:

  1. different cpu arch use different instruction set.
  2. the same cpu arch may use different ABI, ABI defines how to use the register file, how to call/return a routine. Different ABI can not work together.
  3. Even on same arch, same ABI, this still does not mean we can copy one binary file in a distribution to another. Since most binary files are not statically linked, so they depends on the libraries under the distribution, which means different distribution may use different versions or different compilation configuration of libraries.

So if you want your program to run on all distribution, you may have to statically link a version that depends on the kernel's syscall only, even this you can only run a specified arch.

If you really want to run a program on any arch, then you have to compile binaries for all arches, and use a shell script to start up the right one.

arsane
Nice answer, thank you! It makes more clear about the question
Mickey Shine
A: 

Old Unixes also used COFF format. You may still find executables from times of yore in this format. Linux still has support for it (I don't know if it's compiled in current distros, though).

wazoox
Linux skipped directly from a.out to ELF. A few ports can build the *kernel* image into ECOFF format (MIPS, PowerPC) for compatibility with certain bootloaders, and Alpha may have COFF loading support for compatibility with non-native executables, but I can't find any further traces of it in the modern Linux kernel's sources.
ephemient