Home Explore Blog CI



man-pages

12th chunk of `ld.man`
e9effbc47ee338268407af7067c24090daedb5c3c3a6863a0000000100000faa
 need this information in order to perform correct modifications of executables.  This  results  in
           larger executables.

           This option is currently only supported on ELF platforms.

       --force-dynamic
           Force the output file to have dynamic sections.  This option is specific to VxWorks targets.

       -r
       --relocatable
           Generate  relocatable  output---i.e.,  generate  an  output  file  that  can in turn serve as input to ld.  This is often called partial linking.  As a side effect, in environments that support standard Unix magic
           numbers, this option also sets the output file’s magic number to "OMAGIC".  If this option is not specified, an absolute file is produced.  When linking C++ programs, this option will  not  resolve  references  to
           constructors; to do that, use -Ur.

           When  an input file does not have the same format as the output file, partial linking is only supported if that input file does not contain any relocations.  Different output formats can have further restrictions;
           for example some "a.out"-based formats do not support partial linking with input files in other formats at all.

           This option does the same thing as -i.

       -R filename
       --just-symbols=filename
           Read symbol names and their addresses from filename, but do not relocate it or include it in the output.  This allows your output file to refer symbolically  to  absolute  locations  of  memory  defined  in  other
           programs.  You may use this option more than once.

           For compatibility with other ELF linkers, if the -R option is followed by a directory name, rather than a file name, it is treated as the -rpath option.

       -s
       --strip-all
           Omit all symbol information from the output file.

       -S
       --strip-debug
           Omit debugger symbol information (but not all symbols) from the output file.

       --strip-discarded
       --no-strip-discarded
           Omit (or do not omit) global symbols defined in discarded sections.  Enabled by default.

       -t
       --trace
           Print the names of the input files as ld processes them.  If -t is given twice then members within archives are also printed.  -t output is useful to generate a list of all the object files and scripts involved in
           linking, for example, when packaging files for a linker bug report.

       -T scriptfile
       --script=scriptfile
           Use  scriptfile  as the linker script.  This script replaces ld’s default linker script (rather than adding to it), unless the script contains "INSERT", so commandfile must specify everything necessary to describe
           the output file.    If scriptfile does not exist in the current directory, "ld" looks for it in the directories specified by any preceding -L options.  Multiple -T options accumulate.

       -dT scriptfile
       --default-script=scriptfile
           Use 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

Title: LD (GNU Linker) - Relocation, Symbol Stripping, Tracing, Scripting, and Undefined Symbol Options
Summary
This section details several `ld` options: `-R` for reading symbols from a file without relocating it, `-s` and `-S` for stripping symbol information, `--strip-discarded` to control stripping global symbols in discarded sections, `-t` for tracing input files, `-T` for specifying a linker script, `-dT` for specifying a default linker script, and `-u` for forcing a symbol to be undefined, potentially triggering linking of additional modules.