开发者

Compiling a fat executable with gcc

开发者 https://www.devze.com 2023-01-16 21:13 出处:网络
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

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?


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.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消