Some questions about ld script

loody miloody@gmail.com
Fri Jun 26 12:47:00 GMT 2009


Dear all:
I try to link my programs, *.o, as an standalone function call in dram
for me to jump to execute.
But I get the following error:
uart.c:(.text+0x6c): relocation truncated to fit: R_MIPS_GPREL16 against `suart1
_fcr'

I google the problem and find the problem comes from the branch target
is too far.
But my ld script is pretty simple, just put everything together as below:

OUTPUT_ARCH(mips)
SECTIONS
{
  .text 0xa0200000 :
  {
    * (.text)
    . = ALIGN(8);
  }
  .data :
  {
    *(.rodata)
    *(.data)
    . = ALIGN(8);
    *(.lit8)
    *(.lit4)
    *(.sdata)
    . = ALIGN(8);
  }

  . = ALIGN(4);
  _fbss = .;			/* Start of unitialised data	    */

  .sbss :
  {
    *(.sbss)
    *(.scommon)
  }
  .bss :
  {
    *(.bss)
    *(COMMON)
  }
  .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) }
  .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) }

  /DISCARD/ :
  {
    *(.reginfo)
  }
}

Does the error come from ld script or my program?
appreciate your help,
miloody



More information about the Binutils mailing list