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.

Global objects constructor table

 

Hi,

I want to have a some global object constructor executed only on a specific core on the multi-core C6678.

It is possible to instruct the compiler to put a global object constructor call onto a specific table instead of the single table placed in the ".init_array"?

I know how to place object in a specific section and say to the linker to generate a separate initialization table (and my boot code have to explicit call copy_tbl() on the separate table)  but this work only with the zero initialized object and with initialized POD data: if the global object have a constructor, the call to it is placed in the single constructor list and I don't know how to discriminate.

I don't use MAD.

CGT: 7.3

 

 

  • There is no simple and clean way to have an object constructed on a particular core.  I've never seen it done.  But I think I know how it could work.  It would involve defining the global object in a source file of its own, a bit of work in the link command file, and a bit more work customizing the compiler boot routine c_int00.  I could flesh out this idea.  But I cannot give you a full implementation guaranteed to work.  Are you interested?

    Thanks and regards,

    -George

     

  • Georgem said:

    There is no simple and clean way to have an object constructed on a particular core.  I've never seen it done.  But I think I know how it could work.  It would involve defining the global object in a source file of its own, a bit of work in the link command file, and a bit more work customizing the compiler boot routine c_int00.  I could flesh out this idea.  But I cannot give you a full implementation guaranteed to work.  Are you interested?

    Thanks and regards,

    -George

     

     

    I have consider the possibility of doing this via linker file, but this requires to add to the linker command file a directive specific to every .obj involved and also I must be sure that a single .obj have only "common" or only "private" global constructors (cannot mix). I would like to have the linker file application independent, but If there aren't other solution, I'll consider to explore this one.

     

  • Your understanding of this situation is sound.  I agree this is not an easy solution.  But it is the only one I think we have right now.

    Thanks and regards,

    -George