Tool/software: TI C/C++ Compiler
We are seeing a potential issue with C66 CGTv8.1.3 and incremental linking
Attached are some files to reproduce the issue. In the files, there is a diagram presented which shows the intended flow.
Each of the files contains an object with a global constructor:
Main.cpp – object of type MainFile
libFile01.cpp – object of type LibFile01
libFile02.cpp – object of type LibFile02 (the object is instantiated with pragma RETAIN).
Only constructors for objects: MainFile and LibFile02 are executed.
1. To reproduce, please use attached source files and batch program compile2.bat to build the program. Please set path to includes in the compile2.bat file.
2. For gcc compiler (on x86 and A15) the constructor for object LibFile01 is called – batch file compile2_gcc.bat is used to build a program for PC.
3. It is likely that the pragma RETAIN could help, however issue is working with 3rd party code, which we cannot change even for one line.
4. If you compile all files and link them in one step, then all global constructors are called – batch file compile1.bat
5. A similar issue was reported here http://e2e.ti.com/support/development_tools/compiler/f/343/p/202214/721867 and was reported to be solved.2017.11.13_C66_Incremental_Link.zip