ld: Output Section Discarding
1
1 3.6.7 Output Section Discarding
1 -------------------------------
1
1 The linker will not normally create output sections with no contents.
1 This is for convenience when referring to input sections that may or may
1 not be present in any of the input files. For example:
1 .foo : { *(.foo) }
1 will only create a '.foo' section in the output file if there is a
1 '.foo' section in at least one input file, and if the input sections are
1 not all empty. Other link script directives that allocate space in an
1 output section will also create the output section. So too will
1 assignments to dot even if the assignment does not create space, except
1 for '. = 0', '. = . + 0', '. = sym', '. = . + sym' and '. = ALIGN (. !=
1 0, expr, 1)' when 'sym' is an absolute symbol of value 0 defined in the
1 script. This allows you to force output of an empty section with '. =
1 .'.
1
11 The linker will ignore address assignments (⇒Output Section
Address) on discarded output sections, except when the linker script
1 defines symbols in the output section. In that case the linker will
1 obey the address assignments, possibly advancing dot even though the
1 section is discarded.
1
1 The special output section name '/DISCARD/' may be used to discard
1 input sections. Any input sections which are assigned to an output
1 section named '/DISCARD/' are not included in the output file.
1