ld: Input Section Example
1
1 3.6.4.5 Input Section Example
1 .............................
1
1 The following example is a complete linker script. It tells the linker
1 to read all of the sections from file 'all.o' and place them at the
1 start of output section 'outputa' which starts at location '0x10000'.
1 All of section '.input1' from file 'foo.o' follows immediately, in the
1 same output section. All of section '.input2' from 'foo.o' goes into
1 output section 'outputb', followed by section '.input1' from 'foo1.o'.
1 All of the remaining '.input1' and '.input2' sections from any files are
1 written to output section 'outputc'.
1
1 SECTIONS {
1 outputa 0x10000 :
1 {
1 all.o
1 foo.o (.input1)
1 }
1 outputb :
1 {
1 foo.o (.input2)
1 foo1.o (.input1)
1 }
1 outputc :
1 {
1 *(.input1)
1 *(.input2)
1 }
1 }
1
1 If an output section's name is the same as the input section's name
1 and is representable as a C identifier, then the linker will
1 automatically ⇒PROVIDE two symbols: __start_SECNAME and
1 __stop_SECNAME, where SECNAME is the name of the section. These
1 indicate the start address and end address of the output section
1 respectively. Note: most section names are not representable as C
1 identifiers because they contain a '.' character.
1