views:

51

answers:

2

This is not essential for my programs, but merely out of curiosity. Is it possible to, preferably using gcc, compile a 'fat' binary for Linux including multiple architectures such as combinations of amd64, i386, lpia and powerpc?

+2  A: 

The ELF format for executables that linux uses does not support fat binaries, so there's currently not a reasonable way to do this.

There's an extension to ELF available at http://icculus.org/fatelf/ , to use it you need to patch various parts (linux kernel,binutils,glibc etc.) as these changes are not integrated in the mainline yet.

nos
How would I go about compiling a FatELF? Is there planned FatELF support for the kernel in the future?
Delan Azabani
1. You'd read the docs here http://hg.icculus.org/icculus/fatelf/file/e8010ae51530/docs , note that it is considerable work to pactch/recompile all the parts you need. 2. Noone knows if this will make it into the mainline kernel or not.
nos
The last discussion I saw made it look pretty unlikely that it would be merged into the kernel. And that's likelier to be the *easier* battle, compared to getting it merged in glibc...
caf
+1  A: 

You don't need a fat executable in Linux. Instead, you can write a bash script that will choose and execute the correct binary.

Lie Ryan