avr-gcc 3.4.0 和 avr-gcc 4.3.x 之间的二进制兼容性
我继承了一个链接到一个库的应用程序,该库可能是用 gcc3 构建的。或者也许使用 imagecraft 编译器。这些信息现在已经消失在天堂般的位字段中,我留下了一个 libXXX.a 库来链接我的应用程序。我无法重新编译 libXXX.a,因为它需要来自 imagecraft 和其他地方的某些未知标头,这些标头在某个时刻可能在我的环境中无处不在,但现在无处可寻。
我的问题是这样的,假设我使用 avr-gcc 版本 3.4.0 编译我的应用程序(并链接到该“特殊”libXXX)生成了一个工作二进制映像,那么是否可以合理地期望我可以编译我的应用程序与 avr-gcc 4 (这个操作有一些非常好的和经过验证的好处),与 libXXX 链接并且仍然得到一个工作程序?
本质上,这一切都归结为:avr-gcc 二进制文件是否与“神秘的编译器 X 兼容,它可能只是 avr-gcc 3.something”?
老实说,我已经使用 avr-gcc4 成功编译了应用程序的其余部分并将其与库链接,并验证了结果是否有效,但是我应该注意哪些副作用或怪癖?
I have inherited an application that links to a library which MAY HAVE been built with gcc3. Or maybe with the imagecraft compiler. That information has now vanished to the heavenly bitfield and I am left with a libXXX.a library against which to link my app. I cannot recompile the libXXX.a because it requires certain unknown headers from imagecraft and somewhere else which at a certain point may have been ubiquitous in my environment but now are nowhere to be found.
My question is this, provided that my compiling my app with avr-gcc version 3.4.0 (and linking to that "special" libXXX) resulted in a working binary image, is it reasonable to expect that I could compile all the other parts of my app with avr-gcc 4 (this action having some very nice and proven benefits), link with libXXX and still get a working program?
Essentially, it all boils down to: is avr-gcc binary compatible with "mysterious compiler X which just may have been avr-gcc 3.something"?
To be honest, I have successfully compiled the rest of my app with avr-gcc4 and linked it with the library, and verified that the result works, but what kind of side effects or quirks should I be on the lookout for?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果两个编译器使用相同的 ABI(应用程序二进制接口),则来自不同编译器(或版本)的链接库将可靠地工作。
特定平台的 ABI 通常由该平台的主导编译器指定,但这可以通过引用外部规格。
ABI 更改很少见,尤其是在平台支持第三方库/应用程序的情况下,因为 ABI 更改意味着实际上所有内容都必须重新构建。
Linking libraries from different compilers (or -versions) will work reliably if both compilers use the same ABI (Application Binary Interface)
The ABI of a specific platform is typically specified by the dominant compiler for that platform, but that could be done by referencing an external specification.
ABI changes are rare, especially if the platform supports third-party libraries/applications, because an ABI change means that literally everything has to be rebuilt.