Home Explore Blog CI



man-pages

22th chunk of `ld.man`
648587428bf48f405ae508c91b4616ed4d9c2f6cc3c7f0620000000100000fb4
 line  will  be  recursively  searched,  following  their
           DT_NEEDED  tags to other libraries, in order to resolve symbols required by the output binary.  With the default setting however the searching of dynamic libraries that follow it will stop with the dynamic library
           itself.  No DT_NEEDED links will be traversed to resolve symbols.

       --cref
           Output a cross reference table.  If a linker map file is being generated, the cross reference table is printed to the map file.  Otherwise, it is printed on the standard output.

           The format of the table is intentionally simple, so that it may be easily processed by a script if necessary.  The symbols are printed out, sorted by name.  For each symbol, a list of file names is given.  If  the
           symbol  is  defined, the first file listed is the location of the definition.  If the symbol is defined as a common value then any files where this happens appear next.  Finally any files that reference the symbol
           are listed.

       --ctf-variables
       --no-ctf-variables
           The CTF debuginfo format supports a section which encodes the names and types of variables found in the program which do not appear in any symbol table. These variables clearly cannot be looked up  by  address  by
           conventional  debuggers,  so  the  space  used  for  their types and names is usually wasted: the types are usually small but the names are often not.  --ctf-variables causes the generation of such a section.  The
           default behaviour can be restored with --no-ctf-variables.

       --ctf-share-types=method
           Adjust the method used to share types between translation units in CTF.

           share‐unconflicted
               Put all types that do not have ambiguous definitions into the shared dictionary, where debuggers can easily access them, even if they only occur in one translation unit.  This is the default.

           share‐duplicated
               Put only types that occur in multiple translation units into the shared dictionary: types with only one definition go into per‐translation‐unit dictionaries.   Types  with  ambiguous  definitions  in  multiple
               translation  units  always  go  into per‐translation‐unit dictionaries.  This tends to make the CTF larger, but may reduce the amount of CTF in the shared dictionary.  For very large projects this may speed up
               opening the CTF and save memory in the CTF consumer at runtime.

       --no-define-common
           This option inhibits the assignment of addresses to common symbols.  The script command "INHIBIT_COMMON_ALLOCATION" has the same effect.

           The --no-define-common option allows decoupling the decision to assign addresses to Common symbols from the choice of the output file type; otherwise a non‐Relocatable output type  forces  assigning  addresses  to
           Common  symbols.   Using  --no-define-common  allows  Common  symbols that are referenced from a shared library to be assigned addresses only in the main program.  This eliminates the unused duplicate space in the
           shared library, and also prevents any possible confusion over resolving to the wrong duplicate when there are many dynamic modules with specialized search paths for runtime symbol resolution.

       --force-group-allocation
           This option causes the linker to place section group members like normal input sections, and to delete the section groups.  This is the default behaviour for a final link but this option can be used to change  the
           behaviour of a relocatable link (-r).  The script command "FORCE_GROUP_ALLOCATION" has the same effect.

       --defsym=symbol=expression
           Create  a  global symbol in the output file, containing the absolute address given by expression.  You may use this option as many times as necessary to define multiple symbols in the command line.  A limited form
           of arithmetic

Title: LD (GNU Linker) - Options: Cross-References, CTF Debuginfo, Common Symbol Definition, and Symbol Definition
Summary
This section describes several linker options, including generating cross-reference tables (--cref), controlling CTF debug information for variables (--ctf-variables, --ctf-share-types), inhibiting address assignment to common symbols (--no-define-common), forcing allocation of section group members (--force-group-allocation) and defining global symbols with specific addresses (--defsym).