3.7 Compatibility of C++ objects

The compatibility of C++ objects compiled with ARM® Compiler 5 depends on the C++ libraries used.

Compatibility with objects compiled using Rogue Wave standard library headers

ARM Compiler 6 does not support binary compatibility with objects compiled using the Rogue Wave standard library include files.
There are warnings at link time when objects are mixed. L6869W is reported if an object requests the Rogue Wave standard library. L6870W is reported when using an object that is compiled with ARM Compiler 5 with exceptions support.
The impact of mixing objects that have been compiled against different C++ standard library headers might include:
  • Undefined symbol errors.
  • Increased code size.
  • Possible runtime errors.
If you have ARM Compiler 6 objects that have been compiled with the legacy -stdlib=legacy_cpplib option then these objects use the Rogue Wave standard library and therefore might be incompatible with objects created using ARM Compiler 6.4 or later. To resolve these issues, you must recompile all object files with ARM Compiler 6.4 or later.

Compatibility with C++ objects compiled using ARM Compiler 5

The choice of C++ libraries at link time must match the choice of C++ include files at compile time for all input objects. ARM Compiler 5 objects that use the Rogue Wave C++ libraries are not compatible with ARM Compiler 6 objects. ARM Compiler 5 objects that use C++ but do not make use of the Rogue Wave header files can be compatible with ARM Compiler 6 objects that use libc++ but this is not guaranteed.
ARM recommends using ARM Compiler 6 for building the object files.

Compatibility of arrays of objects compiled using ARM Compiler 5

ARM Compiler 6 is not compatible with objects from ARM Compiler 5 that use operator new[] and delete[]. Undefined symbol errors result at link time because ARM Compiler 6 does not provide the helper functions that ARM Compiler 5 depends on. For example:
class Foo
{
public:
    Foo() : x_(new int) { *x_ = 0; }
    void setX(int x) { *x_ = x; }
    ~Foo() { delete x_; }
private:
    int* x_;        
};

void func(void)
{
    Foo* array;
    array = new Foo [10]; 
    array[0].setX(1);
    delete[] array;
}
Compiling this with ARM Compiler 5 compiler, armcc, and linking with ARM Compiler 6 linker, armlink, generates linker errors.
armcc -c construct.cpp -Ospace -O1 --cpu=cortex-a9
armlink construct.o -o construct.axf
This generates the following linker errors:
Error: L6218E: Undefined symbol __aeabi_vec_delete (referred from construct.o).
Error: L6218E: Undefined symbol __aeabi_vec_new_cookie_nodtor (referred from construct.o).
To resolve these linker errors, you must use the ARM Compiler 6 compiler, armclang, to compile all C++ files that use the new[] and delete[] operators.

Note

You do not have to specify --stdlib=libc++ for armlink, because this is the default and only option in ARM Compiler 6.4, and later.
Related information
armlink User Guide: --stdlib
Non-ConfidentialPDF file icon PDF versionARM DUI0742F
Copyright © 2014-2016 ARM. All rights reserved.