混合两个具有不同优化级别的静态库是否可行? [英] Is it viable to mix two static libraries with different optimization levels?

查看:46
本文介绍了混合两个具有不同优化级别的静态库是否可行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个名为libx.aliby.a的静态库.

I have two static libraries named libx.a and liby.a.

libx.agcc -g编译;而liby.a是用gcc -O3编译的.

libx.a is compiled with gcc -g; while liby.a is compiled with gcc -O3.

我想将它们两个链接成一个可执行文件.

I want to link them two into a single executable.

可行吗?

有害吗?

推荐答案

是的,它是可行的,只要优化不更改ABI(函数调用或浮点算术/代表权等).尽管即使在这种情况下,我相信所有必需的信息都已被编译或链接器解决了问题.

Yes, it is viable, it isn't harmful as long as the optimizations don't change the ABI (of function calls, or of floating point arithmetic/representation, etc.). Although even in those cases, I believe all necessary information is already compiled in or the linker resolves the issues.

这篇关于混合两个具有不同优化级别的静态库是否可行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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