Is it viable to mix two static libraries with different optimization levels?

扶醉桌前 提交于 2020-01-05 05:49:07

问题


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

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.

Is it viable?

Is it harmful?


回答1:


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.



来源:https://stackoverflow.com/questions/40609727/is-it-viable-to-mix-two-static-libraries-with-different-optimization-levels

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!