Home Explore Blog CI



man-pages

13th chunk of `ld.man`
aff4dae6144f0fcd476c95ce6dd811fbde668eeedfb90a9f0000000100000fa6
 scriptfile as the default linker script.

           This option is similar to the --script option except that processing of the script is delayed until after the rest of the command line has been processed.  This allows options  placed  after  the  --default-script
           option  on  the  command  line  to  affect  the behaviour of the linker script, which can be important when the linker command line cannot be directly controlled by the user.  (eg because the command line is being
           constructed by another tool, such as gcc).

       -u symbol
       --undefined=symbol
           Force symbol to be entered in the output file as an undefined symbol.  Doing this may, for example, trigger linking of additional modules from  standard  libraries.   -u  may  be  repeated  with  different  option
           arguments to enter additional undefined symbols.  This option is equivalent to the "EXTERN" linker script command.

           If this option is being used to force additional modules to be pulled into the link, and if it is an error for the symbol to remain undefined, then the option --require-defined should be used instead.

       --require-defined=symbol
           Require  that  symbol  is  defined in the output file.  This option is the same as option --undefined except that if symbol is not defined in the output file then the linker will issue an error and exit.  The same
           effect can be achieved in a linker script by using "EXTERN", "ASSERT" and "DEFINED" together.  This option can be used multiple times to require additional symbols.

       -Ur For programs that do not use constructors or destructors, or for ELF based systems this option is equivalent to -r:  it generates relocatable output---i.e., an output file that can in turn serve as  input  to  ld.
           For other binaries however the -Ur option is similar to -r but it also resolves references to constructors and destructors.

           For those systems where -r and -Ur behave differently, it does not work to use -Ur on files that were themselves linked with -Ur; once the constructor table has been built, it cannot be added to.  Use -Ur only for
           the last partial link, and -r for the others.

       --orphan-handling=MODE
           Control how orphan sections are handled.  An orphan section is one not specifically mentioned in a linker script.

           MODE can have any of the following values:

           "place"
               Orphan sections are placed into a suitable output section following the strategy described in Orphan Sections.  The option --unique also affects how sections are placed.

           "discard"
               All orphan sections are discarded, by placing them in the /DISCARD/ section.

           "warn"
               The linker will place the orphan section as for "place" and also issue a warning.

           "error"
               The linker will exit with an error if any orphan section is found.

           The default if --orphan-handling is not given is "place".

       --unique[=SECTION]
           Creates  a  separate  output  section  for  every input section matching SECTION, or if the optional wildcard SECTION argument is missing, for every orphan input section.  An orphan section is one not specifically
           mentioned in a linker script.  You may use this option multiple times on the command line;  It prevents the normal merging of input sections with the same name, overriding output section assignments  in  a  linker
           script.

       -v
       --version
       -V  Display  the  version  number  for  ld.  The -V option also lists the supported emulations.  See also the description of the --enable-linker-version in Options,,Command-line Options which can be used to insert the
           linker version string into a binary.

       -x
       --discard-all
           Delete all local symbols.

       -X
       --discard-locals
           Delete all temporary local symbols.  (These

Title: LD (GNU Linker) - Undefined Symbols, Orphan Handling, Unique Sections, Version, and Symbol Discarding Options
Summary
This section covers several options for the `ld` linker: `-u` and `--require-defined` for handling undefined symbols, `--orphan-handling` for controlling how orphan sections are handled (placed, discarded, warned, or error), `--unique` for creating separate output sections, `-v` for displaying the version, and `-x` and `-X` for discarding symbols.