Small data relocation linker problem

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Small data relocation linker problem

跳至解决方案
3,495 次查看
bshaw
Contributor III

I'm using Codewarrior 5.9.0 for PPC to build an app for a MPC5554.  This app previously compiled using command line tools,  I'm trying to set up the project in the IDE. So far I have gotten it to compile but I'm getting link errors:

 

 

Link Error   : Small data relocation (109) in function 'C_Runtime_Init'
in referencing file 'c_runtime_init.o'
requires that symbol '_zero_init_data_start'
in symbol definition file 'linker command file'
be in a small data section but is in the equivalent of a large data section;
referencing file may have been compiled with different small data thresholds than the symbol definition file
or the extern declaration for symbol is inconsistent with the symbol's definition.

 

The code it's complaining about looks like this....

 

  /* declare local variables */
  U32 const *L_Source; //
  U32       *L_Destination;
 
  /* clear all zero initialized RAM data to zero */
  L_Destination = (U32 *)(&_zero_init_data_start);
  while (L_Destination < (U32 *)(&_zero_init_data_end))
  {
    /* zero data and increment pointer */
    *L_Destination = 0;
    ++L_Destination;
  }


in the MEMORY section of my LCF I have

 

  zero_init_data:         org = 0x20001000,   len = 0x000FF000

 

and near the bottom of the lcf I have some address designations like...

 

_zero_init_data_start       = ADDR(zero_init_data);
_zero_init_data_end         = ADDR(zero_init_data) + SIZEOF(zero_init_data);

 

This worked in the command line / makefile environment but I'm have\ing trouble getting it to work in the IDE.  Does anyone have an idea what the problem is here?

 

Thanks in advance,

 

Bill

标签 (1)
标记 (1)
0 项奖励
回复
1 解答
2,279 次查看
stanish
NXP Employee
NXP Employee

Hi bshaw,

It seems that compiler/liker options changed when migrating project from cmd. line to IDE.

Could you possibly double check whether compiler options below match with IDE project settings?

-sdatathereshold

-sdata2thereshold

I'd recommed you to see the attached AN4094 ("<CW for MPC55xx and MPC56xx 2.8>\Help\PDF\AN4094.Build Tools Settings - IDE vs Cmd Line.pdf" ).

You should get rid of this error if you either disable sdata (set threshold to 0) or declare exported linker symbols (_zero_init_data_start, _zero_init_data_end) as below:

__declspec (section ".data") extern unsigned int _zero_init_data_start;
__declspec (section ".data") extern unsigned  int _zero_init_data_end;

 

Hope it will help

Stanish

在原帖中查看解决方案

0 项奖励
回复
3 回复数
2,279 次查看
bshaw
Contributor III
I've added a few pertenent details,  still chasing the same problem.

I'm using Codewarrior 5.9.0 for PPC to build an app for a MPC5554.  This app previously compiled using command line tools,  I'm trying to set up the project in the IDE. So far I have gotten it to compile but I'm getting link errors:

 

 

Link Error   : Small data relocation (109) in function 'C_Runtime_Init'
in referencing file 'c_runtime_init.o'
requires that symbol '_zero_init_data_start'
in symbol definition file 'linker command file'
be in a small data section but is in the equivalent of a large data section;
referencing file may have been compiled with different small data thresholds than the symbol definition file
or the extern declaration for symbol is inconsistent with the symbol's definition.

 

The code it's complaining about looks like this....

 

  /* declare local variables */
  U32 const *L_Source; //
  U32       *L_Destination;
 
  /* clear all zero initialized RAM data to zero */
  L_Destination = (U32 *)(&_zero_init_data_start);
  while (L_Destination < (U32 *)(&_zero_init_data_end))
  {
    /* zero data and increment pointer */
    *L_Destination = 0;
    ++L_Destination;
  }


in the MEMORY section of my LCF I have

 

  zero_init_data:         org = 0x20001000,   len = 0x000FF000
  init_data_rom:          org = 0x00042000,   len = 0x00001000

 

in the GROUP sections of my LCF I have

 

  GROUP :
  {
    .data   : {}
  } > init_data_ram
 
  GROUP :
  {
    .bss    : { calibrations.o(.bss) *(.bss) }
  } > zero_init_data
 

and near the bottom of the lcf I have some address designations like...

 

_zero_init_data_start       = ADDR(zero_init_data);
_zero_init_data_end         = ADDR(zero_init_data) + SIZEOF(zero_init_data);

 

This worked in the command line / makefile environment but I'm have\ing trouble getting it to work in the IDE.  Does anyone have an idea what the problem is here?

 

Thanks in advance,

 

Bill


 

0 项奖励
回复
2,280 次查看
stanish
NXP Employee
NXP Employee

Hi bshaw,

It seems that compiler/liker options changed when migrating project from cmd. line to IDE.

Could you possibly double check whether compiler options below match with IDE project settings?

-sdatathereshold

-sdata2thereshold

I'd recommed you to see the attached AN4094 ("<CW for MPC55xx and MPC56xx 2.8>\Help\PDF\AN4094.Build Tools Settings - IDE vs Cmd Line.pdf" ).

You should get rid of this error if you either disable sdata (set threshold to 0) or declare exported linker symbols (_zero_init_data_start, _zero_init_data_end) as below:

__declspec (section ".data") extern unsigned int _zero_init_data_start;
__declspec (section ".data") extern unsigned  int _zero_init_data_end;

 

Hope it will help

Stanish

0 项奖励
回复
2,279 次查看
bshaw
Contributor III

Thank you Stanish.  Setting   Setting Small Data = 0 in the Eppc target panel did the trick!

 

Best,

 

Bill

0 项奖励
回复