开发者

GCC ABI compatibility

开发者 https://www.devze.com 2022-12-29 14:32 出处:网络
As far as I\'ve understood, it is not possible to link libraries that use different versions of GCC\'s Application Binary Interface (ABI). Are there ABI changes to every version of GCC? Is it possible

As far as I've understood, it is not possible to link libraries that use different versions of GCC's Application Binary Interface (ABI). Are there ABI changes to every version of GCC? Is it possible to开发者_Python百科 link a library built with 4.3.1 if I use, say, GCC 4.3.2? Is there a matrix of some sort that lists all the ways I can combine GCC versions?


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


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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消