What determines an OS's executable type?

view story

http://stackoverflow.com – What determines the type of executable file (i.e. PE, ELF, Mach-O, etc) an operating system can run? Is it the system's kernel? Essentially I would like to compile an (x64) program to run on several linux distros but considering they all run the same kernel, I assume this means cross-compiling is unnecessary. Looking at Windows and OS X, they are (obviously) capable of running executables built on different software versions (PPC excepted), but I am unsure if this is purely a kernel-space consideration or whether there are additional layers on top which determine the OS's executable format. (HowTos)