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.

Behavior change in linker labels

Previous tools (up to v6.0.2) generate a value for __init_end based on the load address.  v6.1.0 generates a value based on the run addess.  Is this the design intent or is this use undefined when load and run addresses are different?  I can use _cinit_loadstart and _cinit_size to get what I need but I'm wondering if older code is going to fail with the new tools.

.cinit:

{
*(.cinit) /* Autointialization initial values for variables in .bss. */
__init_end=.+1; /* cinit adds one extra 0 at end of cinit records. */
} LOAD = FLASHA, PAGE = 0
RUN = L01SARAM, PAGE = 0
LOAD_START(_cinit_loadstart),
RUN_START(_cinit_runstart),
SIZE(_cinit_size)

  • The C28x assembly language tools book, in the section titled Assigning the SPC to a Symbol, states

    The . symbol refers to the current run address, not the current load address, of the section.

    Thus, if __init_end were ever assigned the load address, that would be a bug.

    Assignments like this are known to have problems.  In the same book see the section titled Why the Dot Operator Does Not Always Work.  Operators such as LOAD_START, RUN_END, etc. are a superior solution.

    I don't understand why you are setting up the .cinit section like this.  If you link with the option --rom_model (-c for short), then the linker sets up the .cinit section exactly as required by the C compiler.  In particular, the extra 0 word is added at the end.  

    Thanks and regards,

    -George

  • Thank you for your reply.  

    The __init_end label was used for a CRC calculation that spans multiple sections.   __init_end=.+1; doesn't allocate space, it just shifts the label by 1 to match what the CRC routine takes.

    I agree that the LOAD_START(), ... operators are superior solutions.  I will change my projects to use the new operators.