GCC ABI compatibility

后端 未结 3 2001
無奈伤痛
無奈伤痛 2020-11-29 01:26

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 ver

相关标签:
3条回答
  • 2020-11-29 01:36

    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

    0 讨论(0)
  • 2020-11-29 01:59

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

    0 讨论(0)
  • 2020-11-29 02:01

    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 讨论(0)
提交回复
热议问题