Specify output sections in LD linker script to be both OVERLAY and NOLAOD

42 Views Asked by At

I have a use case where I want an output section type to be NOLOAD and OVERLAY. In the below linker-script, sections ".LOCAL_0_0" and ".LOCAL_1_1" are to be run at the same memory address. These sections are non-loadable as they contain only uninitialized variables. Is there any way to specify OVERLAY sections as NOLAOD also?

In the below script, I am forced to provide a load memory address (0x0000) for these sections, which I don't want to do.

MEMORY
{
        KERNELTEXT  (rx): ORIGIN = 0x10000000, LENGTH = 64K
        LOCALMEM    (rw): ORIGIN = 0x20000000, LENGTH = 256K
        GRPLOCALMEM (rw): ORIGIN = 0x40000000, LENGTH = 256K
}

SECTIONS
{
        .rodata 0x10000000 : { *(.rodata) *(.rodata.*) } >KERNELTEXT
        .text ALIGN(0x20) : {*(.text.*) *(.text)} >KERNELTEXT

        /*. = ALIGN(0x1000);*/
        .data : {*(.data.*) *(.data) *(.sdata.*) *(.sdata)} >GRPLOCALMEM
        .sbss : {*(.sbss) } >GRPLOCALMEM
        .bss  : { *(.bss) *(COMMON)
                        _endOfBSS = ABSOLUTE(.);
                        } >GRPLOCALMEM
   

        OVERLAY ORIGIN(LOCALMEM) : AT (0x0000)
        {
                .LOCAL_0_0  { *(.local_0_0)}
                .LOCAL_0_1  { *(.local_0_1)}
         }
}
0

There are 0 best solutions below