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.

.clink under ELF EABI model in TI ARM Code Generation Tools

Hello,

we are using the TI ARM Code Generation Tools v5.1.1 for a TMS570.

We are developing a software library where functions shall only be linked if they are really used by the application image.

Therefore we are using the "--gen_func_subsections" Compiler Option in combination with the EABI model.

Additionally. we need to conditionally link our interrupt service routines, defined by the "interrupt" keyword. Looking to the documentation of the "--gen_func_subsections"  option (spnu151i.pdf, page 73) tell us that generally the .clink directive is not placed for interrupt service routines.

But this could be done with the "CLINK" pragma.

Anyway, in the documentation (spnu118l.pdf) for the .clink directive (page 100) there is stated that this  directive is useless in cobination with the EABI model.

In our point of view the .clink is not useless with EABI, it is still applicable for interrupt service routines.

Is this correct?

Is there another method to enable conditionally linking for interrupts?

  • This edit added much later ... Please ignore this post.  It turns out to be incorrect in many respects.

    Under EABI, every section is subject to the effect of the .clink directive, by default.  That's why .clink is useless under EABI.

    Stefan Steinmann said:
    Is there another method to enable conditionally linking for interrupts?

    If you do nothing but build with EABI, then your interrupts are subject to conditional linking.  To keep one, or more, interrupt routines, use #pragma RETAIN.  Read about it in the ARM compiler manual.  Consider making the pragma subject to a preprocessing check like this ...

    #ifdef KEEP_ISR0
    #pragma RETAIN(isr0);
    #endif
    

    Thanks and regards,

    -George

  • Stefan Steinmann said:

    In our point of view the .clink is not useless with EABI, it is still applicable for interrupt service routines.

    Is this correct?

    You are correct.  In EABI builds, interrupts and the interrupt vector table which refers to them is kept in the link, and this occurs by default.  If you use #pragma CLINK on the interrupt, this behavior is disabled, and the interrupt and related interrupt vector table is subject to conditional removal.

    Thanks and regards,

    -George