


ld(1)                 GNU Development Tools                 ld(1)


NNAAMMEE
       ld - the GNU linker


SSYYNNOOPPSSIISS
       lldd     [--oo _o_u_t_p_u_t] _o_b_j_f_i_l_e...
              [--AA_a_r_c_h_i_t_e_c_t_u_r_e] [--bb _i_n_p_u_t_-_f_o_r_m_a_t] [--BBssttaattiicc]
              [--cc _c_o_m_m_a_n_d_f_i_l_e] [--dd|--ddcc|--ddpp]
              [--ddeeffssyymm _s_y_m_b_o_l = _e_x_p_r_e_s_s_i_o_n] [--ee _e_n_t_r_y] [--FF]
              [--FF _f_o_r_m_a_t] [--ffoorrmmaatt _i_n_p_u_t_-_f_o_r_m_a_t] [--gg] [--GG_s_i_z_e]
              [----hheellpp] [--ii] [--ll_a_r] [--LL_s_e_a_r_c_h_d_i_r] [--MM]
              [--MMaapp_m_a_p_f_i_l_e] [--mm_e_m_u_l_a_t_i_o_n] [--nn|--NN]
              [--nnooiinnhhiibbiitt--eexxeecc] [--ooffoorrmmaatt _o_u_t_p_u_t_-_f_o_r_m_a_t]
              [--RR _f_i_l_e_n_a_m_e] [--rreellaaxx] [--rr|--UUrr] [--SS] [--ss]
              [--ssoorrtt--ccoommmmoonn] [--TT _c_o_m_m_a_n_d_f_i_l_e] [--TTtteexxtt _t_e_x_t_o_r_g]
              [--TTddaattaa _d_a_t_a_o_r_g] [--TTbbssss _b_s_s_o_r_g] [--tt] [--uu _s_y_m] [--VV]
              [--vv] [----vveerrssiioonn] [--wwaarrnn--ccoommmmoonn] [--XX] [--xx]

DDEESSCCRRIIPPTTIIOONN
       lldd combines a number of object and  archive  files,  relo-
       cates  their data and ties up symbol references. Often the
       last step in building a new compiled program to run  is  a
       call to lldd.

       lldd  accepts  Linker  Command Language files to provide ex-
       plicit and total control over the linking  process.   This
       man  page  does not describe the command language; see the
       `lldd' entry in `iinnffoo', or the manual _l_d_: _t_h_e _G_N_U  _l_i_n_k_e_r  ,
       for  full details on the command language and on other as-
       pects of the GNU linker.

       This version of lldd uses the general purpose BFD  libraries
       to  operate  on object files. This allows lldd to read, com-
       bine, and write object files in many  different  formats--
       for  example,  COFF  or  aa..oouutt.   Different formats may be
       linked together to produce any available  kind  of  object
       file.   You  can use `oobbjjdduummpp --ii' to get a list of formats
       supported on various architectures; see oobbjjdduummpp(11).

       Aside from its flexibility, the GNU linker is more helpful
       than  other  linkers  in providing diagnostic information.
       Many linkers abandon execution immediately upon encounter-
       ing  an  error; whenever possible, lldd continues executing,
       allowing you to identify other errors (or, in some  cases,
       to get an output file in spite of the error).

       The GNU linker lldd is meant to cover a broad range of situ-
       ations, and to be as compatible  as  possible  with  other
       linkers.   As  a  result, you have many choices to control
       its behavior through the command line, and  through  envi-
       ronment variables.






cygnus support            17 August 1992                        1





ld(1)                 GNU Development Tools                 ld(1)


OOPPTTIIOONNSS
       The  plethora  of command-line options may seem intimidat-
       ing, but in actual practice few of them are  used  in  any
       particular context.  For instance, a frequent use of lldd is
       to link standard Unix object files on a standard, support-
       ed Unix system.  On such a system, to link a file hheelllloo..oo:

       $ ld -o output /lib/crt0.o hello.o -lc

       This tells lldd to produce a file called oouuttppuutt as  the  re-
       sult  of linking the file //lliibb//ccrrtt00..oo with hheelllloo..oo and the
       library lliibbcc..aa which will come from  the  standard  search
       directories.

       The command-line options to lldd may be specified in any or-
       der, and may be repeated at will.  For the most part,  re-
       peating  an  option  with a different argument will either
       have no further  effect,  or  override  prior  occurrences
       (those  further to the left on the command line) of an op-
       tion.

       The exceptions--which may meaningfully be used  more  than
       once--are  --AA,  --bb  (or its synonym --ffoorrmmaatt), --ddeeffssyymm, --LL,
       --ll, --RR, and --uu.

       The list of object files to be linked together,  shown  as
       _o_b_j_f_i_l_e, may follow, precede, or be mixed in with command-
       line options; save that an _o_b_j_f_i_l_e  argument  may  not  be
       placed between an option flag and its argument.

       Usually  the  linker  is  invoked with at least one object
       file, but other forms of binary input files  can  also  be
       specified  with  --ll,  --RR, and the script command language.
       If _n_o binary input files at all are specified, the  linker
       does  not  produce  any output, and issues the message `NNoo
       iinnppuutt ffiilleess'.

       Option arguments must  either  follow  the  option  letter
       without  intervening  whitespace,  or be given as separate
       arguments immediately following the option  that  requires
       them.


       --AA_a_r_c_h_i_t_e_c_t_u_r_e
                In the current release of lldd, this option is use-
              ful only for the Intel 960 family of architectures.
              In that lldd configuration, the _a_r_c_h_i_t_e_c_t_u_r_e argument
              is one of the two-letter names identifying  members
              of the 960 family; the option specifies the desired
              output target, and warns of  any  incompatible  in-
              structions  in  the  input files.  It also modifies
              the linker's search strategy for archive libraries,
              to  support  the  use of libraries specific to each
              particular architecture, by including in the search



cygnus support            17 August 1992                        2





ld(1)                 GNU Development Tools                 ld(1)


              loop names suffixed with the string identifying the
              architecture.

              For example,  if  your  lldd  command  line  included
              `--AACCAA'  as  well  as `--llttrryy', the linker would look
              (in its built-in search paths, and in any paths you
              specify with --LL) for a library with the names

              try
              libtry.a
              tryca
              libtryca.a


              The  first two possibilities would be considered in
              any event; the last two  are  due  to  the  use  of
              `--AACCAA'.

              Future releases of lldd may support similar function-
              ality for other architecture families.

              You can meaningfully use --AA more  than  once  on  a
              command line, if an architecture family allows com-
              bination of target architectures; each use will add
              another pair of name variants to search for when --ll
              specifies a library.


       --bb _i_n_p_u_t_-_f_o_r_m_a_t
               Specify the binary format for input  object  files
              that  follow  this option on the command line.  You
              don't usually need to specify this, as lldd  is  con-
              figured  to  expect  as  a default input format the
              most usual format on each machine.  _i_n_p_u_t_-_f_o_r_m_a_t is
              a text string, the name of a particular format sup-
              ported by the BFD libraries.  --ffoorrmmaatt  _i_n_p_u_t_-_f_o_r_m_a_t
              has  the  same  effect,  as does the script command
              TTAARRGGEETT.

              You may want to use this option if you are  linking
              files  with an unusual binary format.  You can also
              use --bb to switch formats explicitly  (when  linking
              object files of different formats), by including --bb
              _i_n_p_u_t_-_f_o_r_m_a_t before each group of object files in a
              particular format.

              The  default  format  is taken from the environment
              variable GGNNUUTTAARRGGEETT.  You can also define the  input
              format from a script, using the command TTAARRGGEETT.


       --BBssttaattiicc
              This flag is accepted for command-line compatibili-
              ty with the SunOS linker, but has no effect on  lldd.



cygnus support            17 August 1992                        3





ld(1)                 GNU Development Tools                 ld(1)


       --cc _c_o_m_m_a_n_d_f_i_l_e
                Directs  lldd  to  read link commands from the file
              _c_o_m_m_a_n_d_f_i_l_e.  These commands will completely  over-
              ride  lldd's  default link format (rather than adding
              to it); _c_o_m_m_a_n_d_f_i_l_e must specify everything  neces-
              sary to describe the target format.


              You  may also include a script of link commands di-
              rectly in the command line by bracketing it between
              `{{' and `}}' characters.


       --dd

       --ddcc

       --ddpp    These  three options are equivalent; multiple forms
              are supported for compatibility with other linkers.
              Use  any  of them to make lldd assign space to common
              symbols even if a relocatable output file is speci-
              fied       (--rr).       The      script      command
              FFOORRCCEE__CCOOMMMMOONN__AALLLLOOCCAATTIIOONN has the same effect.


       --ddeeffssyymm _s_y_m_b_o_l
               = _e_x_p_r_e_s_s_i_o_n Create a global symbol in the  output
              file,  containing the absolute address given by _e_x_-
              _p_r_e_s_s_i_o_n.  You may use this option as many times as
              necessary to define multiple symbols in the command
              line.  A limited form of  arithmetic  is  supported
              for  the _e_x_p_r_e_s_s_i_o_n in this context: you may give a
              hexadecimal constant or the  name  of  an  existing
              symbol, or use ++ and -- to add or subtract hexadeci-
              mal constants or symbols.  If you need more  elabo-
              rate expressions, consider using the linker command
              language from a script.


       --ee _e_n_t_r_y
               Use _e_n_t_r_y as the explicit symbol for beginning ex-
              ecution  of  your  program, rather than the default
              entry point.  for a discussion of defaults and oth-
              er ways of specifying the entry point.


       --FF

       --FF_f_o_r_m_a_t
                Some  older linkers used this option throughout a
              compilation toolchain  for  specifying  object-file
              format  for  both  input  and  output object files.
              lldd's mechanisms (the --bb or --ffoorrmmaatt options for  in-
              put files, the TTAARRGGEETT command in linker scripts for



cygnus support            17 August 1992                        4





ld(1)                 GNU Development Tools                 ld(1)


              output files, the GGNNUUTTAARRGGEETT  environment  variable)
              are more flexible, but but it accepts (and ignores)
              the --FF option flag for compatibility  with  scripts
              written to call the old linker.


       --ffoorrmmaatt _i_n_p_u_t_-_f_o_r_m_a_t
               Synonym for --bb _i_n_p_u_t_-_f_o_r_m_a_t.


       --gg     Accepted,  but  ignored; provided for compatibility
              with other tools.


       --GG _s_i_z_e
              Set the maximum size of objects to be optimized us-
              ing  the GP register to _s_i_z_e under MIPS ECOFF.  Ig-
              nored for other object file formats.


       ----hheellpp Print a summary of the command-line options on  the
              standard  output  and exit.  This option and ----vveerr--
              ssiioonn begin with two dashes instead of one for  com-
              patibility  with other GNU programs.  The other op-
              tions start with only one  dash  for  compatibility
              with other linkers.


       --ii     Perform an incremental link (same as option --rr).


       --ll_a_r     Add  an  archive  file _a_r to the list of files to
              link.  This option may be used any number of times.
              lldd  will  search  its  path-list for occurrences of
              lliibb_a_r.a for every _a_r specified.


       --LL_s_e_a_r_c_h_d_i_r
               This command adds path _s_e_a_r_c_h_d_i_r to  the  list  of
              paths  that  lldd  will search for archive libraries.
              You may use this option any number of times.

              The default set of paths  searched  (without  being
              specified  with  --LL) depends on what emulation mode
              lldd is using, and in some cases also on how  it  was
              configured.    The paths can also be specified in a
              link script with the SSEEAARRCCHH__DDIIRR command.


       --MM     Print (to the standard output file)  a  link  map--
              diagnostic  information  about  where  symbols  are
              mapped by lldd,  and  information  on  global  common
              storage allocation.




cygnus support            17 August 1992                        5





ld(1)                 GNU Development Tools                 ld(1)


       --MMaapp _m_a_p_f_i_l_e
              Print  to  the  file _m_a_p_f_i_l_e a link map--diagnostic
              information about where symbols are mapped  by  lldd,
              and  information  on  global common storage alloca-
              tion.


       --mm _e_m_u_l_a_t_i_o_n
              Emulate the _e_m_u_l_a_t_i_o_n linker.   You  can  list  the
              available  emulations with the _-_V option.  This op-
              tion overrides the compiled-in  default,  which  is
              the system for which you configured lldd.


       --NN     specifies  readable and writable tteexxtt and ddaattaa sec-
              tions. If the output  format  supports  Unix  style
              magic numbers, the output is marked as OOMMAAGGIICC.

              When  you  use the `--NN' option, the linker does not
              page-align the data segment.


       --nn     sets the text segment to be read only,  and  NNMMAAGGIICC
              is written if possible.


       --nnooiinnhhiibbiitt--eexxeecc
              Normally,  the  linker  will  not produce an output
              file if it encounters errors during the  link  pro-
              cess.   With  this  flag,  you can specify that you
              wish the output file retained even after  non-fatal
              errors.


       --oo _o_u_t_p_u_t
                _o_u_t_p_u_t  _o_u_t_p_u_t is a name for the program produced
              by lldd; if this option is not  specified,  the  name
              `aa..oouutt'  is  used  by  default.  The script command
              OOUUTTPPUUTT can also specify the output file name.


       --ooffoorrmmaatt _o_u_t_p_u_t_-_f_o_r_m_a_t
               Specify the binary format for  the  output  object
              file.   You  don't usually need to specify this, as
              lldd is configured to produce  as  a  default  output
              format the most usual format on each machine.  _o_u_t_-
              _p_u_t_-_f_o_r_m_a_t is a text string, the name of a particu-
              lar  format  supported  by  the BFD libraries.  The
              script command OOUUTTPPUUTT__FFOORRMMAATT can also  specify  the
              output format, but this option overrides it.


       --RR _f_i_l_e_n_a_m_e
                _f_i_l_e  Read  symbol names and their addresses from



cygnus support            17 August 1992                        6





ld(1)                 GNU Development Tools                 ld(1)


              _f_i_l_e_n_a_m_e, but do not relocate it or include  it  in
              the  output.  This allows your output file to refer
              symbolically to absolute locations  of  memory  de-
              fined in other programs.


       --rreellaaxx An option with machine dependent effects.  Current-
              ly this option is only supported on the H8/300.

              On some platforms, use this option to perform glob-
              al  optimizations  that  become  possible  when the
              linker resolves addressing in your program, such as
              relaxing  address  modes  and  synthesizing new in-
              structions in the output object file.

              On platforms where this is not supported,  `--rreellaaxx'
              is accepted, but has no effect.


       --rr     Generates  relocatable  output--i.e.,  generate  an
              output file that can in turn serve as input to  lldd.
              This  is  often  called _p_a_r_t_i_a_l linking.  As a side
              effect, in environments that support standard  Unix
              magic  numbers,  this  option  also sets the output
              file's magic number to OOMMAAGGIICC.  If this  option  is
              not  specified, an absolute file is produced.  When
              linking C++ programs, this option _w_i_l_l _n_o_t  resolve
              references  to constructors; --UUrr is an alternative.

              This option does the same as --ii.


       --SS     Omits debugger symbol information (but not all sym-
              bols) from the output file.


       --ss     Omits  all symbol information from the output file.


       --ssoorrtt--ccoommmmoonn
              Normally, when lldd places the global common  symbols
              in  the  appropriate output sections, it sorts them
              by size.  First come all the one byte symbols, then
              all  the  two  bytes,  then all the four bytes, and
              then everything else.  This is to prevent gaps  be-
              tween  symbols  due to alignment constraints.  This
              option disables that sorting.


       --TTbbssss _o_r_g

       --TTddaattaa _o_r_g





cygnus support            17 August 1992                        7





ld(1)                 GNU Development Tools                 ld(1)


       --TTtteexxtt _o_r_g
              Use _o_r_g as the starting address for--respectively--
              the  bbssss,  ddaattaa,  or the tteexxtt segment of the output
              file.  _t_e_x_t_o_r_g must be a hexadecimal integer.


       --TT _c_o_m_m_a_n_d_f_i_l_e


       --TT_c_o_m_m_a_n_d_f_i_l_e
              Equivalent to --cc _c_o_m_m_a_n_d_f_i_l_e; supported for compat-
              ibility with other tools.


       --tt     Prints names of input files as lldd processes them.


       --uu _s_y_m Forces  _s_y_m  to be entered in the output file as an
              undefined symbol.  This may, for  example,  trigger
              linking  of  additional  modules  from standard li-
              braries.  --uu may be repeated with different  option
              arguments to enter additional undefined symbols.


       --UUrr    For  anything  other than C++ programs, this option
              is equivalent to --rr: it generates relocatable  out-
              put--i.e., an output file that can in turn serve as
              input to lldd.  When linking C++ programs,  --UUrr  _w_i_l_l
              resolve references to constructors, unlike --rr.


       --VV     Display the version number for lldd and list the sup-
              ported emulations.  Display which input  files  can
              and can not be opened.


       --vv     Display the version number for lldd.


       ----vveerrssiioonn
              Display the version number for lldd and exit.


       --wwaarrnn--ccoommmmoonn
              Warn  when a common symbol is combined with another
              common symbol or with a  symbol  definition.   Unix
              linkers  allow  this  somewhat sloppy practice, but
              linkers on some other  operating  systems  do  not.
              This  option  allows you to find potential problems
              from combining global symbols.


       --XX     If --ss or --SS is also specified,  delete  only  local
              symbols beginning with `LL'.



cygnus support            17 August 1992                        8





ld(1)                 GNU Development Tools                 ld(1)


       --xx     If  --ss  or  --SS  is also specified, delete all local
              symbols, not just those beginning with `LL'.




EENNVVIIRROONNMMEENNTT
       You can change the behavior of  lldd  with  the  environment
       variable GGNNUUTTAARRGGEETT.

       GGNNUUTTAARRGGEETT  determines  the input-file object format if you
       don't use --bb (or its synonym --ffoorrmmaatt).  Its  value  should
       be  one of the BFD names for an input format.  If there is
       no GGNNUUTTAARRGGEETT in the environment, lldd uses the natural  for-
       mat  of  the host. If GGNNUUTTAARRGGEETT is set to ddeeffaauulltt then BFD
       attempts to discover the input format by examining  binary
       input files; this method often succeeds, but there are po-
       tential ambiguities, since there is no method of  ensuring
       that  the magic number used to flag object-file formats is
       unique.  However, the configuration procedure for  BFD  on
       each system places the conventional format for that system
       first in the search-list, so ambiguities are  resolved  in
       favor of convention.




SSEEEE AALLSSOO
       oobbjjdduummpp(11)
       `lldd' and `bbiinnuuttiillss' entries in iinnffoo
       _l_d_:  _t_h_e  _G_N_U  _l_i_n_k_e_r, Steve Chamberlain and Roland Pesch;
       _T_h_e _G_N_U _B_i_n_a_r_y _U_t_i_l_i_t_i_e_s, Roland H. Pesch.


CCOOPPYYIINNGG
       Copyright (c) 1991, 1992 Free Software Foundation, Inc.

       Permission is granted  to  make  and  distribute  verbatim
       copies  of  this  manual provided the copyright notice and
       this permission notice are preserved on all copies.

       Permission is granted to copy and distribute modified ver-
       sions  of  this  manual  under the conditions for verbatim
       copying, provided that the entire resulting  derived  work
       is  distributed  under  the  terms  of a permission notice
       identical to this one.

       Permission is granted to copy and distribute  translations
       of this manual into another language, under the above con-
       ditions for modified versions, except that this permission
       notice  may  be  included  in translations approved by the
       Free Software Foundation instead of in  the  original  En-
       glish.




cygnus support            17 August 1992                        9


