是目标文件独立于平台的? [英] Are object files platform independent?

查看:122
本文介绍了是目标文件独立于平台的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能编译在一个平台上,并链接与其他计划?什么是目标文件包含哪些内容?我们能否脱钩的可执行文件生成目标文件?

Is it possible to compile program on one platform and link with other ? What does object file contain ? Can we delink an executable to produce object file ?

推荐答案

没有。在总的目的文件格式可能是相同的,例如ELF,但对象文件的内容会从系统而异。

No. In general object file formats might be the same, e.g. ELF, but the contents of the object files will vary from system to system.

这是目标文件包含的东西,如:

An object file contains stuff like:

Object code that implements the desired functionality
A symbol table that can be used to resolve references
Relocation information to allow the linker to locate the object code in memory
Debugging information

对象code通常不仅处理器特有的,但也操作系统特定如果,例如,它包含系统调用。



编辑:

The object code is usually not only processor specific, but also OS specific if, for example, it contains system calls.


Is it possible to compile program on one platform and link with other ?

当然可以。如果您使用的交叉编译器。这个编译器专门针对一个平台,并产生了与目标平台兼容的对象文件(和程序)。所以,你可以使用X86的Linux系统,例如,使用适当的交叉编译器的PowerPC一个或基于ARM的系统程序。我这样做,这里

这篇关于是目标文件独立于平台的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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