0

I am trying to understand .ld files

see below example of MEMORY and SECTIONS in .ld file

MEMORY
{
  MEM1 (rx)  : ORIGIN = 0xBD000000 , LENGTH = 0x10000
  MEM2 (rx)  : ORIGIN = 0xBE000000 , LENGTH = 0x20000
}

SECTIONS
{

    .text       :
    { *(.text*) }> MEM1

    .rodata  : { *(.rodata*) } > MEM2

    .data  : { *(.data*) }

    .sdata  : { *(.sdata*) }

    .sbss (NOLOAD)  : { *(.sbss*) }
    .bss (NOLOAD)  : { *(.bss*) . = ALIGN(4); }
} 

the problem is that i am getting a huge file (probably because of the differences in addresses between MEM1 and MEM2)

more data when I call the linker I used

-T <linker_file_nmae.lds> --gc-sections -Bstatic
4

0 回答 0