GCC ABI compatibility

微笑、不失礼 提交于 2019-11-27 06:49:40
ablaeul

The official ABI page points to an ABIcheck. This tool may do, what you want.

Since gcc-3.4.0, the ABI is forward compatible. I.E. a library made using an older release can be linked with a newer one and it should work (the reverse doesn't). Obviously, there could be bugs, but there is only one mentionned in the documentation: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33678

Ugh, yikes.
How can you tell which gcc compiled a given binary? Here is the death notice from gcc-4.7.2-1-mingw32.README.txt :

Binary incompatibility notice!

The C and C++ ABI changed in GCC 4.7.0, which means in general you can't link together binaries compiled with this version of the compiler and with versions before GCC 4.7.0. In particular:

  • The option -mms-bitfields is enabled by default, which means the bitfield layout follows the convention of the Microsoft compiler.

  • C++ class-member functions now follow the __thiscall calling convention.

  • The compiler now assumes that the caller pops the stack for the implicit arguments pointing to an aggregate return value. This affects functions returning structs by value, like the complex math type.

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