发行版之间的可执行二进制文件之间有什么区别吗? [英] Is there any difference between executable binary files between distributions?

查看:144
本文介绍了发行版之间的可执行二进制文件之间有什么区别吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于所有Linux发行版都使用相同的内核,因此它们的可执行二进制文件之间有什么区别吗?

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

如果是,主要区别是什么?还是那意味着我们可以构建一个通用的Linux可执行文件?

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

推荐答案

所有Linux发行版都使用相同的二进制格式ELF,但是仍然存在一些差异:

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

  1. 不同的cpu架构使用不同的指令集.
  2. 同一CPU架构可能使用不同的ABI,ABI定义了如何使用寄存器文件,如何调用/返回例程.不同的ABI不能一起工作.
  3. 即使在同一拱门,同一ABI上,这也不意味着我们可以将发行版中的一个二进制文件复制到另一个文件中.由于大多数二进制文件不是静态链接的,因此它们取决于发行版下的库,这意味着不同的发行版可能使用不同的版本或库的不同编译配置.

因此,如果您希望程序在所有发行版上运行,则可能必须静态链接仅依赖于内核syscall的版本,即使这样您也只能运行指定的arch.

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.

如果您真的想在任何Arch上运行程序,则必须编译所有Arch的二进制文件,并使用Shell脚本启动正确的二进制文件.

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.

这篇关于发行版之间的可执行二进制文件之间有什么区别吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆