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.

Linker error - "warning: no matching section" for static inline functions

Hi,

 

I am using the TMS320C6000 C compiler v6.1.16 and compatible set of tools for a large DSP project. I get several linker warnings such as the one below, predominantly for inline functions, but also for some regular functions declared as static:

warning: no matching section

Any insight into why this is occuring and how it could be fixed would be much appreciated.

Regards,
Sandip

 

  • Sandip,

    I will forward your question to the compiler forum, so you can get better answers there, but upfront I have some comments.

    The error message looks incomplete, is that so?

    The code is allocated in memory using what we call memory sections that are defined in the linker command file (extension .CMD).

    These warnings typically happen in two cases:

    - Your linker command file does not specify all the required default memory sections to place code or data;

    - Some pieces of your code explicitly define custom sections where they will be placed (by using pragmas CODE_SECTION or DATA_SECTION) but there is no correlated section defined in the linker command file.

    In this case you can simply define your sections in the linker command file.

    Hope this helps,

    Rafael

  • Sandip Gangakhedkar said:
    warning: no matching section

    This message is always accompanied by the link command file name and line number.  Here is an example line that gets this message ...

       always_empty { *(no_sections_have_this_name) } > RAM

    The linker is saying that no object module contains an input section with the name "no_sections_have_this_name".  This means an output section named "always_empty" is created, but has no contents.  Even though empty sections are allowed, it is unlikely that this is the result you want.

    Thanks and regards,

    -George 

  • It just occurred to me that you are experiencing this problem when attempting to place inline functions in a particular section.  Well, when a function is successfully inlined at every place it is called, then the compiler does not produce a call-able version of the function.  Thus, no section exists which contains the code for the function.  Here is my guess at what you are doing.  For one thing, you are building with the option --gen_func_subsections (or the equivalent -mo) so every function gets placed in its own section named .text:_name_of_function.  Then, in your link command file, you have something like ...

        always_empty { *(.text:_fxn_always_inlined) } > RAM

    In this example, fxn_always_inlined is inlined at every place it is called, thus the compiler does not generate a standalone, call-able, version of it.  If this describes your case, feel free to ignore the linker warning.  In fact, you could view it as positive feedback that the compiler inlined the function successfully.

    Thanks and regards,

    -George

  • Hi George,

    You are correct. I checked the build options to find that  every source file is compiled with the -mo option. Now it makes sense.

    Thanks a lot for your analysis - its great to have an active community around to help in such matters.

    Regards,
    Sandip