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.

Compiler/TMS570LC4357: Problem with linker option --symbol_map

Part Number: TMS570LC4357

Tool/software: TI C/C++ Compiler

Hi,

I am using CCS Version 8.2.0 and I am getting multiple definition issue in  one of the source code implementation.

 

Below example will not show any error when the symbols are assigned with stub function name(i.e. --symbol_map=’Function2=stubFunction2 ' is done in linker option) :

 

However, I am getting the below error on the below sample code with the symbols are assigned with stub function name(i.e. --symbol_map=’Function2=stubFunction2 ').

 

error #10268-D: symbol "Function2" is mapped to symbol "stubFunction2"; mapped symbol cannot have definition and reference in the same file

Same samples are working in GNU compiler suite by enabling ‘allow-multiple-definition’ option.

 

Could you please help me how to resolve this issue or Is there any other option to fix this issue?

Basically, I want to stub the function Function2 in test script(File2.c) and Function2 will be present in source file(File1.c) which is tested. I want to enable the priority of the function linkage with test script file(File2.c).

 

  • Patchaiappan Nallasingam said:
    Same samples are working in GNU compiler suite by enabling ‘allow-multiple-definition’ option.

    Unfortunately, the TI ARM toolchain has no comparable option.

    It is a fundamental limitation of the --symbol_map option that the two symbols (for functions or data variables) named in the option have to be implemented in separate object files.

    Thanks and regards,

    -George

  • Is there any other compiler/linker option is available to resolve this issue?

    Basically, the source code(File1.c) will have the actual function definition(i.e. Function1()) but i want to stub this function(i.e. same function: Function1()) in Test script file(File2.c) and i want to simulate few inputs from this stub function, to test the functionality of other functions.

    Please share your input on the same.

    Thanks and Regards,

    N. Patchaiappan

  • Patchaiappan Nallasingam said:
    Is there any other compiler/linker option is available to resolve this issue?

    Unfortunately, no.

    What is wrong with implementing the stub function in a separate file from the one it replaces?

    Thanks and regards,

    -George

  • I am testing the legacy code and i don't have option to change the code. Earlier, it was tested under GNU compiler option and GNU compiler suite supports the same. I need to find another way for TI Compiler suite.

    Apart from this issue, i am observing another issue as below.

    --------------------------------------------------------------------

    For one of the function, I tried to use the below symbol map in CCS GUI tool/editor with No optimization.

    --symbol_map='Function_1=Function_5'

    This symbol mapping is worked in CCS editor/GUI workspace(i.e. Function5 is invoked wherever the function 'Function_1' is called in the source code).

    I created the compiler and linker option in Makefile rule and used 'omake' command to build the source code. Build is created however, the symbol mapping is not done in the build.

    I cross verified build map file from CCS GUI tool/Editor created one with 'omake' command created map file. Symbol mapping is not done on the build, which is created by 'omake' command.

    But, symbol mapping is done on the build, which is created from CCS GUI tool(workspace)/editor.

    Please help me how to resolve the symbol mapping issue when the build is created from command line using 'omake' command which uses make rule as input file and it compiles & creates the executable for TI ARM compiler suite.

    Thanks and Regards,

    N. Patchaiappan

  • Patchaiappan Nallasingam said:
    how to resolve the symbol mapping issue when the build is created from command line using 'omake' command

    Unfortunately, we have no experience with omake, and are unable to help you with this problem.

    Thanks and regards,

    -George

  • I am not getting any proper direction or solution, to resolve the technical issue.

    Irrespective of using 'omake' command, symbol mapping is not working when the source code is compiled and linked using TI ARM compiler suite version 18.1.1 from windows command prompt.

    Could you please experiment and share the correct solution?

    Thanks and Regards,

    N. Patchaiappan

  • Unfortunately, TI is unable to help you with your problem.  The option --symbol_map comes close to solving your problem.  But it does not handle the case where the definition of both symbols is in the same object file.  Because you cannot change how your code is organized, this limitation of --symbol_map cannot be overcome.

    Thanks and regards,

    -George

  • Please ignore the problem on 'the definition of both symbols is in the same object file'.

    ==============================================================

    I am having other issue too and i am explaining the issue again.

    For one of the function, I tried to use the below symbol map in CCS GUI tool/editor with No optimization.

    --symbol_map='Function_1=Function_5'

    This symbol mapping is done when it is compiled and linked from CCS GUI tool/Editor.

    However, the symbol mapping is not done when it is compiled and linked from command window.

    This is the main issue i have now.

    To check the symbol mapping, i cross verified the map file. GUI editor generated map file and linkinfo.xml has the symbol mapping whereas the command window generated map file and linkinfo.xml are not having symbol mapping

    Could you please check and provide the solution?

    Thanks and Regards,

    N. Patchaiappan

  • I do not know what has happened.  Here is one way to investigate the problem.

    Perform both builds without this option ...

    Patchaiappan Nallasingam said:
    --symbol_map='Function_1=Function_5'

    Compare the symbols you see in the map file.  The addresses of the symbols may have some small differences.  But the existence of all the symbols should match.  However, I suspect they do not match.  Try to explain that unexpected difference.

    If you want me to compare the map files, please put them both in a zip file then attach it to your next post.

    Thanks and regards,

    -George

  • Herewith, I am attaching the sample workspace and comparison report for your reference(in CCS_SYMBOL_MAP_SAMPLE.zip file).

    Symbol mapping is done when the software is compiled and linked from CCS GUI Tool/Editor

    Whereas, Symbol mapping is not done when the software is compiled and linked from Command prompt.

    When CCS_SYMBOL_MAP_SAMPLE.zip is extracted in C drive, complete project for CCS will be available.

    In Extracted folder, you can find the LinkInfo.xml comparison report in the below path:

    "C:\CCS_SYMBOL_MAP_SAMPLE\Sample\Debug\LinkInfoCompareReport.html"

    and Symbol map comparison report is present in the below path:

    "C:\CCS_SYMBOL_MAP_SAMPLE\Sample\Debug\SymbolMapCompareReport.html"

    Sample source path is present in the below path:

    "C:\CCS_SYMBOL_MAP_SAMPLE\Sample\source\code\file1.c"

    "C:\CCS_SYMBOL_MAP_SAMPLE\Sample\source\code\file2.c"

    "C:\CCS_SYMBOL_MAP_SAMPLE\Sample\source\code\sys_linker.cmd"

    To compile and link the file from the command, the below batch file is created and it is present in the below path:

    "C:\CCS_SYMBOL_MAP_SAMPLE\Sample\Debug\BatchCmd.bat"

    Please analyze and provide your solution quickly.

    Thanks and Regards,

    N.Patchaiappan3704.CCS_SYMBOL_MAP_SAMPLE.zip

  • Thank you for the detailed test case.  I can reproduce the problem where the --symbol_map option does not have the expected effect.  I cannot explain what happened.  Neither can I explain why it is different when built under CCS.  I filed the entry EXT_EP-10043 to have this investigated.  You are welcome to follow it with the link below in my signature.

    Thanks and regards,

    -George

  • Could you please share the status and resolution of investigation entry 'EXT_EP-10043'?

    Thanks and Regards,

    N. Patchaiappan

  • You are welcome to follow EXT_EP-10043.  You will see that, as of this point, no activity has occurred.

    Thanks and regards,

    -George