You copied the Doc URL to your clipboard.

Example GNU ld script for linking partial objects

This example shows how to use an ld script for linking partial objects.

The general form of ld --ldpartial is to assign each output section to 0x0. The linker is not always able to honor the instructions in the SECTIONS command. Input sections that are merged into one output section cannot be removed in subsequent links. If the linker detects that it might have to remove a section in a subsequent link it does not merge the section. Sections that cannot be merged are passed through into the output object unchanged.

SECTIONS
{
  .init         0 : { *(.init)   }
  .text         0 : { *(.text)   }
  .fini         0 : { *(.fini)   }
  .rodata       0 : { *(.rodata) }
  .data         0 : { *(.data)   }
  .bss          0 : { *(.bss)    }
}

Use the --linker_script command-line option to specify an ld script file.

Was this page helpful? Yes No