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.

--relocatable Linker Option and WEAK Symbol issue

Hello Support,

I find that with --relocatable option for Linker and WEAK Symbol in a module using incremental build, during the final phase of Linker with --absolute_exe option, all the WEAK Symbols in the source module are containing wrong addresses.

If I use all the source modules with only --absolute_exe option of Linker, then it works. I need to use INCREMENTAL Build with --relocatable option and resolve all the WEAK Symbols during the final phase of --absolute_exe option of Linker.

How do I perform that action?

Please help.

Thank you.

Regards

Pashan

 

  • I want to summarize your question to be sure I understand it correctly.  You are conducting a partial link with some weak symbols in it, the linker finds definitions for those weak symbols and resolves them.  But that is not what you want.  Instead, you want a partial link to never resolve any weak symbols, even if definitions are found.  You want weak symbols to get resolved only during a final link.  Is this summary correct?  I presume so.

    There is no way to control exactly when a weak symbol is resolved.  Whenever the linker finds a definition to resolve the symbol, it will do so.  

    What is the overall problem you are attempting to solve?  There may be another way to do it.

    Thanks and regards,

    -George

  • Hello George,

    I have uploaded Weak_Symbol_Bug.zip file.

    Once you unzip to a folder, you can run compile_ti_bug.bat file assuming COMPILER_PATH is correct for your setup.

    In the bstartup_bug.asm, there is "BL  Delay_Before_PLL_Setup  " instruction.

    The destination address for that BL instruction is completely wrong.

    You can compare with the dbcBootCAN_BUG.map file to check for that symbol address.

    Let me know if you still need any more information.

    Thank you.

    Regards

    Pashan

     

    WEAK_Symbol_Bug.zip
  • Hello George,

    Did you get a chance looking at my example attachedin the previous mail?

    Please help me.

    Thank you.

    Regards

    Pashan

     

  • Pashan None said:
    The destination address for that BL instruction is completely wrong.

    What, specifically, are you looking at that causes you to reach that conclusion?  What address should that BL branch to?  This example is complicated, so I may well have missed something.  But I don't see where anything is done incorrectly.

    Thanks and regards,

    -George

  • Hello George,

    I am attaching the PDF file which describes the issue.

    Let me know if you still can't understand.

    I am also attaching the new ZIP file in case you can't find the HEX file output.

    Remember, the problem is in .out file and not in .hex file.

    Thank you.

    Regards

    Pashan

     

    WEAK_Symbol_Bug.zip
  • Hello George,

    Attaching the PDF file separately.

    Thank you.

    Regards

    Pashan

     

    Weak_Symbol_Issue_Description.pdf
  • I see the problem now.  I should have spotted it earlier.  Sorry.

    I will submit an entry in the SDOWP system to have this problem fixed.  When I do, I'll let you know the number.  My first attempts at reproducing the bug with a simpler test case have failed.  Which is why I am posting now, instead of waiting until I have submitted the bug.

    It is likely that one of the necessary conditions for your bug is the multiple levels of partial linking.  (Side note: A partial link is when you use the linker with the --relocatable switch to link together only a part of the object code.)  Thus, a workaround to consider is to somehow build without all those partial links.  And I suspect you can do that.  Instead of a partial link, create an object code library out the object code participating in that link.  Some of what are now partial links will change into creation of a library that has as input object files and a library.  (The case of multiple libraries as input is slightly more complicated.  I presume, for now, you don't have that case.)  For that case I recommend you copy the input library into a file with the name of the output library, then use the ar470 -a option to add files to the output library.  You can learn more about the archiver ar470 in the ARM Assembly Language Tools User's Guide.

    Thanks and regards,

    -George 

  • I filed SDSCM00042194 in the SDOWP system to track this issue.  You can track it with the SDOWP link in my sig below.  Sorry for the delay.

    Thanks and regards,

    -George