This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

cl6x compiler generating different objects for same code when run on different PCs



First of all using an old compiler 6.0.23,  reason for this is to long to describe.

The objects for some files are generating symbols that differ from machine to machine.  The difference is only in the 8 digit value found after the filename on ___sti___ lines as highlighted in yellow below.   What is this value and is there a way we can get it to be the same from one machine to another? 

TEXT Section .text:___sti___21_NavDataAirwayList_cpp_a99afc35 (Little Endian), 0x40 bytes at 0x0
00000000             .text:___sti___21_NavDataAirwayList_cpp_a99afc35:
00000000             ___sti___21_NavDataAirwayList_cpp_a99afc35:
00000000   0300002a           MVK.S2        0x0000,B6
00000004   0300006b           MVKH.S2       0x0000,B6
00000008   02000029 ||        MVK.S1        0x0000,A4
0000000c       0627 ||        MVK.L2        0,B4
0000000e       3223           SET.S2        B4,17,17,B4
00000010       8332 ||        MVK.S1        36,A6
00000012       31f7           STW.D2T2      B3,*B15--[2]
00000014   10000013 ||        CALLP.S2      ___sti___21_NavDataAirwayList_cpp_a99afc35 (PC+0 = 0x00000000),B3
00000018   02000068 ||        MVKH.S1       0x0000,A4
0000001c   e3000280           .fphead       n, l, W, BU, nobr, nosat, 0011000
00000020   0ffffc10           B.S1          ___sti___21_NavDataAirwayList_cpp_a99afc35 (PC-32 = 0x00000000)
00000024       71f7           LDW.D2T2      *++B15[2],B3
00000026       0627           MVK.L2        0,B4
00000028   0300002a           MVK.S2        0x0000,B6
0000002c   02000029           MVK.S1        0x0000,A4
00000030       3223 ||        SET.S2        B4,17,17,B4
00000032       0f26           MVK.L1        8,A6
00000034   0300006b ||        MVKH.S2       0x0000,B6
00000038   02000068 ||        MVKH.S1       0x0000,A4
0000003c   e2400200           .fphead       n, l, W, BU, nobr, nosat, 0010010

  • Short answer: as a workaround, define an external initialized variable (int a = 0;) or define an external function (void foo(){}) somewhere in the file. 

    Long answer: the compiler generates an external function whose name is of the form "__sti__module_id" to call any constructors for static or global objects in the file. This function is placed in the .init_array (or .pinit for the COFF ABI) table to be run at program startup before main() is called. The compiler must synthesize the "module_id"  in the name of the __sti__ function such that the name is unique across compilation units. The first component of the module id is the name of the source file ("NavDataAirwayList_cpp") in your example. But since source file names are not guaranteed to be unique, the compiler also includes the name of the first global definition in the file, which by nature must be unique across the program. However if there is no such definition in the file, as appears to be the case in your example, the compiler uses the timestamp on the source file, which could obviously differ between machines. It's fairly rare to have a source file with no external definitions, so the timestamp form is seldom used. Fortunately there is a simple workaround, which is to include a dummy external definition somewhere.