On Wed, 2008-04-02 at 17:30 -0700, Joe Buck wrote:
> On Wed, Apr 02, 2008 at 05:16:23PM -0700, Xiaoxiang Liu wrote:
> > I have a question regarding GCC4 version compatibility? In general,
> > should two versions with same major version number be compatible?
> > Specifically, I want to confirm whether a C++ library built with gcc
> > 4.1.X will link correctly using gcc 4.2.2?
> 
> For C++, you need the first two numbers to match.  So, 4.1.x with 4.1.y
> should work, 4.1.x with 4.2.y probably not.

This is a complex issue, but two versions of G++ produce libraries
that are binary compatible if both versions of the compiler follow
the same ABI and use compatible versions of libstdc++.  By ABI I
mean both the Application Binary Interface for the target and the
multi-vendor C++ ABI.  Changes to both ABIs are documented in GCC
release notes, such as http://gcc.gnu.org/gcc-4.2/changes.html .

For more information see

  ABI Policy and Guidelines, The GNU C++ Library Documentation
  http://gcc.gnu.org/onlinedocs/libstdc++/abi.html

  Binary Compatibility, GCC Manual
  http://gcc.gnu.org/onlinedocs/gcc/Compatibility.html

Changes within x.y.* are compatible, changes within x.* are
compatible if there have been no ABI changes to the compiler
or library.  At least, that's how things should be; as it
says in every GCC source file:

  GCC is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty
  of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  See the GNU General Public License for more details.

Janis

Reply via email to