home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / gnu / djgpp / docs / binutils / ld.i1 < prev    next >
Encoding:
GNU Info File  |  1993-09-06  |  49.1 KB  |  1,279 lines

  1. This is Info file ld.info, produced by Makeinfo-1.52 from the input
  2. file ./ld.texinfo.
  3.  
  4. START-INFO-DIR-ENTRY
  5. * Ld: (ld).            The GNU linker.
  6. END-INFO-DIR-ENTRY
  7.  
  8.    This file documents the GNU linker LD.
  9.  
  10.    Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc.
  11.  
  12.    Permission is granted to make and distribute verbatim copies of this
  13. manual provided the copyright notice and this permission notice are
  14. preserved on all copies.
  15.  
  16.    Permission is granted to copy and distribute modified versions of
  17. this manual under the conditions for verbatim copying, provided also
  18. that the entire resulting derived work is distributed under the terms
  19. of a permission notice identical to this one.
  20.  
  21.    Permission is granted to copy and distribute translations of this
  22. manual into another language, under the above conditions for modified
  23. versions.
  24.  
  25. 
  26. File: ld.info,  Node: Top,  Next: Overview,  Prev: (DIR),  Up: (DIR)
  27.  
  28. Using ld
  29. ********
  30.  
  31.    This file documents the GNU linker ld.
  32.  
  33. * Menu:
  34.  
  35. * Overview::                    Overview
  36. * Invocation::                  Invocation
  37. * Commands::                    Command Language
  38.  
  39.  
  40.  
  41.  
  42.  
  43. * BFD::                         BFD
  44.  
  45. * MRI::                         MRI Compatible Script Files
  46. * Index::                       Index
  47.  
  48. 
  49. File: ld.info,  Node: Overview,  Next: Invocation,  Prev: Top,  Up: Top
  50.  
  51. Overview
  52. ********
  53.  
  54.    `ld' combines a number of object and archive files, relocates their
  55. data and ties up symbol references. Usually the last step in compiling
  56. a program is to run `ld'.
  57.  
  58.    `ld' accepts Linker Command Language files written in a superset of
  59. AT&T's Link Editor Command Language syntax, to provide explicit and
  60. total control over the linking process.
  61.  
  62.    This version of `ld' uses the general purpose BFD libraries to
  63. operate on object files. This allows `ld' to read, combine, and write
  64. object files in many different formats--for example, COFF or `a.out'.
  65. Different formats may be linked together to produce any available kind
  66. of object file.  *Note BFD:: for a list of formats supported on various
  67. architectures.
  68.  
  69.    Aside from its flexibility, the GNU linker is more helpful than other
  70. linkers in providing diagnostic information.  Many linkers abandon
  71. execution immediately upon encountering an error; whenever possible,
  72. `ld' continues executing, allowing you to identify other errors (or, in
  73. some cases, to get an output file in spite of the error).
  74.  
  75. 
  76. File: ld.info,  Node: Invocation,  Next: Commands,  Prev: Overview,  Up: Top
  77.  
  78. Invocation
  79. **********
  80.  
  81.    The GNU linker `ld' is meant to cover a broad range of situations,
  82. and to be as compatible as possible with other linkers.  As a result,
  83. you have many choices to control its behavior.
  84.  
  85.    Here is a summary of the options you can use on the `ld' command
  86. line:
  87.  
  88.      ld [-o OUTPUT ] OBJFILE...
  89.        [ -AARCHITECTURE ]  [ -b INPUT-FORMAT ]  [ -Bstatic ]
  90.        [ -c MRI-COMMANDFILE ]  [ -d | -dc | -dp ]
  91.        [ -defsym SYMBOL=EXPRESSION ]
  92.        [ -e ENTRY ]  [ -F ]  [ -F FORMAT ]
  93.        [ -format INPUT-FORMAT ]  [ -g ]  [ -i ]
  94.        [ -lAR ]  [ -LSEARCHDIR ]  [ -M | -m ]
  95.        [ -n | -N ]  [ -noinhibit-exec ]  [ -R FILENAME ]
  96.        [ -relax ]  [ -r | -Ur ]  [ -S ]  [ -s ]  [ -T COMMANDFILE ]
  97.        [ -Ttext TEXTORG ]  [ -Tdata DATAORG ]  [ -Tbss BSSORG ]
  98.        [ -t ]  [ -u SYM]  [-v]  [ -X ]  [ -x ]  [ -ySYMBOL ]
  99.        [ { SCRIPT } ]
  100.  
  101.    This plethora of command-line options may seem intimidating, but in
  102. actual practice few of them are used in any particular context.  For
  103. instance, a frequent use of `ld' is to link standard Unix object files
  104. on a standard, supported Unix system.  On such a system, to link a file
  105. `hello.o':
  106.  
  107.      ld -o OUTPUT /lib/crt0.o hello.o -lc
  108.  
  109.    This tells `ld' to produce a file called OUTPUT as the result of
  110. linking the file `/lib/crt0.o' with `hello.o' and the library `libc.a',
  111. which will come from the standard search directories.  (See the
  112. discussion of the `-l' option below.)
  113.  
  114.    The command-line options to `ld' may be specified in any order, and
  115. may be repeated at will.  Repeating most options with a different
  116. argument will either have no further effect, or override prior
  117. occurrences (those further to the left on the command line) of that
  118. option.
  119.  
  120.    The exceptions--which may meaningfully be used more than once--are
  121. `-A', `-b' (or its synonym `-format'), `-defsym', `-L', `-l', `-R', and
  122. `-u'.
  123.  
  124.    The list of object files to be linked together, shown as OBJFILE...,
  125. may follow, precede, or be mixed in with command-line options, except
  126. that an OBJFILE argument may not be placed between an option and its
  127. argument.
  128.  
  129.    Usually the linker is invoked with at least one object file, but
  130. other forms of binary input files can also be specified with `-l',
  131. `-R', and the script command language.  If *no* binary input files at
  132. all are specified, the linker does not produce any output, and issues
  133. the message `No input files'.
  134.  
  135.    Option arguments must either follow the option letter without
  136. intervening whitespace, or be given as separate arguments immediately
  137. following the option that requires them.
  138.  
  139. `OBJFILE...'
  140.      The object files to be linked.
  141.  
  142. `-b INPUT-FORMAT'
  143.      Specify the binary format for input object files that follow this
  144.      option on the command line.  You don't usually need to specify
  145.      this, as `ld' is configured to expect as a default input format
  146.      the most usual format on each machine.  INPUT-FORMAT is a text
  147.      string, the name of a particular format supported by the BFD
  148.      libraries.  `-format INPUT-FORMAT' has the same effect.  *Note
  149.      BFD::.
  150.  
  151.      You may want to use this option if you are linking files with an
  152.      unusual binary format.  You can also use `-b' to switch formats
  153.      explicitly (when linking object files of different formats), by
  154.      including `-b INPUT-FORMAT' before each group of object files in a
  155.      particular format.
  156.  
  157.      The default format is taken from the environment variable
  158.      `GNUTARGET'.  You can also define the input format from a script,
  159.      using the command `TARGET'; see *Note Other Commands::.
  160.  
  161. `-Bstatic'
  162.      Ignored.  This option is accepted for command-line compatibility
  163.      with the SunOS linker.
  164.  
  165. `-c MRI-COMMANDFILE'
  166.      For compatibility with linkers produced by MRI, `ld' accepts script
  167.      files written in an alternate, restricted command language,
  168.      described in *Note MRI Compatible Script Files: MRI.  Introduce
  169.      MRI script files with the option `-c'; use the `-T' option to run
  170.      linker scripts written in the general-purpose `ld' scripting
  171.      language.
  172.  
  173. `-d'
  174. `-dc'
  175. `-dp'
  176.      These three options are equivalent; multiple forms are supported
  177.      for compatibility with other linkers.  They assign space to common
  178.      symbols even if a relocatable output file is specified (with
  179.      `-r').  The script command `FORCE_COMMON_ALLOCATION' has the same
  180.      effect.  *Note Other Commands::.
  181.  
  182. `-defsym SYMBOL=EXPRESSION'
  183.      Create a global symbol in the output file, containing the absolute
  184.      address given by EXPRESSION.  You may use this option as many
  185.      times as necessary to define multiple symbols in the command line.
  186.      A limited form of arithmetic is supported for the EXPRESSION in
  187.      this context: you may give a hexadecimal constant or the name of
  188.      an existing symbol, or use `+' and `-' to add or subtract
  189.      hexadecimal constants or symbols.  If you need more elaborate
  190.      expressions, consider using the linker command language from a
  191.      script (*note Assignment: Symbol Definitions: Assignment.).
  192.      *Note:*  there should be no white space between SYMBOL, the equals
  193.      sign ("="), and EXPRESSION.
  194.  
  195. `-e ENTRY'
  196.      Use ENTRY as the explicit symbol for beginning execution of your
  197.      program, rather than the default entry point. *Note Entry Point::,
  198.      for a discussion of defaults and other ways of specifying the
  199.      entry point.
  200.  
  201. `-F'
  202. `-FFORMAT'
  203.      Ignored.  Some older linkers used this option throughout a
  204.      compilation toolchain for specifying object-file format for both
  205.      input and output object files.  The mechanisms `ld' uses for this
  206.      purpose (the `-b' or `-format' options for input files, the
  207.      `TARGET' command in linker scripts for output files, the
  208.      `GNUTARGET' environment variable) are more flexible, but `ld'
  209.      accepts the `-F' option for compatibility with scripts written to
  210.      call the old linker.
  211.  
  212. `-format INPUT-FORMAT'
  213.      Synonym for `-b INPUT-FORMAT'.
  214.  
  215. `-g'
  216.      Ignored.  Provided for compatibility with other tools.
  217.  
  218. `-i'
  219.      Perform an incremental link (same as option `-r').
  220.  
  221. `-lAR'
  222.      Add archive file AR to the list of files to link.  This option may
  223.      be used any number of times.  `ld' will search its path-list for
  224.      occurrences of `libAR.a' for every AR specified.
  225.  
  226. `-LSEARCHDIR'
  227.      Add path SEARCHDIR to the list of paths that `ld' will search for
  228.      archive libraries.  You may use this option any number of times.
  229.  
  230.      The paths can also be specified in a link script with the
  231.      `SEARCH_DIR' command.
  232.  
  233. `-M'
  234. `-m'
  235.      Print (to the standard output) a link map--diagnostic information
  236.      about where symbols are mapped by `ld', and information on global
  237.      common storage allocation.
  238.  
  239. `-N'
  240.      Set the text and data sections to be readable and writable.  Also,
  241.      do not page-align the data segment.  If the output format supports
  242.      Unix style magic numbers, mark the output as `OMAGIC'.
  243.  
  244. `-n'
  245.      Set the text segment to be read only, and mark the output as
  246.      `NMAGIC' if possible.
  247.  
  248. `-noinhibit-exec'
  249.      Retain the executable output file whenever it is still usable.
  250.      Normally, the linker will not produce an output file if it
  251.      encounters errors during the link process; it exits without
  252.      writing an output file when it issues any error whatsoever.
  253.  
  254. `-o OUTPUT'
  255.      Use OUTPUT as the name for the program produced by `ld'; if this
  256.      option is not specified, the name `a.out' is used by default.  The
  257.      script command `OUTPUT' can also specify the output file name.
  258.  
  259. `-R FILENAME'
  260.      On some platforms, this option performs global optimizations that
  261.      become possible when the linker resolves addressing in the
  262.      program, such as relaxing address modes and synthesizing new
  263.      instructions in the output object file.
  264.  
  265. `-relax'
  266.      An option with machine dependent effects.  Currently this option
  267.      is only supported on the H8/300.
  268.  
  269.      On some platforms, use option performs global optimizations that
  270.      become possible when the linker resolves addressing in the
  271.      program, such as relaxing address modes and synthesizing new
  272.      instructions in the output object file.
  273.  
  274.      On platforms where this is not supported, `-relax' is accepted, but
  275.      ignored.
  276.  
  277. `-r'
  278.      Generate relocatable output--i.e., generate an output file that
  279.      can in turn serve as input to `ld'.  This is often called "partial
  280.      linking".  As a side effect, in environments that support standard
  281.      Unix magic numbers, this option also sets the output file's magic
  282.      number to `OMAGIC'.  If this option is not specified, an absolute
  283.      file is produced.  When linking C++ programs, this option *will
  284.      not* resolve references to constructors; to do that, use `-Ur'.
  285.  
  286.      This option does the same as `-i'.
  287.  
  288. `-S'
  289.      Omit debugger symbol information (but not all symbols) from the
  290.      output file.
  291.  
  292. `-s'
  293.      Omit all symbol information from the output file.
  294.  
  295. `{ SCRIPT }'
  296.      You can, if you wish, include a script of linker commands directly
  297.      in the command line instead of referring to it via an input file.
  298.      When the character `{' occurs on the command line, the linker
  299.      switches to interpreting the command language until the end of the
  300.      list of commands is reached; the end is indicated with a closing
  301.      brace `}'.  `ld' does not recognize other command-line options
  302.      while parsing the script.  *Note Commands::, for a description of
  303.      the command language.
  304.  
  305. `-Tbss BSSORG'
  306. `-Tdata DATAORG'
  307. `-Ttext TEXTORG'
  308.      Use ORG as the starting address for--respectively--the `bss',
  309.      `data', or the `text' segment of the output file.  ORG must be a
  310.      single hexadecimal integer; for compatibility with other linkers,
  311.      you may omit the leading `0x' usually associated with hexadecimal
  312.      values.
  313.  
  314. `-T COMMANDFILE'
  315. `-TCOMMANDFILE'
  316.      Read link commands from the file COMMANDFILE.  These commands
  317.      completely override `ld''s default link format (rather than adding
  318.      to it); COMMANDFILE must specify everything necessary to describe
  319.      the target format.  *Note Commands::.
  320.  
  321.      You may also include a script of link commands directly in the
  322.      command line by bracketing it between `{' and `}'.
  323.  
  324. `-t'
  325.      Print the names of the input files as `ld' processes them.
  326.  
  327. `-u SYM'
  328.      Force SYM to be entered in the output file as an undefined symbol.
  329.      Doing this may, for example, trigger linking of additional modules
  330.      from standard libraries.  `-u' may be repeated with different
  331.      option arguments to enter additional undefined symbols.
  332.  
  333. `-Ur'
  334.      For anything other than C++ programs, this option is equivalent to
  335.      `-r': it generates relocatable output--i.e., an output file that
  336.      can in turn serve as input to `ld'.  When linking C++ programs,
  337.      `-Ur' *will* resolve references to constructors, unlike `-r'.
  338.  
  339. `-v'
  340.      Display the version number for `ld'.
  341.  
  342. `-X'
  343.      If `-s' or `-S' is also specified, delete only local symbols
  344.      beginning with `L'.
  345.  
  346. `-x'
  347.      If `-s' or `-S' is also specified, delete all local symbols, not
  348.      just those beginning with `L'.
  349.  
  350. `-ySYMBOL'
  351.      Print the name of each linked file in which SYMBOL appears.  This
  352.      option may be given any number of times.  On many systems it is
  353.      necessary to prepend an underscore.
  354.  
  355.      This option is useful when you have an undefined symbol in your
  356.      link but don't know where the reference is coming from.
  357.  
  358. 
  359. File: ld.info,  Node: Commands,  Next: BFD,  Prev: Invocation,  Up: Top
  360.  
  361. Command Language
  362. ****************
  363.  
  364.    The command language provides explicit control over the link process,
  365. allowing complete specification of the mapping between the linker's
  366. input files and its output.  It controls:
  367.    * input files
  368.  
  369.    * file formats
  370.  
  371.    * output file format
  372.  
  373.    * addresses of sections
  374.  
  375.    * placement of common blocks
  376.  
  377.    You may supply a command file (also known as a link script) to the
  378. linker either explicitly through the `-T' option, or implicitly as an
  379. ordinary file. If the linker opens a file which it cannot recognize as
  380. a supported object or archive format, it tries to interpret the file as
  381. a command file.
  382.  
  383.    You can also include a script directly on the `ld' command line,
  384. delimited by the characters `{' and `}'.
  385.  
  386. * Menu:
  387.  
  388. * Scripts::                     Linker Scripts
  389. * Expressions::                 Expressions
  390. * MEMORY::                      MEMORY Command
  391. * SECTIONS::                    SECTIONS Command
  392. * Entry Point::                 The Entry Point
  393. * Other Commands::              Other Commands
  394.  
  395. 
  396. File: ld.info,  Node: Scripts,  Next: Expressions,  Up: Commands
  397.  
  398. Linker Scripts
  399. ==============
  400.  
  401.    The `ld' command language is a collection of statements; some are
  402. simple keywords setting a particular option, some are used to select and
  403. group input files or name output files; and two statement types have a
  404. fundamental and pervasive impact on the linking process.
  405.  
  406.    The most fundamental command of the `ld' command language is the
  407. `SECTIONS' command (*note SECTIONS::.).  Every meaningful command
  408. script must have a `SECTIONS' command: it specifies a "picture" of the
  409. output file's layout, in varying degrees of detail.  No other command
  410. is required in all cases.
  411.  
  412.    The `MEMORY' command complements `SECTIONS' by describing the
  413. available memory in the target architecture.  This command is optional;
  414. if you don't use a `MEMORY' command, `ld' assumes sufficient memory is
  415. available in a contiguous block for all output.  *Note MEMORY::.
  416.  
  417.    You may include comments in linker scripts just as in C: delimited
  418. by `/*' and `*/'.  As in C, comments are syntactically equivalent to
  419. whitespace.
  420.  
  421. 
  422. File: ld.info,  Node: Expressions,  Next: MEMORY,  Prev: Scripts,  Up: Commands
  423.  
  424. Expressions
  425. ===========
  426.  
  427.    Many useful commands involve arithmetic expressions.  The syntax for
  428. expressions in the command language is identical to that of C
  429. expressions, with the following features:
  430.    * All expressions evaluated as integers and are of "long" or
  431.      "unsigned long" type.
  432.  
  433.    * All constants are integers.
  434.  
  435.    * All of the C arithmetic operators are provided.
  436.  
  437.    * You may reference, define, and create global variables.
  438.  
  439.    * You may call special purpose built-in functions.
  440.  
  441. * Menu:
  442.  
  443. * Integers::                    Integers
  444. * Symbols::                     Symbol Names
  445. * Location Counter::            The Location Counter
  446. * Operators::                   Operators
  447. * Evaluation::                  Evaluation
  448. * Assignment::                  Assignment: Defining Symbols
  449. * Built-ins::                   Built-In Functions
  450.  
  451. 
  452. File: ld.info,  Node: Integers,  Next: Symbols,  Up: Expressions
  453.  
  454. Integers
  455. --------
  456.  
  457.    An octal integer is `0' followed by zero or more of the octal digits
  458. (`01234567').
  459.      _as_octal = 0157255;
  460.  
  461.    A decimal integer starts with a non-zero digit followed by zero or
  462. more digits (`0123456789').
  463.      _as_decimal = 57005;
  464.  
  465.    A hexadecimal integer is `0x' or `0X' followed by one or more
  466. hexadecimal digits chosen from `0123456789abcdefABCDEF'.
  467.      _as_hex = 0xdead;
  468.  
  469.    To write a negative integer, use the prefix operator `-'; *note
  470. Operators::..
  471.      _as_neg = -57005;
  472.  
  473.    Additionally the suffixes `K' and `M' may be used to scale a
  474. constant by `1024' or `1024*1024' respectively. For example, the
  475. following all refer to the same quantity:
  476.  
  477.              _fourk_1 = 4K;
  478.              _fourk_2 = 4096;
  479.              _fourk_3 = 0x1000;
  480.  
  481. 
  482. File: ld.info,  Node: Symbols,  Next: Location Counter,  Prev: Integers,  Up: Expressions
  483.  
  484. Symbol Names
  485. ------------
  486.  
  487.    Unless quoted, symbol names start with a letter, underscore, point or
  488. hyphen and may include any letters, underscores, digits, points, and
  489. minus signs.  Unquoted symbol names must not conflict with any
  490. keywords.  You can specify a symbol which contains odd characters or has
  491. the same name as a keyword, by surrounding the symbol name in double
  492. quotes:
  493.              "SECTION" = 9;
  494.              "with a space" = "also with a space" + 10;
  495.  
  496. 
  497. File: ld.info,  Node: Location Counter,  Next: Operators,  Prev: Symbols,  Up: Expressions
  498.  
  499. The Location Counter
  500. --------------------
  501.  
  502.    The special linker variable "dot" `.' always contains the current
  503. output location counter. Since the `.' always refers to a location in
  504. an output section, it must always appear in an expression within a
  505. `SECTIONS' command. The `.' symbol may appear anywhere that an ordinary
  506. symbol is allowed in an expression, but its assignments have a side
  507. effect. Assigning a value to the `.' symbol will cause the location
  508. counter to be moved.  This may be used to create holes in the output
  509. section.  The location counter may never be moved backwards.
  510.      SECTIONS
  511.      {
  512.              output :
  513.              {
  514.              file1(.text)
  515.              . = . + 1000;
  516.              file2(.text)
  517.              . += 1000;
  518.              file3(.text)
  519.              } = 0x1234;
  520.      }
  521.  
  522. In the previous example, `file1' is located at the beginning of the
  523. output section, then there is a 1000 byte gap.  Then `file2' appears,
  524. also with a 1000 byte gap following before `file3' is loaded.  The
  525. notation `= 0x1234' specifies what data to write in the gaps (*note
  526. Section Options::.).
  527.  
  528. 
  529. File: ld.info,  Node: Operators,  Next: Evaluation,  Prev: Location Counter,  Up: Expressions
  530.  
  531. Operators
  532. ---------
  533.  
  534.    The linker recognizes  the standard C set of arithmetic operators,
  535. with the standard bindings and precedence levels:
  536.      precedence      associativity   Operators                Notes
  537.      (highest)
  538.      1               left            !  -  ~                  (1)
  539.      2               left            *  /  %
  540.      3               left            +  -
  541.      4               left            >>  <<
  542.      5               left            ==  !=  >  <  <=  >=
  543.      6               left            &
  544.      7               left            |
  545.      8               left            &&
  546.      9               left            ||
  547.      10              right           ? :
  548.      11              right           &=  +=  -=  *=  /=       (2)
  549.      (lowest)
  550.    Notes: (1) Prefix operators (2) *Note Assignment::
  551.  
  552. 
  553. File: ld.info,  Node: Evaluation,  Next: Assignment,  Prev: Operators,  Up: Expressions
  554.  
  555. Evaluation
  556. ----------
  557.  
  558.    The linker uses "lazy evaluation" for expressions; it only calculates
  559. an expression when absolutely necessary.  The linker needs the value of
  560. the start address, and the lengths of memory regions, in order to do any
  561. linking at all; these values are computed as soon as possible when the
  562. linker reads in the command file.  However, other values (such as symbol
  563. values) are not known or needed until after storage allocation.  Such
  564. values are evaluated later, when other information (such as the sizes of
  565. output sections) is available for use in the symbol assignment
  566. expression.
  567.  
  568. 
  569. File: ld.info,  Node: Assignment,  Next: Built-ins,  Prev: Evaluation,  Up: Expressions
  570.  
  571. Assignment: Defining Symbols
  572. ----------------------------
  573.  
  574.    You may create global symbols, and assign values (addresses) to
  575. global symbols, using any of the C assignment operators:
  576.  
  577. `SYMBOL  = EXPRESSION ;'
  578. `SYMBOL &= EXPRESSION ;'
  579. `SYMBOL += EXPRESSION ;'
  580. `SYMBOL -= EXPRESSION ;'
  581. `SYMBOL *= EXPRESSION ;'
  582. `SYMBOL /= EXPRESSION ;'
  583.    Two things distinguish assignment from other operators in `ld'
  584. expressions.
  585.    * Assignment may only be used at the root of an expression; `a=b+3;'
  586.      is allowed, but `a+b=3;' is an error.
  587.  
  588.    * You must place a trailing semicolon (";") at the end of an
  589.      assignment statement.
  590.  
  591.    Assignment statements may appear:
  592.    * as commands in their own right in an `ld' script; or
  593.  
  594.    * as independent statements within a `SECTIONS' command; or
  595.  
  596.    * as part of the contents of a section definition in a `SECTIONS'
  597.      command.
  598.  
  599.    The first two cases are equivalent in effect--both define a symbol
  600. with an absolute address.  The last case defines a symbol whose address
  601. is relative to a particular section (*note SECTIONS::.).
  602.  
  603.    When a linker expression is evaluated and assigned to a variable, it
  604. is given either an absolute or a relocatable type. An absolute
  605. expression type is one in which the symbol contains the value that it
  606. will have in the output file, a relocatable expression type is one in
  607. which the value is expressed as a fixed offset from the base of a
  608. section.
  609.  
  610.    The type of the expression is controlled by its position in the
  611. script file.  A symbol assigned within a section definition is created
  612. relative to the base of the section; a symbol assigned in any other
  613. place is created as an absolute symbol. Since a symbol created within a
  614. section definition is relative to the base of the section, it will
  615. remain relocatable if relocatable output is requested.  A symbol may be
  616. created with an absolute value even when assigned to within a section
  617. definition by using the absolute assignment function `ABSOLUTE'.  For
  618. example, to create an absolute symbol whose address is the last byte of
  619. an output section named `.data':
  620.      SECTIONS{ ...
  621.      .data :
  622.              {
  623.                      *(.data)
  624.                      _edata = ABSOLUTE(.) ;
  625.              }
  626.      ... }
  627.  
  628.    The linker tries to put off the evaluation of an assignment until all
  629. the terms in the source expression are known (*note Evaluation::.).  For
  630. instance, the sizes of sections cannot be known until after allocation,
  631. so assignments dependent upon these are not performed until after
  632. allocation. Some expressions, such as those depending upon the location
  633. counter "dot", `.' must be evaluated during allocation. If the result
  634. of an expression is required, but the value is not available, then an
  635. error results.  For example, a script like the following
  636.      SECTIONS { ...
  637.            text 9+this_isnt_constant :
  638.                      { ...
  639.                      }
  640.      ... }
  641.  
  642. will cause the error message "`Non constant expression for initial
  643. address'".
  644.  
  645. 
  646. File: ld.info,  Node: Built-ins,  Prev: Assignment,  Up: Expressions
  647.  
  648. Built-In Functions
  649. ------------------
  650.  
  651.    The command language includes a number of built-in functions for use
  652. in link script expressions.
  653. `ABSOLUTE(EXP)'
  654.      Return the absolute (non-relocatable, as opposed to non-negative)
  655.      value of the expression EXP.  Primarily useful to assign an
  656.      absolute value to a symbol within a section definition, where
  657.      symbol values are normally section-relative.
  658.  
  659. `ADDR(SECTION)'
  660.      Return the absolute address of the named SECTION.  Your script must
  661.      previously have defined the location of that section. In the
  662.      following example, `symbol_1' and `symbol_2' are assigned identical
  663.      values:
  664.           SECTIONS{ ...
  665.                   .output1 :
  666.                           {
  667.                           start_of_output_1 = ABSOLUTE(.);
  668.                           ...
  669.                           }
  670.                   .output :
  671.                           {
  672.                           symbol_1 = ADDR(.output1);
  673.                           symbol_2 = start_of_output_1;
  674.                           }
  675.           ... }
  676.  
  677. `ALIGN(EXP)'
  678.      Return the result of the current location counter (`.') aligned to
  679.      the next EXP boundary.  EXP must be an expression whose value is a
  680.      power of two.  This is equivalent to
  681.           (. + EXP - 1) & ~(EXP - 1)
  682.  
  683.      `ALIGN' doesn't change the value of the location counter--it just
  684.      does arithmetic on it.  As an example, to align the output `.data'
  685.      section to the next `0x2000' byte boundary after the preceding
  686.      section and to set a variable within the section to the next
  687.      `0x8000' boundary after the input sections:
  688.           SECTIONS{ ...
  689.                   .data ALIGN(0x2000): {
  690.                           *(.data)
  691.                           variable = ALIGN(0x8000);
  692.                   }
  693.           ... }
  694.  
  695.      The first use of `ALIGN' in this example specifies the location of
  696.      a section because it is used as the optional START attribute of a
  697.      section definition (*note Section Options::.).  The second use
  698.      simply defines the value of a variable.
  699.  
  700.      The built-in `NEXT' is closely related to `ALIGN'.
  701.  
  702. `DEFINED(SYMBOL)'
  703.      Return 1 if SYMBOL is in the linker global symbol table and is
  704.      defined, otherwise return 0.  You can use this function to provide
  705.      default values for symbols.  For example, the following
  706.      command-file fragment shows how to set a global symbol `begin' to
  707.      the first location in the `.text' section--but if a symbol called
  708.      `begin' already existed, its value is preserved:
  709.           SECTIONS{ ...
  710.                   .text : {
  711.                           begin = DEFINED(begin) ? begin : . ;
  712.                           ...
  713.                   }
  714.           ... }
  715.  
  716. `NEXT(EXP)'
  717.      Return the next unallocated address that is a multiple of EXP.
  718.      This function is closely related to `ALIGN(EXP)'; unless you use
  719.      the `MEMORY' command to define discontinuous memory for the output
  720.      file, the two functions are equivalent.
  721.  
  722. `SIZEOF(SECTION)'
  723.      Return the size in bytes of the named SECTION, if that section has
  724.      been allocated.  In the following example, `symbol_1' and
  725.      `symbol_2' are assigned identical values:
  726.           SECTIONS{ ...
  727.                   .output {
  728.                           .start = . ;
  729.                           ...
  730.                           .end = . ;
  731.                           }
  732.                   symbol_1 = .end - .start ;
  733.                   symbol_2 = SIZEOF(.output);
  734.           ... }
  735.  
  736. `SIZEOF_HEADERS'
  737. `sizeof_headers'
  738.      Return the size in bytes of the output file's headers.  You can
  739.      use this number as the start address of the first section, if you
  740.      choose, to facilitate paging.
  741.  
  742. 
  743. File: ld.info,  Node: MEMORY,  Next: SECTIONS,  Prev: Expressions,  Up: Commands
  744.  
  745. MEMORY Command
  746. ==============
  747.  
  748.    The linker's default configuration permits allocation of all
  749. available memory.  You can override this configuration by using the
  750. `MEMORY' command.  The `MEMORY' command describes the location and size
  751. of blocks of memory in the target.  By using it carefully, you can
  752. describe which memory regions may be used by the linker, and which
  753. memory regions it must avoid.  The linker does not shuffle sections to
  754. fit into the available regions, but does move the requested sections
  755. into the correct regions and issue errors when the regions become too
  756. full.
  757.  
  758.    The command files may contain at most one use of the `MEMORY'
  759. command; however, you can define as many blocks of memory within it as
  760. you wish.  The syntax is:
  761.  
  762.      MEMORY
  763.            {
  764.             NAME (ATTR) : ORIGIN = ORIGIN, LENGTH = LEN
  765.             ...
  766.            }
  767.  
  768. `NAME'
  769.      is a name used internally by the linker to refer to the region. Any
  770.      symbol name may be used.  The region names are stored in a separate
  771.      name space, and will not conflict with symbols, file names or
  772.      section names.  Use distinct names to specify multiple regions.
  773.  
  774. `(ATTR)'
  775.      is an optional list of attributes, permitted for compatibility
  776.      with the AT&T linker but not used by `ld' beyond checking that the
  777.      attribute list is valid.  Valid attribute lists must be made up of
  778.      the characters "`LIRWX'".  If you omit the attribute list, you may
  779.      omit the parentheses around it as well.
  780.  
  781. `ORIGIN'
  782.      is the start address of the region in physical memory.  It is an
  783.      expression that must evaluate to a constant before memory
  784.      allocation is performed. The keyword `ORIGIN' may be abbreviated
  785.      to `org' or `o'.
  786.  
  787. `LEN'
  788.      is the size in bytes of the region (an expression).  The keyword
  789.      `LENGTH' may be abbreviated to `len' or `l'.
  790.  
  791.    For example, to specify that memory has two regions available for
  792. allocation--one starting at 0 for 256 kilobytes, and the other starting
  793. at `0x40000000' for four megabytes:
  794.  
  795.      MEMORY
  796.              {
  797.              rom : ORIGIN = 0, LENGTH = 256K
  798.              ram : org = 0x40000000, l = 4M
  799.              }
  800.  
  801.    Once you have defined a region of memory named MEM, you can direct
  802. specific output sections there by using a command ending in `>MEM'
  803. within the `SECTIONS' command (*note Section Options::.).  If the
  804. combined output sections directed to a region are too big for the
  805. region, the linker will issue an error message.
  806.  
  807. 
  808. File: ld.info,  Node: SECTIONS,  Next: Entry Point,  Prev: MEMORY,  Up: Commands
  809.  
  810. SECTIONS Command
  811. ================
  812.  
  813.    The `SECTIONS' command controls exactly where input sections are
  814. placed into output sections, their order and to which output sections
  815. they are allocated.
  816.  
  817.    You may use at most one `SECTIONS' command in a commands file, but
  818. you can have as many statements within it as you wish.  Statements
  819. within the `SECTIONS' command can do one of three things:
  820.    * define the entry point;
  821.  
  822.    * assign a value to a symbol;
  823.  
  824.    * describe the placement of a named output section, and what input
  825.      sections make it up.
  826.  
  827.    The first two possibilities--defining the entry point, and defining
  828. symbols--can also be done outside the `SECTIONS' command: *note Entry
  829. Point::., *note Assignment::..  They are permitted here as well for
  830. your convenience in reading the script, so that symbols or the entry
  831. point can be defined at meaningful points in your output-file layout.
  832.  
  833.    When no `SECTIONS' command is specified, the default action of the
  834. linker is to place each input section into an identically named output
  835. section in the order that the sections are first encountered in the
  836. input files; if all input sections are present in the first file, for
  837. example, the order of sections in the output file will match the order
  838. in the first input file.
  839.  
  840. * Menu:
  841.  
  842. * Section Definition::          Section Definitions
  843. * Section Contents::            Section Contents
  844. * Section Options::             Optional Section Attributes
  845.  
  846. 
  847. File: ld.info,  Node: Section Definition,  Next: Section Contents,  Up: SECTIONS
  848.  
  849. Section Definitions
  850. -------------------
  851.  
  852.    The most frequently used statement in the `SECTIONS' command is the
  853. "section definition", which you can use to specify the properties of an
  854. output section: its location, alignment, contents, fill pattern, and
  855. target memory region.  Most of these specifications are optional; the
  856. simplest form of a section definition is
  857.      SECTIONS { ...
  858.      SECNAME : {
  859.                       CONTENTS
  860.                      }
  861.      ... }
  862.  
  863. SECNAME is the name of the output section, and CONTENTS a specification
  864. of what goes there--for example, a list of input files or sections of
  865. input files.  As you might assume, the whitespace shown is optional.
  866. You do need the colon `:' and the braces `{}', however.
  867.  
  868.    SECNAME must meet the constraints of your output format.  In formats
  869. which only support a limited number of sections, such as `a.out', the
  870. name must be one of the names supported by the format (`a.out', for
  871. example, allows only `.text', `.data' or `.bss'). If the output format
  872. supports any number of sections, but with numbers and not names (as is
  873. the case for Oasys), the name should be supplied as a quoted numeric
  874. string.  A section name may consist of any sequence characters, but any
  875. name which does not conform to the standard `ld' symbol name syntax
  876. must be quoted.  *Note Symbol Names: Symbols.
  877.  
  878. 
  879. File: ld.info,  Node: Section Contents,  Next: Section Options,  Prev: Section Definition,  Up: SECTIONS
  880.  
  881. Section Contents
  882. ----------------
  883.  
  884.    In a section definition, you can specify the contents of an output
  885. section by listing particular object files, by listing particular
  886. input-file sections, or by a combination of the two.  You can also
  887. place arbitrary data in the section, and define symbols relative to the
  888. beginning of the section.
  889.  
  890.    The CONTENTS of a section definition may include any of the
  891. following kinds of statement.  You can include as many of these as you
  892. like in a single section definition, separated from one another by
  893. whitespace.
  894.  
  895. `FILENAME'
  896.      You may simply name a particular input file to be placed in the
  897.      current output section; *all* sections from that file are placed
  898.      in the current section definition. To specify a list of particular
  899.      files by name:
  900.           .data : { afile.o bfile.o cfile.o }
  901.  
  902.      The example also illustrates that multiple statements can be
  903.      included in the contents of a section definition, since each file
  904.      name is a separate statement.
  905.  
  906.      If the file name has already been mentioned in another section
  907.      definition, with an explicit section name list, then only those
  908.      sections which have not yet been allocated are used.
  909.  
  910. `FILENAME( SECTION )'
  911. `FILENAME( SECTION, SECTION, ... )'
  912. `FILENAME( SECTION SECTION ... )'
  913.      You can name one or more sections from your input files, for
  914.      insertion in the current output section.  If you wish to specify a
  915.      list of input-file sections inside the parentheses, you may
  916.      separate the section names by either commas or whitespace.
  917.  
  918. `* (SECTION)'
  919. `* (SECTION, SECTION, ...)'
  920. `* (SECTION SECTION ...'
  921.      Instead of explicitly naming particular input files in a link
  922.      control script, you can refer to *all* files from the `ld' command
  923.      line: use `*' instead of a particular file name before the
  924.      parenthesized input-file section list.
  925.  
  926.      For example, to copy sections `1' through `4' from an Oasys file
  927.      into the `.text' section of an `a.out' file, and sections `13' and
  928.      `14' into the `.data' section:
  929.           SECTIONS {
  930.                   .text :{
  931.                           *("1" "2" "3" "4")
  932.                   }
  933.           
  934.                   .data :{
  935.                           *("13" "14")
  936.                   }
  937.           }
  938.  
  939.      If you have already explicitly included some files by name, `*'
  940.      refers to all *remaining* files--those whose places in the output
  941.      file have not yet been defined.
  942.  
  943. `[ SECTION ]'
  944. `[ SECTION, SECTION, ... ]'
  945. `[ SECTION SECTION ... ]'
  946.      This is an alternate notation to specify named sections from all
  947.      unallocated input files; its effect is exactly the same as that of
  948.      `* (SECTION...)'
  949.  
  950. `FILENAME`( COMMON )''
  951. `( COMMON )'
  952.      Specify where in your output file to place uninitialized data with
  953.      this notation.  `*(COMMON)' by itself refers to all uninitialized
  954.      data from all input files (so far as it is not yet allocated);
  955.      FILENAME`(COMMON)' refers to uninitialized data from a particular
  956.      file.  Both are special cases of the general mechanisms for
  957.      specifying where to place input-file sections: `ld' permits you to
  958.      refer to uninitialized data as if it were in an input-file section
  959.      named `COMMON', regardless of the input file's format.
  960.  
  961.    For example, the following command script arranges the output file
  962. into three consecutive sections, named `.text', `.data', and `.bss',
  963. taking the input for each from the correspondingly named sections of
  964. all the input files:
  965.      SECTIONS {
  966.        .text : { *(.text) }
  967.        .data : { *(.data) }
  968.        .bss :  { *(.bss)  *(COMMON) }
  969.      }
  970.  
  971.    The following example reads all of the sections from file `all.o'
  972. and places them at the start of output section `outputa' which starts
  973. at location `0x10000'. All of section `.input1' from file `foo.o'
  974. follows immediately, in the same output section.  All of section
  975. `.input2' from `foo.o' goes into output section `outputb', followed by
  976. section `.input1' from `foo1.o'.  All of the remaining `.input1' and
  977. `.input2' sections from any files are written to output section
  978. `outputc'.
  979.  
  980.      SECTIONS {
  981.              outputa 0x10000 :
  982.                      {
  983.                      all.o
  984.                      foo.o (.input1)
  985.                      }
  986.              outputb :
  987.                      {
  988.                      foo.o (.input2)
  989.                      foo1.o (.input1)
  990.                      }
  991.              outputc :
  992.                      {
  993.                      *(.input1)
  994.                      *(.input2)
  995.                      }
  996.      }
  997.  
  998.    There are still more kinds of statements permitted in the contents of
  999. output section definitions.  The foregoing statements permitted you to
  1000. arrange, in your output file, data originating from your input files.
  1001. You can also place data directly in an output section from the link
  1002. command script.  Most of these additional statements involve
  1003. expressions; *note Expressions::..  Although these statements are shown
  1004. separately here for ease of presentation, no such segregation is needed
  1005. within a section definition in the `SECTIONS' command; you can intermix
  1006. them freely with any of the statements we've just described.
  1007.  
  1008. `CREATE_OBJECT_SYMBOLS'
  1009.      Create a symbol for each input file in the current section, set to
  1010.      the address of the first byte of data written from the input file.
  1011.      For instance, with `a.out' files it is conventional to have a
  1012.      symbol for each input file.  You can accomplish this by defining
  1013.      the output `.text' section as follows:
  1014.           SECTIONS {
  1015.                   .text 0x2020 :
  1016.                            {
  1017.                           CREATE_OBJECT_SYMBOLS
  1018.                           *(.text)
  1019.                           _etext = ALIGN(0x2000);
  1020.                           }
  1021.                   ...
  1022.           }
  1023.  
  1024.      If `objsym' is a file containing this script, and `a.o', `b.o',
  1025.      `c.o', and `d.o' are four input files with contents like the
  1026.      following--
  1027.           /* a.c */
  1028.           
  1029.           afunction() { }
  1030.           int adata=1;
  1031.           int abss;
  1032.  
  1033.      `ld -M sample a.o b.o c.o d.o' would create a map like this,
  1034.      containing symbols matching the object file names:
  1035.           00000000 A __DYNAMIC
  1036.           00004020 B _abss
  1037.           00004000 D _adata
  1038.           00002020 T _afunction
  1039.           00004024 B _bbss
  1040.           00004008 D _bdata
  1041.           00002038 T _bfunction
  1042.           00004028 B _cbss
  1043.           00004010 D _cdata
  1044.           00002050 T _cfunction
  1045.           0000402c B _dbss
  1046.           00004018 D _ddata
  1047.           00002068 T _dfunction
  1048.           00004020 D _edata
  1049.           00004030 B _end
  1050.           00004000 T _etext
  1051.           00002020 t a.o
  1052.           00002038 t b.o
  1053.           00002050 t c.o
  1054.           00002068 t d.o
  1055.  
  1056. `SYMBOL = EXPRESSION ;'
  1057. `SYMBOL F= EXPRESSION ;'
  1058.      SYMBOL is any symbol name (*note Symbols::.).  "F=" refers to any
  1059.      of the operators `&= += -= *= /=' which combine arithmetic and
  1060.      assignment.
  1061.  
  1062.      When you assign a value to a symbol within a particular section
  1063.      definition, the value is relative to the beginning of the section
  1064.      (*note Assignment::.).  If you write
  1065.           SECTIONS {
  1066.             abs = 14 ;
  1067.             ...
  1068.             .data : { ... rel = 14 ; ... }
  1069.             abs2 = 14 + ADDR(.data);
  1070.             ...
  1071.           }
  1072.  
  1073.      `abs' and `rel' do not have the same value; `rel' has the same
  1074.      value as `abs2'.
  1075.  
  1076. `BYTE(EXPRESSION)'
  1077. `SHORT(EXPRESSION)'
  1078. `LONG(EXPRESSION)'
  1079.      By including one of these three statements in a section
  1080.      definition, you can explicitly place one, two, or four bytes
  1081.      (respectively) at the current address of that section.
  1082.  
  1083.      Multiple-byte quantities are represented in whatever byte order is
  1084.      appropriate for the output file format (*note BFD::.).
  1085.  
  1086. `FILL(EXPRESSION)'
  1087.      Specifies the "fill pattern" for the current section.  Any
  1088.      otherwise unspecified regions of memory within the section (for
  1089.      example, regions you skip over by assigning a new value to the
  1090.      location counter `.') are filled with the two least significant
  1091.      bytes from the EXPRESSION argument.  A `FILL' statement covers
  1092.      memory locations *after* the point it occurs in the section
  1093.      definition; by including more than one `FILL' statement, you can
  1094.      have different fill patterns in different parts of an output
  1095.      section.
  1096.  
  1097. 
  1098. File: ld.info,  Node: Section Options,  Prev: Section Contents,  Up: SECTIONS
  1099.  
  1100. Optional Section Attributes
  1101. ---------------------------
  1102.  
  1103.    Here is the full syntax of a section definition, including all the
  1104. optional portions:
  1105.  
  1106.      SECTIONS {
  1107.      ...
  1108.      SECNAME START BLOCK(ALIGN) (NOLOAD) : { CONTENTS } =FILL >REGION
  1109.      ...
  1110.      }
  1111.  
  1112.    SECNAME and CONTENTS are required.  *Note Section Definition::, and
  1113. *note Section Contents::. for details on CONTENTS.  The remaining
  1114. elements--START, `BLOCK(ALIGN)', `(NOLOAD)' `=FILL', and `>REGION'--are
  1115. all optional.
  1116.  
  1117. `START'
  1118.      You can force the output section to be loaded at a specified
  1119.      address by specifying START immediately following the section name.
  1120.      sTART can be represented as any expression. The following example
  1121.      generates section OUTPUT at location `0x40000000':
  1122.           SECTIONS {
  1123.                   ...
  1124.                   output 0x40000000: {
  1125.                          ...
  1126.                     }
  1127.                   ...
  1128.           }
  1129.  
  1130. `BLOCK(ALIGN)'
  1131.      You can include `BLOCK()' specification to advance the location
  1132.      counter `.' prior to the beginning of the section, so that the
  1133.      section will begin at the specified alignment.  ALIGN is an
  1134.      expression.
  1135.  
  1136. `(NOLOAD)'
  1137.      Use `(NOLOAD)' to prevent a section from being loaded into memory
  1138.      each time it is accessed.  For example, in the script sample
  1139.      below, the `ROM' segment is addressed at memory location `0' and
  1140.      does not need to be loaded into each object file:
  1141.           SECTIONS {
  1142.                   ROM  0  (NOLOAD)  : { ... }
  1143.                   ...
  1144.           }
  1145.  
  1146. `=FILL'
  1147.      Including `=FILL' in a section definition specifies the initial
  1148.      fill value for that section.  You may use any expression to
  1149.      specify FILL.  Any unallocated holes in the current output section
  1150.      when written to the output file will be filled with the two least
  1151.      significant bytes of the value, repeated as necessary.  You can
  1152.      also change the fill value with a `FILL' statement in the CONTENTS
  1153.      of a section definition.
  1154.  
  1155. `>REGION'
  1156.      Assign this section to a previously defined region of memory.
  1157.      *Note MEMORY::.
  1158.  
  1159. 
  1160. File: ld.info,  Node: Entry Point,  Next: Other Commands,  Prev: SECTIONS,  Up: Commands
  1161.  
  1162. The Entry Point
  1163. ===============
  1164.  
  1165.    The linker command language includes a command specifically for
  1166. defining the first executable instruction in an output file (its "entry
  1167. point").  Its argument is a symbol name:
  1168.      ENTRY(SYMBOL)
  1169.  
  1170.    Like symbol assignments, the `ENTRY' command may be placed either as
  1171. an independent command in the command file, or among the section
  1172. definitions within the `SECTIONS' command--whatever makes the most
  1173. sense for your layout.
  1174.  
  1175.    `ENTRY' is only one of several ways of choosing the entry point.
  1176. You may indicate it in any of the following ways (shown in descending
  1177. order of priority: methods higher in the list override methods lower
  1178. down).
  1179.    * the `-e' ENTRY command-line option;
  1180.  
  1181.    * the `ENTRY(SYMBOL' command in a linker control script;
  1182.  
  1183.    * the value of the symbol `start', if present;
  1184.  
  1185.    * the value of the symbol `_main', if present;
  1186.  
  1187.    * the address of the first byte of the `.text' section, if present;
  1188.  
  1189.    * The address `0'.
  1190.  
  1191.    For example, you can use these rules to generate an entry point with
  1192. an assignment statement: if no symbol `start' is defined within your
  1193. input files, you can simply define it, assigning it an appropriate
  1194. value--
  1195.      start = 0x2020;
  1196.  
  1197. The example shows an absolute address, but you can use any expression.
  1198. For example, if your input object files use some other symbol-name
  1199. convention for the entry point, you can just assign the value of
  1200. whatever symbol contains the start address to `start':
  1201.      start = other_symbol ;
  1202.  
  1203. 
  1204. File: ld.info,  Node: Other Commands,  Prev: Entry Point,  Up: Commands
  1205.  
  1206. Other Commands
  1207. ==============
  1208.  
  1209.    The command language includes a number of other commands that you can
  1210. use for specialized purposes.  They are similar in purpose to
  1211. command-line options.
  1212.  
  1213. `FLOAT'
  1214. `NOFLOAT'
  1215.      These keywords were used in some older linkers to request a
  1216.      particular math subroutine library.  `ld' doesn't use the
  1217.      keywords, assuming instead that any necessary subroutines are in
  1218.      libraries specified using the general mechanisms for linking to
  1219.      archives; but to permit the use of scripts that were written for
  1220.      the older linkers, the keywords `FLOAT' and `NOFLOAT' are accepted
  1221.      and ignored.
  1222.  
  1223. `FORCE_COMMON_ALLOCATION'
  1224.      This command has the same effect as the `-d' command-line option:
  1225.      to make `ld' assign space to common symbols even if a relocatable
  1226.      output file is specified (`-r').
  1227.  
  1228. `INPUT ( FILE, FILE, ... )'
  1229. `INPUT ( FILE FILE ... )'
  1230.      Use this command to include binary input files in the link, without
  1231.      including them in a particular section definition.  Files
  1232.      specified this way are treated identically to object files listed
  1233.      on the command line.
  1234.  
  1235. `OUTPUT ( FILENAME )'
  1236.      Use this command to name the link output file FILENAME.  The
  1237.      effect of `OUTPUT(FILENAME)' is identical to the effect of
  1238.      `-o FILENAME', and whichever is encountered last will control the
  1239.      name actually used to name the output file.  In particular, you
  1240.      can use this command to supply a default output-file name other
  1241.      than `a.out'.
  1242.  
  1243. `OUTPUT_ARCH ( BFDNAME )'
  1244.      Specify a particular output machine architecture, with one of the
  1245.      names used by the BFD back-end routines (*note BFD::.).  This
  1246.      command is often unnecessary; the architecture is most often set
  1247.      implicitly by either the system BFD configuration or as a side
  1248.      effect of the `OUTPUT_FORMAT' command.
  1249.  
  1250. `OUTPUT_FORMAT ( BFDNAME )'
  1251.      Specify a particular output format, with one of the names used by
  1252.      the BFD back-end routines (*note BFD::.).  This selection will
  1253.      only affect the output file; the related command `TARGET' affects
  1254.      primarily input files.
  1255.  
  1256. `SEARCH_DIR ( PATH )'
  1257.      Add PATH to the list of paths where `ld' looks for archive
  1258.      libraries.  `SEARCH_DIR(PATH)' has the same effect as `-LPATH' on
  1259.      the command line.
  1260.  
  1261. `STARTUP ( FILENAME )'
  1262.      Ensure that FILENAME is the first input file used in the link
  1263.      process.
  1264.  
  1265. `TARGET ( FORMAT )'
  1266.      Change the input-file object code format (like the command-line
  1267.      option `-b' or its synonym `-format').  The argument FORMAT is one
  1268.      of the strings used by BFD to name binary formats.  In the current
  1269.      `ld' implementation, if `TARGET' is specified but `OUTPUT_FORMAT'
  1270.      is not, the last `TARGET' argument is also used as the default
  1271.      format for the `ld' output file.  *Note BFD::.
  1272.  
  1273.      If you don't use the `TARGET' command, `ld' uses the value of the
  1274.      environment variable `GNUTARGET', if available, to select the
  1275.      output file format.  If that variable is also absent, `ld' uses
  1276.      the default format configured for your machine in the BFD
  1277.      libraries.
  1278.  
  1279.