Keil Logo

Compatibility of C++ objects

4.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:

construct.cpp:
				
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;
}

If you build this example with the Arm Compiler 5 compiler, armcc, and link with the Arm Compiler 6 linker, armlink, using:

armcc -c construct.cpp -Ospace -O1 --cpu=cortex-a9
armlink construct.o -o construct.axf

the linker reports:

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.
Non-ConfidentialPDF file icon PDF version100068_0613_00_en
Copyright © 2014–2019 Arm Limited or its affiliates. All rights reserved. 
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.