« Return to Thread: ld script help

ld script help

by Hans Schwarz :: Rate this Message:

Reply to Author | View in Thread

I am using binutils 2.18 and am having problems with the linker script. I am somewhat new to linker scripting and the problem is that the binary file being created by ld is too big. My linker script is as follows:

OUTPUT_FORMAT("binary")
ENTRY(_start)
SECTIONS
{
  .text 0x100000 : {
    code = .; _code = .; __code = .;
    *(.text)
    . = ALIGN(4096);
  }
  .data  : {
    data = .; _data = .; __data = .;
    *(.data)
    . = ALIGN(4096);
  }
  .bss  :
  {
    bss = .; _bss = .; __bss = .;
    *(.bss)
    . = ALIGN(4096);
  }
  end = .; _end = .; __end = .;
}

It seems that the binary file does put everything in "proper" place, like the code at 0x100000, but with previous ld versions the binary was getting around 50k and this version is building a 1mb+ binary. I don't know what I am missing here, can someone help me? Is there some kind of compression the ld should do?

 « Return to Thread: ld script help