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.

How to avoid "warning: section relative symbols from different output sections cannot be mixed" for GROUP conatining various output sections

Hello,

I have Linker Command Script as shown below:

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

  GROUP(Flash_Driver_RAM_BSS_Download) :
   {

   GROUP(Flash_Driver_RAM_Download) : START(_Flash_Driver_Download_P), SIZE(_TOTAL_SIZE_OF_FLASH_DRV_DOWNLOAD)
   {
       .watchdog: END(_END_OF_GET_TABLE_ROUTINE)
              {
                * (.watchdog)
              }

       .const: {
..\Boot_Gen\pgm\flash_drv_align_psa.obj (.const)
              }

     .PSA_FLASH_DRV: START(_START_OF_FLASH_DRV_PSA)
             {
                         _PSA_FLASH_DRV_SIGNATURE_OFFSET = . - _Flash_Driver_Download_P;    
..\Boot_Gen\pgm\flash_drv_psa.obj  (.const)                        
             }
                                       
     
    }     
    .bss    : START(_START_OF_BSS_FLASH_DRV), SIZE(_TOTAL_SIZE_OF_FLASH_DRV_BSS)
    {
       _BSS_OFFSET_FROM_GET_TABLE = _START_OF_BSS_FLASH_DRV - _END_OF_GET_TABLE_ROUTINE;
   
    } type=NOLOAD, type=NOINIT
   
    .cinit : {}
   
    } load = RAM_DOWNLOAD, SIZE(_TOTAL_SIZE_OF_FLASH_DRV_AND_BSS)
----------------------------------------------------------------------------------------------------------------------------------

I get the following error:

"warning: section relative symbols from different output sections cannot be mixed;

   "_END_OF_GET_TABLE_ROUTINE" is in section ".watchdog",
   "_START_OF_BSS_FLASH_DRV" is in section ".bss"

for the line above:

 _BSS_OFFSET_FROM_GET_TABLE = _START_OF_BSS_FLASH_DRV - _END_OF_GET_TABLE_ROUTINE;

Please help me to avoid the error.

Thank you.

Regards

Pashan

 

  • The linker doesn't support expressions involving symbols from different output sections.  You have to compute _START_OF_BSS_FLASH_DRV - _END_OF_GET_TABLE_ROUTINE dynamically after the system has begun execution.

    Thanks and regards,

    -George

  • Hello George,

    So, can you please give me some clue as to the way I can generate a Linker Define Symbol which will give me the MEMORY OFFSET  from the previously defined End of Output Section XX to the beginning of Current Output Section YY?

    That's what I am trying to achieve in the last mail.

    Question is how to achieve that?

    Any help is appreciated.

    Thank you.

    Regards

    Pashan

     

  • Pashan said:
    please give me some clue as to the way I can generate a Linker Define Symbol which will give me the MEMORY OFFSET  from the previously defined End of Output Section XX to the beginning of Current Output Section YY

    The linker does not support that use case. You have to write code which computes, at runtime, the expression YY-XX.

    Thanks and regards,

    -George