unixdev.net


Switch to SpeakEasy.net DSL

The Modular Manual Browser

Home Page
Manual: (HP-UX-11.11)
Page:
Section:
Apropos / Subsearch:
optional field



 ld(1)								       ld(1)




 NAME
      ld - link editor

 SYNOPSIS
    The link editor.  Common options:
      ld [-bdmnqrstvxzEGIOPQVZ] [-a search] [-c filename] [-dynamic]
	   [-e epsym] [-h symbol] ...  [-lx | file] ...	 [-l: library]
	   [-m] [-noshared] [-o outfile] [-u symbol] ...  [-y symbol] ...
	   [-B bind] [-D offset] [-L dir] ...  [-R offset] [-Pd] [-PD file]
	   [-PF file] [+b path_list] [+compat] [+copyobjdebug] [+df file]
	   [+e symbol] [+ee symbol] [+fb] [+fbu] [+gst]
	   [+gstsize size] [+h internal_name] [+help] [+k] [+n]
	   [+nocopyobjdebug] [+noobjdebug] [+objdebugonly] [+pd size]
	   [+pgm name] [+pi size] [+s] [+std] [+tools] [+v[no]shlibunsats]
	   [+vallcompatwarnings] [+v[no]compatwarnings] [+FP flag]
	   [+I symbol] [+O[no]fastaccess] [+O[no]procelim] [ +Oreusedir=dir ]
	   [+Oselectivepercent n] [+Oselectivesize size] [+OselectiveO3]
	   [+Ostaticprediction]

    32 Bit (SOM) Link Editor options:
      ld [-NST] [-A name] [-C n] [-Fl] [-Fw] [-Fz] [+cdp oldpath:newpath]
	   [+cg pathname] [+dpv] [+filter shared_library_path]
	   [+gstbuckets size] [+nosmartbind] [+plabel_cache flag]

    64 Bit (ELF) Link Editor options:
      ld [-k filename] [+fini function] [+ild] [+ildnowarn] [+ildpad
	   percentage] [+ildrelink] [+init function] [+interp file]
	   [+[no]allowunsats] [+[no]forceload] [+hideallsymbols]
	   [+nodefaultmap] [+noenvvar] [+nodynhash] [+nosectionmerge]
	   [+paddata pagesize] [+padtext pagesize] [+pdzero] [+stripunwind]
	   [+vtype type]

 DESCRIPTION
      ld takes one or more object files or libraries as input and combines
      them to produce a single (usually executable) file.  In doing so it
      resolves references to external symbols, assigns final addresses to
      procedures and variables, revises code and data to reflect new
      addresses (a process called "relocation"), and updates symbolic debug
      information when present in the file.  By default, ld produces an
      executable file that can be run by the HP-UX loader exec() (see
      exec(2)).	 Alternatively, the linker can generate a relocatable file
      that is suitable for further processing by ld (see -r below).  It can
      also generate a shared library (see -b below).  The linker marks the
      output file non-executable if there are any duplicate symbols or any
      unresolved external references remain.  ld may or may not generate an
      output file (see +k option) if any other errors occur during its
      operation.

      ld recognizes three kinds of input files: object files created by the
      compilers, assembler, or linker (also known as .o files), shared
      libraries created by the linker, and archives of object files (called



 Hewlett-Packard Company	    - 1 -   HP-UX Release 11i: November 2000






 ld(1)								       ld(1)




      archive libraries).  An archive library contains a table of all the
      externally-visible symbols from its component object files.  (The
      archiver command ar(1) creates and maintains this index.) ld uses this
      table to resolve references to external symbols.

      ld processes files in the same order as they appear on the command
      line.  It includes code and data from an archive library element if
      and only if that object module provides a definition for a currently
      unresolved reference within the user's program.  It is common practice
      to list libraries following the names of all simple object files on
      the command line.

      Code and data from shared libraries is never copied into an executable
      program.	The dynamic loader /usr/lib/dld.sl on 32-bit links is
      invoked at startup time by the startup file crt0.o if a program uses
      shared libraries.	 Identical copies of crt0.o can be found in either
      /usr/ccs/lib/crt0.o or /opt/langtools/lib/crt0.o.	 For 64-bit mode,
      the dynamic loader is /usr/lib/pa20_64/dld.sl and is invoked by exec
      for those programs that use shared libraries.  crt0.o is not required
      in shared bound links.  The dynamic loader attaches each required
      library to the process and resolves all symbolic references between
      the program and its libraries.

      The text segment of a shared library is shared among all processes
      that use the library; each process using the library receives its own
      copy of the data segment.	 If pxdb -s on has been run on the
      executable that loads the library, the text segment of a shared
      library is mapped privately for each process running the executable.
      ld recursively examines the dependencies of shared libraries used by a
      program that was created by ld.  If ld does not find a supporting
      shared library at the path recorded in the dependency list of a shared
      library, and if the dependency is the result of an -l argument used
      when the shared library was created, ld will search all the
      directories that it would search for a library that was specified with
      -l (see -L and LPATH).

    Environment Variables
      Arguments can be passed to the linker through the LDOPTS environment
      variable as well as on the command line.	The linker gets the value of
      LDOPTS and places its contents before any arguments on the command
      line.

      The LD_PXDB environment variable defines the full execution path for
      the debug preprocessor pxdb.  The default value is
      /opt/langtools/bin/pxdb.	ld invokes pxdb on its output file if that
      file is executable and contains debug information.  To defer
      invocation of pxdb until the first debug session, set LD_PXDB to
      /bin/true.

      The LPATH environment variable can be used to specify default
      directories to search for library files. See the -l option.



 Hewlett-Packard Company	    - 2 -   HP-UX Release 11i: November 2000






 ld(1)								       ld(1)




    Options
      The common ld options are listed first, followed by the options
      supported only in a 32-bit linker, and then the options only supported
      in a 64-bit linker.

	   -a search	  Specify whether shared or archive libraries are
			  searched with the -l option.	The value of search
			  should be one of archive, shared, archive_shared,
			  shared_archive, or default.  This option can
			  appear more than once, interspersed among -l
			  options, to control the searching for each
			  library.  The default is to use the shared version
			  of a library if one is available, or the archive
			  version if not.

			  If either archive or shared is active, only the
			  specified library type is accepted.

			  If archive_shared is active, the archive form is
			  preferred, but the shared form is allowed.

			  If shared_archive is active, the shared form is
			  preferred but the archive form is allowed.

	   -b		  Create a shared library rather than a normal
			  executable file.  Object files processed with this
			  option must contain position-independent code
			  (PIC).  See the discussion of PIC in cc(1), CC(1)
			  (part of the optional C++ compiler documentation),
			  f77(1), pc(1), as(1), and Linker and Libraries
			  Online User Guide.

	   -c filename	  Read ld options from a file.	Each line contains
			  zero or more arguments separated by white space.
			  Each line in the file, including the last line,
			  must end with a newline character.  A # character
			  implies that the rest of the line is a comment.
			  To escape a # character, use the sequence ##.

	   -d		  Force definition of ``common'' storage; that is,
			  assign addresses and sizes, for -r output.

	   -e epsym	  Set the default entry point address for the output
			  file to be that of the symbol epsym.	(This option
			  only applies to executable files.)

	   -h symbol	  Prior to writing the symbol table to the output
			  file, mark this name as ``local'' so that it is no
			  longer externally visible.  This ensures that this
			  particular entry will not clash with a definition
			  in another file during future processing by ld.



 Hewlett-Packard Company	    - 3 -   HP-UX Release 11i: November 2000






 ld(1)								       ld(1)




			  More than one symbol can be specified, but -h must
			  precede each one.  If used when building a shared
			  library or program, this option prevents the named
			  symbol from being visible to the dynamic loader.

	   -lx		  Search a library libx.a or libx.sl, where x is one
			  or more characters.  The current state of the -a
			  option determines whether the archive (.a) or
			  shared (.sl) version of a library is searched.
			  Because a library is searched when its name is
			  encountered, the placement of a -l is significant.
			  By default, 32-bit libraries are located in
			  /usr/lib and /usr/ccs/lib.  64-bit libraries are
			  located in /usr/lib/pa20_64.	If the environment
			  variable LPATH is present in the user's
			  environment, it should contain a colon-separated
			  list of directories to search.  These directories
			  are searched instead of the default directories,
			  but -L options can still be used.  If a program
			  uses shared libraries, the dynamic loader
			  /usr/lib/dld.sl for 32-bit or
			  /usr/lib/pa20_64/dld.sl for 64-bit will attempt to
			  load each library from the same directory in which
			  it was found at link time (see the +s and +b
			  options).

	   -l: library	  Search the library specified. Similar to the -l
			  option except the current state of the -a option
			  is not important. The library name can be any
			  valid filename. (Note that previous releases
			  required that the library name contain the prefix
			  lib and end with a suffix of .a or .sl.)

	   -m		  This option produces a load map on the standard
			  output.

	   -n		  This option is accepted but ignored by the 64-bit
			  ld.  Generate an executable output file with file
			  type SHARE_MAGIC.  This is the default.  This
			  option is incompatible with -N and -q.

	   -o outfile	  Produce an output object file named outfile (a.out
			  if -o outfile is not specified).

	   -q		  This option is ignored for 64-bit links.  Generate
			  an executable output file with file type
			  DEMAND_MAGIC.	 This option is incompatible with -
			  n, -N, and -Q.

	   -r		  Retain relocation information in the output file
			  for subsequent re-linking.  The ld command does



 Hewlett-Packard Company	    - 4 -   HP-UX Release 11i: November 2000






 ld(1)								       ld(1)




			  not report undefined symbols.	 This option cannot
			  be used when building a shared library ( -b ) or
			  in conjunction with -A or +ild incremental linking
			  options.

	   -s		  Strip the output file of all symbol table,
			  relocation, and debug support information.  This
			  might impair or prevent the use of a symbolic
			  debugger on the resulting program.  This option is
			  incompatible with -r.	 (The strip(1) command also
			  removes this information.) This option is
			  incompatible with +ild.  (The incremental linking
			  requires the parts of the output load module which
			  are stripped out with -s option.)

	   -t		  Print a trace (to standard output) of each input
			  file as ld processes it.

	   -u symbol	  Enter symbol as an undefined symbol in the symbol
			  table.  The resulting unresolved reference is
			  useful for linking a program solely from object
			  files in a library.  More than one symbol can be
			  specified, but each must be preceded by -u.

	   -v		  Display verbose messages during linking.  For each
			  library module that is loaded, the linker
			  indicates which symbol caused that module to be
			  loaded.

	   -x		  Strip local symbols from the output file.  This
			  reduces the size of the output file without
			  impairing the effectiveness of object file
			  utilities.  This option is incompatible with the
			  -r option.  This option is incompatible with the
			  +ild option.	(The incremental linking requires
			  the parts of the output load module which are
			  stripped out with the -x option.

			  Note:	 use of -x might affect the use of a
			  debugger.

	   -y symbol	  Indicate each file in which symbol appears.  More
			  than one symbol can be specified, but each must be
			  preceded by -y.

	   -z		  Arrange for run-time dereferencing of null
			  pointers to produce a SIGSEGV signal.	 (This is
			  the complement of the -Z option.)

	   -B bind	  Select run-time binding behavior of a program
			  using shared libraries or the binding preference



 Hewlett-Packard Company	    - 5 -   HP-UX Release 11i: November 2000






 ld(1)								       ld(1)




			  in building a shared library.	 The most common
			  values for bind are:

			  deferred
			       Bind addresses on first reference rather than
			       at program start-up time. This is the
			       default.

			  immediate
			       Bind addresses of all symbols immediately
			       upon loading the library.  Commonly followed
			       by -B nonfatal to allow procedure calls that
			       cannot be resolved at program start-up to be
			       resolved on first reference.

			       Since -B nonfatal suppresses messages about
			       unresolved symbols, also specify -B verbose
			       to display those messages.

			       See the example below.

			  nonfatal
			       If also using -B immediate, for code symbols
			       that could not be bound at program startup,
			       defer binding them until they are referenced.
			       See description of -B immediate above.

			       Since -B nonfatal suppresses messages about
			       unresolved symbols, also specify -B verbose
			       to display those messages.

			  restricted
			       Causes the search for a symbol definition to
			       be restricted to those symbols that were
			       visible when the library was loaded.

			  symbolic
			       Used only when building a shared library
			       (with the -b option), this option causes all
			       unresolved symbols inside a library to be
			       resolved internally if possible.	 By default,
			       unresolved symbols are resolved to the most
			       visible definition in the library or outside
			       of the library.

			  verbose
			       Display verbose messages when binding
			       symbols. This is the default except when -B
			       nonfatal is specified. In that case, -B
			       verbose must be explicitly specified to get
			       verbose messages.



 Hewlett-Packard Company	    - 6 -   HP-UX Release 11i: November 2000






 ld(1)								       ld(1)




			  See the +help option or the HP-UX Linker and
			  Libraries User's Guide manual for more information
			  on the uses of binding modes.

	   -D offset	  Set the origin (in hexadecimal) for the data
			  segment.

			  When used with the +ild option, if you change the
			  offset after the initial incremental link, the
			  linker performs an initial incremental link
			  automatically.

	   -E		  This option is accepted but ignored by the 64-bit
			  ld.  Mark all symbols defined by a program for
			  export to shared libraries.  By default, ld marks
			  only those symbols that are actually referenced by
			  a shared library seen at link time.

	   -G		  Strip all unloadable data from the output file.
			  This option is typically used to strip debug
			  information.

	   -I		  Instrument the code to collect profile information
			  upon execution.  The profile data gathered during
			  program execution can be used in conjunction with
			  the -P option.  32-bit programs linked with this
			  option should use the startup file
			  /opt/langtools/lib/icrt0.o.  This option should
			  not be used with the -P, -A, -O, +ild, or +O
			  options.

	   -L dir	  Search for libx.a or libx.sl in dir before looking
			  in default locations.	 More than one directory can
			  be specified, but each must be preceded by -L.
			  The -L option is effective only if it precedes the
			  -l option on the command line.

	   -O		  Turn on linker optimizations.	 Currently the
			  optimizations include the elimination of
			  unnecessary ADDIL instructions from the code in
			  the executable file (32-bit only), and the removal
			  of dead procedures.

			  -O is passed to the linker by the compilers when
			  the +O4 compiler option is selected.

			  This option is incompatible with the +ild option.

			  For more details on linker optimizations refer to
			  the +help option or the HP-UX Linker and Libraries
			  User's Guide manual.



 Hewlett-Packard Company	    - 7 -   HP-UX Release 11i: November 2000






 ld(1)								       ld(1)




	   -P		  Examine the data file produced by an instrumented
			  program (see the -I option) to perform profile
			  based optimizations on the code.  This option
			  should not be used with the -A or +ild options.

	   -Q		  Ignored for 64-bit links. Generate an executable
			  output file with file type EXEC_MAGIC or
			  SHARE_MAGIC, depending on whether -N or -n is
			  specified.  This is the default.  This option is
			  incompatible with -q.

	   -R offset	  Set the origin (in hexadecimal) for the text
			  (i.e., code) segment.

			  When used with the +ild option, if you change the
			  offset  after the initial incremental link, the
			  linker performs an initial incremental link
			  automatically.

	   -V		  Output a message giving information about the
			  version of ld being used.

	   -Z		  Allow run-time dereferencing of null pointers.
			  See the discussions of -Z and pointers in cc(1).
			  (This is the complement of the -z option.)

	   -Pd		  Reorder debuggable functions.	 Ordinarily -P does
			  not reorder functions from .o files with debugging
			  information, because reordering renders them non-
			  debuggable.  This option overrides this and
			  reorders the functions.

	   -PD filename	  Save link order file generated by fdp during
			  linking with -P option into user-specified file.
			  This option is incompatible with the +ild option.

	   -PF filename	  Indicate to the linker to use the specified file
			  for the linker file instead of generating it using
			  /usr/ccs/bin/fdp.  This option is incompatible
			  with the +ild option.

	   -dynamic	  This allows the linker to create a program which
			  can use shared libraries.  This is the default for
			  64-bit links unless +compat is used.	In 32-bit
			  mode, the linker creates a static executable if
			  there are no shared libraries on the link line.

	   -noshared	  This option forces the linker to create a fully
			  archive bound program.





 Hewlett-Packard Company	    - 8 -   HP-UX Release 11i: November 2000






 ld(1)								       ld(1)




	   +b path_list	  Specify a colon-separated list of directories
			  (embedded path) to be searched at program run-time
			  to locate shared libraries needed by the
			  executable output file that were specified with
			  either the -l or -l: option.	An argument
			  consisting of a single colon (:) indicates that ld
			  should build the list using all the directories
			  specified by the -L option and the LPATH
			  environment variable (see the +s option).

	   +compat	  This option is ignored for 32-bit links.  This
			  option turns on compatibility mode in the linker -
			  64-bit links mimic behavior of 32-bit links).

	   +copyobjdebug  Copy objdebug space.

	   +df file	  Used together with the -P option, this option
			  specifies that file should be used as the profile
			  database file.  The default value is flow.data.
			  See the discussion of the FLOW_DATA environment
			  variable for more information.  This option is
			  incompatible with the +ild option.

	   +e symbol	  When building a shared library or program, mark
			  the symbol for export to the dynamic loader.	Only
			  symbols explicitly marked are exported.  When
			  building a shared library, calls to symbols that
			  are not exported are resolved internally.

	   +ee symbol	  This option is similar to the +e option in that it
			  exports a symbol. However, unlike the +e option,
			  +ee does not alter the visibility of any other
			  symbol in the file. In a 32-bit link or +compat
			  mode 64-bit link, it has the effect of exporting
			  the specified symbol without hiding any of the
			  symbols exported by default.	In a 64 +std link,
			  all symbols are exported by default, so +ee is not
			  necessary to make a symbol visible. However, it
			  has the additional side effect of identifying the
			  symbol as necessary, so that it will not be
			  removed when using dead code elimination
			  (+Oprocelim).	 Of course, +ee still retains its
			  export behavior if an option such as
			  +hideallsymbols is also given.

	   +fb		  Instructs the linker to run the fastbind tool on
			  the executable it has produced.  The executable
			  should be linked with shared libraries. For more
			  details refer to fastbind(1), the +help option, or
			  the HP-UX Linker and Libraries User's Guide
			  manual.  This option is incompatible with the +ild



 Hewlett-Packard Company	    - 9 -   HP-UX Release 11i: November 2000






 ld(1)								       ld(1)




			  option.

	   +fbu		  Pass the -u option to the fastbind tool. For more
			  details refer to fastbind(1), the +help option, or
			  the HP-UX Linker and Libraries User's Guide
			  manual.  This option is incompatible with the +ild
			  option.

	   +gst		  Enable the global symbol table hash mechanism,
			  used to look up values of symbol import/export
			  entries.  The +gst and related options provide
			  performance enhancements through use of global
			  symbol table which improves searching for exported
			  symbols.  See dld.sl(5) and the HP-UX Linker and
			  Libraries Online User Guide for more information.

	   +gstsize size  Request a particular hash array size using the
			  global symbol table hash mechanism.  The default
			  value is 1103.  The value can be overridden at
			  runtime by setting the _HP_DLDOPTS environment
			  variable to the value -symtab_size prime number.
			  You can set the value using chatr +gstsize size
			  file.

	   +h internal_name
			  When building a shared library, record
			  internal_name as the name of the library.  When
			  the library is used to link another executable
			  file (program or shared library), this
			  internal_name is recorded in the library list of
			  the resulting output file instead of the file
			  system pathname of the input shared library.

			  That is, if +h is not used, the shared library
			  does not have an internal name and when an
			  executable is built with the shared library, the
			  linker records the library name that it looks at.

			  If internal_name is a fully-qualified pathname, it
			  is recorded as is in the library list of any
			  executable file it is subsequently linked against.
			  internal_name is a relative pathname or no
			  directory component was specified, internal_name
			  is appended to the file system directory component
			  of the input shared library in the library list of
			  any executable file it is subsequently linked
			  against.

			  If more than one +h option is seen on the link
			  line, the first one is used and a warning message
			  is emitted.



 Hewlett-Packard Company	   - 10 -   HP-UX Release 11i: November 2000






 ld(1)								       ld(1)




	   +help	  Starts the help window utility HP-UX Linker and
			  Libraries Online User Guide which comes with some
			  HP compilers.	 (You must be running the X window
			  system and your DISPLAY environment variable must
			  be set to the name of your workstation or X
			  terminal.)  For more information, refer to the
			  HP-UX Linker and Libraries User's Guide manual.
			  See manuals(5) for ordering information.

	   +k		  Direct the linker to only create an executable if
			  there were no errors encountered during the link.
			  If there were errors found (system errors or
			  unresolved references), the output file will be
			  removed.

	   +n		  Causes the linker to load all object modules
			  before searching any archive or shared libraries.
			  Then it searches the archive and shared libraries
			  specified on the command line in left to right
			  order.  Repeats the left to right search of the
			  libraries on the command line until there are no
			  more unsatisfied symbols, or the last search added
			  no new definitions.  This option is useful if two
			  libraries are specified that have symbol
			  dependencies on each other.

	   +nocopyobjdebug
			  Do not copy objdebug space.  Use this option (with
			  -r object files on the link line) to suppress the
			  default behavior of copying LINKMAP space to the
			  executable file .

	   +noobjdebug	  Override the +objdebug compiler option, and copy
			  all debug information to the executable file.

			  When used with -g, +objdebug leaves debug
			  information in the object files instead of copying
			  it to the executable file at link time, resulting
			  in shorter link times and smaller executables. The
			  compile-time default, +noobjdebug, copies the
			  debug information to the executable file.

			  When you specify -g when compiling, the compiler
			  places symbolic debugging information into the
			  object files. By default, the linker calls pxdb
			  which compacts this debug information and  copies
			  it to the executable file. When +objdebug was used
			  at compile time, the linker leaves the debug
			  information in the object files.  To debug the
			  executable file, the HP WDB debugger must have
			  access to the object files. If you move the object



 Hewlett-Packard Company	   - 11 -   HP-UX Release 11i: November 2000






 ld(1)								       ld(1)




			  files, use HP WDB's objdir command to tell it
			  where the object files are. (The HP DDE debugger
			  does not support this option.) The +objdebug
			  option reduces link time and the size of the
			  executable file by avoiding this copying of debug
			  information.

			  The compile-time default is +noobjdebug.  If the
			  linker detects any object files that were compiled
			  with +objdebug, it leaves the debug information in
			  those files. Any object files not compiled with
			  +objdebug have their debug information copied into
			  the executable file. You can leave debug
			  information in some object files and not in
			  others.

			  When archive members are not compiled with
			  +objdebug (and they contain debug information,
			  that is, they were compiled with -g), the debug
			  information from the archive members is copied
			  into the a.out by default.  The linker does not
			  copy debug information from shared libraries into
			  the a.out, regardless of whether they are compiled
			  with +objdebug or +noobjdebug.

			  Use the +noobjdebug option when linking to
			  explicitly tell the linker to copy all debug
			  information to the executable file, even from
			  files compiled with +objdebug.

	   +objdebugonly  Ignore debug information from non-objdebug objects
			  or archives and proceed in +objdebug mode.  This
			  option can be passed from the C or C++ compiler
			  command line as -Wl,+objdebugonly.  If you are
			  debugging only files compiled with the +objdebug
			  option, +objdebugonly can improve link time by
			  instructing the linker to bypass the processing of
			  debug information from files compiled with
			  +noobjdebug.	With the +objdebugonly option, the
			  linker suppresses the call to pxdb.

	   +pd size	  Request a particular virtual memory page size that
			  should be used for data.  Sizes of 4K, 16K, 64K,
			  256K, 1M, 4M, 16M, 64M, 256M, D, and L are
			  supported.  A size of D allows the kernel to
			  choose what page size should be used.	 A size of L
			  will result in using the largest page size
			  available.  The actual page size may vary if the
			  requested size cannot be fulfilled.





 Hewlett-Packard Company	   - 12 -   HP-UX Release 11i: November 2000






 ld(1)								       ld(1)




	   +pgm name	  Used together with the -P option, this option
			  specifies that name should be used as the look-up
			  name in the profile database file.  The default is
			  the basename of the output file (specified by the
			  -o option.) This option is incompatible with the
			  +ild option.

	   +pi size	  Request a particular virtual memory page size that
			  should be used for instructions.  See the +pd
			  option for additional information.

	   +s		  Indicates that at run-time, the shared library
			  loader can use the environment variable SHLIB_PATH
			  and LD_LIBRARY_PATH (64-bit only) to locate shared
			  libraries needed by the executable output file
			  that were specified with either the -l or -l:
			  option. The environment variables should be set to
			  a colon-separated list of directories. If both +s
			  and +b are used, their relative order on the
			  command line indicates which path list will be
			  searched first (see the +b option).

	   +std		  This option is ignored for 32-bit links.  Turns on
			  standard mode, which is the default in 64-bit
			  mode.	 Options turned on with this option are: -
			  dynamic.  Options turned off or ignored when this
			  option is specified are: +compat,+noenvvar,-
			  noshared.

	   +vallcompatwarnings
			  This option is accepted but ignored by the 64-bit
			  ld.  Show more detail for any warnings about
			  compatibility issues.	 By default, only a terse
			  message is printed.  See the WARNINGS section
			  below for further details.

	   +v[no]compatwarnings
			  This option is accepted but ignored by the 64-bit
			  ld.  Enable [disable] printing warnings about
			  compatibility issues between systems.	 This
			  includes any functionality which may change in
			  future releases.  The default is +vcompatwarnings.
			  See the WARNINGS section below for further
			  details.

	   +v[no]shlibunsats
			  Enable [disable] printing a list of unsatisfied
			  symbols used by shared libraries.  The default is
			  +vnoshlibunsats.  Some unsatisfied symbols
			  reported by the linker are not required at run
			  time because the modules which reference the



 Hewlett-Packard Company	   - 13 -   HP-UX Release 11i: November 2000






 ld(1)								       ld(1)




			  symbols are not used.

	   +FP flag	  Specify how the environment for floating-point
			  operations should be initialized at program
			  start-up.  By default, all behaviors are disabled.
			  The following flags are supported (upper case flag
			  enables; lower case flag disables):

			  V (v)	    Trap on invalid floating-point
				    operations

			  Z (z)	    Trap on divide by zero

			  O (o)	    Trap on floating-point overflow

			  U (u)	    Trap on floating-point underflow

			  I (i)	    Trap on floating-point operations that
				    produce inexact results.

			  D (d)	    Enable sudden underflow (flush to zero)
				    of denormalized values.

				    Note: Enabling sudden underflow is an
				    undefined operation on PA-RISC 1.0-based
				    systems, but it is defined on all
				    subsequent versions of PA-RISC.
				    Selecting this flag enables sudden
				    underflow only if it is available on the
				    processor being used at run-time.

			  To dynamically change these settings at run-time,
			  see fesettrapenable(3M).

	   +I symbol	  Specify the name of the initializer function when
			  building a shared library.  A shared library may
			  have multiple initializers specified.
			  Initializers are executed in the order that they
			  are specified.  You can specify more than one
			  initializer, but each must be preceded by +I.	 For
			  more details on the initializer function, refer to
			  the +help option or the HP-UX Linker and Libraries
			  User's Guide manual.

	   +O[no]fastaccess
			  Enable [disable] fast access to global data.	The
			  linker rearranges the data to further reduce the
			  number of ADDIL instructions in the executable.

			  This optimization may reveal some subtle
			  programming errors related to assumptions about



 Hewlett-Packard Company	   - 14 -   HP-UX Release 11i: November 2000






 ld(1)								       ld(1)




			  data layout.	This optimization can occur at
			  optimization levels 2, 3 and 4.  The default is
			  +Onofastaccess at optimization levels 2 and 3, and
			  +Ofastaccess at optimization level 4.

			  Using the +Ofastaccess option in the presence of
			  debug information generates a warning message and
			  can cause corruption of the debug information.
			  Avoid using +Ofastaccess with the -g option.

			  This option is accepted but ignored by the 64-bit
			  ld.

	   +O[no]procelim Enable [disable] the elimination of procedures
			  that are not referenced by the application.  The
			  default is +Onoprocelim.  Procedure elimination
			  can occur at any optimization level, including
			  level 0.  For more details refer to the +help
			  option or the HP-UX Linker and Libraries User's
			  Guide manual.	 This option is incompatible with
			  the +ild option.

	   +Oreusedir=dir Specify the name of the directory to use as the
			  reuse repository for the object code reuse
			  feature.  This directory holds the compiled object
			  files for reuse.  dir can be an absolute or
			  relative path to directory where you invoked the
			  linker.  The +Oreusedir option shortens link time
			  by not recompiling intermediate object code to
			  object code when using +O4 or profile-based
			  optimization.

	   +Oselectivepercent n
			  Instructs the interprocedural optimizer driver to
			  pass the first n percent of the object files to
			  the high level optimizer for interprocedural
			  optimizations such as inlining.

	   +Oselectivesize size
			  Instructs the interprocedural optimizer driver to
			  pass the first k routines to the high level
			  optimizer for interprocedural optimization where
			  the size of k routines are approaching but less
			  than size.

	   +OselectiveO3  Instructs the interprocedural optimizer driver to
			  compile the routines not included in the +O4 list
			  to be compiled at +O3.

	   +Ostaticprediction
			  Meaningful only on PA 2.0 architecture, this



 Hewlett-Packard Company	   - 15 -   HP-UX Release 11i: November 2000






 ld(1)								       ld(1)




			  option sets the branch prediction bit in the
			  output executable file's auxiliary header.

    32 Bit Link Editor Options
	   -A name	  This option specifies incremental loading.
			  Linking is arranged so that the resulting object
			  can be read into an already executing program.
			  The argument name specifies a file whose symbol
			  table provides the basis for defining additional
			  symbols.  Only newly linked material is entered
			  into the text and data portions of a.out, but the
			  new symbol table reflects all symbols defined
			  before and after the incremental load.  Also, the
			  -R option can be used in conjunction with -A,
			  which allows the newly linked segment to commence
			  at the corresponding address.	 The default
			  starting address is the old value of _end.  The -A
			  option is incompatible with -r and -b.  Also note
			  that a program that dynamically loads code with ld
			  -A cannot use shared libraries.  See the +help
			  option or the HP-UX Linker and Libraries User's
			  Guide manual for a description of this option.

	   -Cn		  Set the maximum parameter-checking level to n.
			  The default maximum is 3.  See the language
			  manuals for the meanings of the parameter-checking
			  level.

	   -Fl		  Force load all member objects of an archive
			  library. If you do not use -Fl, the linker only
			  loads the needed archive members.  This option is
			  useful for creating a shared library from an
			  archive library, or when you need to load archive
			  member that define symbols needed by shared
			  libraries.

	   -Fw		  Don't emit unwind tables.  Do not use this option
			  if your compiler or tools require unwind tables.

	   -Fz		  Disable the linker feature that translates some
			  calls to $$dyncall_external to calls to $$dyncall.

	   -N		  Generate an executable output file with file type
			  EXEC_MAGIC.  This option is incompatible with -n
			  and -q.  This option causes the data to be placed
			  immediately following the text, and makes the text
			  writable.  Files of this type cannot be shared.

	   -S		  Generate an Initial Program Loader (IPL) auxiliary
			  header for the output file, instead of the default
			  HP-UX auxiliary header.



 Hewlett-Packard Company	   - 16 -   HP-UX Release 11i: November 2000






 ld(1)								       ld(1)




	   -T		  Save the load data and relocation information in
			  temporary files instead of in memory during
			  linking.  This option reduces the virtual memory
			  requirements of the linker.  If the TMPDIR
			  environment variable is set, the temporary files
			  are created in the specified directory, rather
			  than in /var/tmp.

	   +cdp oldpath:newpath
			  Replace the recorded path for a shared library in
			  the a.out.  In 32-bit mode, ld records the
			  absolute path names of any shared libraries
			  searched at link time in the a.out file.  When the
			  program begins execution, the dynamic loader
			  attaches any shared libraries that were searched
			  at link time. Although you can use the +b and/or
			  +s linker options to direct the dynamic loader to
			  directories to search for the shared libraries,
			  the dynamic loader, as a last resort, searches for
			  the shared libraries in its absolute, recorded
			  path in the a.out.  You can specify more than one
			  shared library oldpath:newpath, but each must be
			  preceded by the +cdp option.

	   +cg pathname	  Specify the use of pathname as the code generator
			  for compiling ISOMs to SOMs. See the discussion of
			  profile based optimization in the HP-UX Linker and
			  Libraries Online User's Guide for more
			  information.

	   +dpv		  Display verbose messages regarding procedures
			  which have been removed due to dead procedure
			  elimination.	The symbol name, input object file,
			  and the size (in bytes) of the deleted procedure
			  are displayed.  The total size (in bytes) of the
			  deleted procedures is also displayed.

	   +filter shared_library_path
			  Enables the shared library filter mechanism, which
			  allows you divide a large library into a "filter"
			  and several "implementation" libraries for more
			  efficient organization of shared libraries.
			  shared_library_path specifies the location of the
			  filter library.  See the HP-UX Linker and
			  Libraries User's Guide for more information.

	   +gstbuckets size
			  Request a particular number of buckets per entry
			  using the global symbol table hash mechanism.	 The
			  default value is 3.  The value can be overridden
			  at runtime by setting the _HP_DLDOPTS environment



 Hewlett-Packard Company	   - 17 -   HP-UX Release 11i: November 2000






 ld(1)								       ld(1)




			  variable to the value -symtab_buckets number.	 You
			  can set the value using chatr +gstbuckets size
			  file.

	   +nosmartbind	  Disable SmartBind when binding a shared library.
			  With this option enabled, the linker places all
			  symbols in the link into a single SmartBind module
			  instead of placing each .o file in its own module.

	   +plabel_cache  Enable the plabel caching mechanism.	Use this
			  option with the +gst option.

			  This option is only effective with C++.  In C++
			  applications, the dynamic loader needs to
			  repetitively access PLABEL information (import
			  stub). In order to make this access faster, the
			  dynamic loader uses the global symbol table
			  structure to also contain PLABEL entries. This
			  behavior is enabled when the PLABEL_CACHE flag is
			  set in the dl_header structure (enabled ld
			  +plabel_cache enable a.out or chatr +plabel_cache
			  enable a.out).

    64-bit Link Editor Options
	   -k filename	  filename specifies a mapfile that describes the
			  output file memory map.

			  The user specified mapfile specifications are
			  permitted with the +ild option. But you should not
			  modify the mapfile after the initial incremental
			  link. If the mapfile is modified after the initial
			  link, an initial incremental link is performed
			  automatically.

			  Please refer to HP-UX Linker and Libraries User's
			  Guide guide for more information.  Also see
			  +nodefaultmap.

	   +[no]allowunsats
			  +allowunsats Does not flag errors if the resulting
			  output file has unsatisfied symbols.	This is the
			  default for relocatable links and shared library
			  builds.  +noallowunsats Flags an error if the
			  resulting output file has unsatisfied symbols.
			  This is the default for program files.

	   +fini function_name
			  Specify the terminator function.

	   +ild		  Specify incremental linking.




 Hewlett-Packard Company	   - 18 -   HP-UX Release 11i: November 2000






 ld(1)								       ld(1)




			  If the output file does not exist, or if it was
			  created without the +ild option, the linker
			  performs an initial incremental link.	 The output
			  file produced is suitable for subsequent
			  incremental links.  The incremental link option is
			  valid for both executable and shared library
			  links.

			  The following options are compatible with the +ild
			  option with limitations:

			  -D offset , -R offset
			       Set the origin for the data and text
			       segments. If you change the offset after the
			       initial incremental link, the linker performs
			       an initial incremental link automatically.

			  -k mapfile
			       provide a non-default mapfile. The user
			       specified mapfile specifications are
			       permitted with the +ild option. But you
			       should not modify the mapfile after the
			       initial incremental link. If the mapfile is
			       modified after the initial link, an initial
			       incremental link is performed automatically.

			  If you specify one of the following incompatible
			  ld option with +ild, the linker emits a warning
			  message and ignores the +ild option.

			  -r   create a relocatable object file.

			  Strip options:
			       -s and -x strip the output file. (The
			       incremental linking requires the parts of the
			       output load module which are stripped out
			       with these options.)

			  Optimization options:
			       -I, -O, -P, -PD, -PF, +df file, +fb, +fbu,
			       +fbs, +pgm name, +Oprocelim

	   +ildnowarn	  Suppress incremental-linking related warnings.  By
			  default, the linker issues all incremental-linking
			  related warnings.  This option is ignored if used
			  without +ild or +ildrelink.

	   +ildpad percentage
			  Control the amount of padding percentage the
			  incremental linker allocates, relative to sizes of
			  object file structures being padded. By default



 Hewlett-Packard Company	   - 19 -   HP-UX Release 11i: November 2000






 ld(1)								       ld(1)




			  the linker allocates 25% of padding space.  This
			  option is ignored if used without +ild or
			  +ildrelink.

	   +ildrelink	  Perform an initial incremental link, regardless of
			  the output load module.

			  In certain situations (for example, internal
			  padding space is exhausted) the incremental linker
			  is forced to perform an initial incremental link.
			  The +ildrelink option allows you to avoid such
			  unexpected initial incremental links by
			  periodically rebuilding the output file.

	   +init function_name
			  Specify the initializer function.

	   +interp file	  Change the dld path to use the argument as the
			  "interpreter" program instead of the dld.sl.

	   +[no]forceload +forceload loads all object files from archive
			  libraries.  +noforceload is the default - loads
			  only the required object files from archive
			  libraries.  The mode that is selected, either
			  explicitly or by default, remains on until it is
			  changed.

	   +hideallsymbols
			  This option is used to prevent all the symbols
			  from being exported unless explicitly exported
			  with the +e.

	   +nodefaultmap  This option tells the linker not to use the
			  default memory map.  The user needs to supply a
			  mapfile through the -k linker option.

	   +nodynhash	  Disables the default linker behavior of the +gst
			  option to create the .dynhash section for
			  executables or shared libraries.  Use this option
			  to eliminate generation of pre-computed hash table
			  information for a library or an executable that is
			  rarely used with the global symbol table lookup
			  scheme or for which the overhead of storing pre-
			  computed hash values is too high.  This option has
			  no effect when used with the -r option.

	   +noenvvar	  Instructs the dynamic loader to not look at the
			  LD_LIBRARY_PATH and SHLIB_PATH environment
			  variables at runtime.	 This is turned on if ld
			  +compat is specified.	 This is turned off by
			  default or if ld +std is specified.  See +compat



 Hewlett-Packard Company	   - 20 -   HP-UX Release 11i: November 2000






 ld(1)								       ld(1)




			  or +std.  Generally, this option is used for
			  secure programs (e.g. setuid).

	   +nosectionmerge
			  Used with the -r option to allow procedures to be
			  positioned independently.  The default is to merge
			  all procedures into a single section.

	   +paddata pagesize
			  Pads the data segment to a multiple of pagesize
			  with zeros.  This can improve page allocation,
			  thus reduce TLB misses.

	   +padtext pagesize
			  Pads the text segment to a multiple of pagesize
			  with zeros.  This can improve page allocation,
			  thus reduce TLB misses.

	   +pdzero	  Generates a zero page of 4K bytes at the beginning
			  of the data data segment.  It also sets the
			  default starting address of the data segment to
			  0x8000000000000000.  This option improves
			  performance by reducing TLB misses by allowing the
			  kernel to allocate bigger data pages.

	   +stripunwind	  Do not output the unwind table.  This creates
			  smaller executable sizes.  Use this option if you
			  do not need the unwind table for debugging or C++
			  exception handling.

	   +tools	  Request that the application be linked for
			  profiling with CXperf.

	   +vtype type	  Produces verbose output about the link operation.
			  type can have the following values:

			  files
			       Dump info about each object file loaded.

			  heap Dump info about the size of the heap used by
			       a link.

			  libraries
			       Dump info about libraries searched.

			  procelim
			       Dump info about sections that have been
			       rejected by the +Oprocelim option

			  sections
			       Dump info about each input section added to



 Hewlett-Packard Company	   - 21 -   HP-UX Release 11i: November 2000






 ld(1)								       ld(1)




			       the output file.

			  symbols
			       Dump info about global symbols
			       referenced/defined from/in the input files.

			  all  Dumps all of the above info.  Same as -v.

    Defaults
      Unless otherwise directed, ld names its output a.out.  The -o option
      overrides this.  Executable output files are of type SHARE_MAGIC.	 The
      default state of -a is to search shared libraries if available,
      archive libraries otherwise.  The default bind behavior is deferred.

      The default value of the -Z/-z option is -Z.

      For 64-bit mode, +std is on by default.

    Incremental linking with ld	 (64-bit Mode ONLY)
      In the edit-compile-link-debug development cycle, link time is a
      significant component. The incremental linker (available through the
      +ild and +ildrelink options) can reduce the link time by taking
      advantage of the fact that you can reuse most of the previous version
      of the program and that the unchanged object files do not need to be
      processed. The incremental linker allows you to insert object code
      into an output file (executable or shared library) that you created
      earlier, without relinking the unmodified object files. The time
      required to relink after the initial incremental link depends on the
      number of modules you modify.

      The linker performs the following different modes of linking:

      +	   normal link: the default operation mode in which the linker links
	   all modules.

      +	   initial incremental link: the mode entered when you request an
	   incremental link, but the output module created by the
	   incremental linker does not exist, or it exists but the
	   incremental linker is unable to perform an incremental update.

      +	   incremental link: the mode entered when you request an
	   incremental link, an output module created by the incremental
	   linker exists, and the incremental linker does not require an
	   initial incremental link.

      Incremental links are usually much faster than regular links. On the
      initial link, the incremental linker requires about the same amount of
      time that a normal link process requires, but subsequent incremental
      links can be much faster than a normal link.  A change in one object
      file in a moderate size link (tens of files, several megabytes total)
      normally is about 10 times faster than a regular ld link. The



 Hewlett-Packard Company	   - 22 -   HP-UX Release 11i: November 2000






 ld(1)								       ld(1)




      incremental linker perform as many incremental links as allocated
      padding space and other constrains permit.  The cost of the reduced
      link time is an increase in the size of the executable or shared
      library.

      The incremental linker allocates padding space for all components of
      the output file. Padding makes modules larger than those modules
      linked by ld.  As object files increase in size during successive
      incremental links, the incremental linker can exhaust the available
      padding. If this occurs, it displays a warning message and does a
      complete initial incremental link of the module.	When an object file
      changes, the incremental linker not only replaces the content of that
      file in the executable or shared library being linked, but also
      adjusts references to all symbols defined in the object file and
      referenced by other objects. This is done by looking at relocation
      records saved in the incrementally linked executable or shared
      library.

      On the initial incremental link, the linker processes the input object
      files and libraries in the same way as the normal link. In addition to
      the normal linking process, the incremental linker saves information
      about object files, global symbols, and relocations, and pads sections
      in the output file for expansion.	 On subsequent incremental links,
      the linker uses timestamps and file sizes to determine which object
      files have changed, and updates those modules.

      Under certain conditions, the incremental linker cannot perform
      incremental links. When this occurs, the incremental linker
      automatically performs an initial incremental link to restore the
      process.	In the following situations, the linker automatically
      performs an initial incremental link of the output file:

      +	   Changed linker command line, where the linker command line does
	   not match the command line stored in the output file.  (With the
	   exceptions of the verbose and tracing options)

      +	   Any of the padding spaces have been exhausted.

      +	   Modules have been modified by the ld -s or ld -x options or tools
	   (for example, strip(1)).  The incremental linking requires the
	   parts of the output load module which are stripped out with these
	   options.

      +	   Incompatible incremental linker version, when you run a new
	   version of the incremental linker on an executable created by an
	   older version.

      +	   New working directory, where the incremental linker performs an
	   initial incremental link if current directory changes.





 Hewlett-Packard Company	   - 23 -   HP-UX Release 11i: November 2000






 ld(1)								       ld(1)




      +	   Archive or shared libraries are added/removed to/from the linker
	   command line.

      +	   Objects are added/removed to/from the linker command line.

      See the Online Linker and Libraries User's Guide (ld +help) for more
      information.

      Archive Library Processing

      The incremental linker searches an archive library if there are
      unsatisfied symbols. It extracts all archive members satisfying unsats
      and processes them as new object files.  If an archive library is
      modified, the linker replaces the modifed archive library.

      An object file extracted from an archive library in the previous link
      remains in the output load module even if all references to symbols
      defined in the object file have been removed. The linker removes these
      object files when it performs the next initial incremental link.

      Shared Library Processing

      In an initial incremental link, the linker scans shared library symbol
      tables and resolves unsats the same way it would in a regular link. In
      incremental links, the linker does not process shared libraries and
      their symbol tables at all and does not report shared library unsats.
      The dynamic loader detects them at run time. If any of the shared
      libraries on the command line was modified, the linker reverts to an
      initial incremental link.

      Performance

      Performance of the incremental linker may suffer greatly if you change
      a high percentage of object files.

      The incremental linker may not link small programs much faster, and
      the relative increase in size of the executable is greater than that
      for larger programs.

      Generally, the linker needs to scan through all shared libraries on a
      link line in order to determine all the unsats, even in incremental
      links.  This process may slow down incremental links. The incremental
      linker does not scan shared libraries and leaves detection of shared
      library unsats to the dynamic loader.

      Do not use the incremental linker to create final production modules.
      Because it reserves additional padding space, modules created by the
      incremental linker are considerably larger than those created in
      regular links.





 Hewlett-Packard Company	   - 24 -   HP-UX Release 11i: November 2000






 ld(1)								       ld(1)




      Notes

      Any program that modifies an executable (for example, strip(1)), may
      affect the ability of ld to perform an incremental link. When this
      happens, the incremental linker issues a message and performs an
      initial incremental link.

      Third-party tools that work on object files may have unexpected
      results on modules produced by the incremental linker.

 EXTERNAL INFLUENCES
    Environment Variables
      The following internationalization variables affect the execution of
      ld:

      FLOW_DATA
	   An instrumented executable (see the -I option) writes out the
	   profile data to a database file named flow.data in the current
	   directory.  The name and location of this file can be specified
	   by setting FLOW_DATA to the desired path name.  The profile data
	   is stored in the database file under a look-up name that is the
	   same as the basename of the executable file specified at run-
	   time.  A single flow.data file can hold profile data for multiple
	   program files.

      LANG Determines the locale category for native language, local customs
	   and coded character set in the absence of LC_ALL and other LC_*
	   environment variables.  If LANG is not specified or is set to the
	   empty string, a default of C (see lang(5)) is used instead of
	   LANG.

      LC_ALL
	   Determines the values for all locale categories and has
	   precedence over LANG and other LC_* environment variables.

      LC_MESSAGES
	   Determines the locale that should be used to affect the format
	   and contents of diagnostic messages written to standard error.

      LC_NUMERIC
	   Determines the locale category for numeric formatting.

      LC_CTYPE
	   Determines the locale category for character handling functions.

      NLSPATH
	   Determines the location of message catalogs for the processing of
	   LC_MESSAGES.

      If any internationalization variable contains an invalid setting, ld
      behaves as if all internationalization variables are set to C.  See



 Hewlett-Packard Company	   - 25 -   HP-UX Release 11i: November 2000






 ld(1)								       ld(1)




      environ(5).

      In addition, the following environment variable affects ld:

      TMPDIR
	   Specifies a directory for temporary files (see tmpnam(3S)).

 DIAGNOSTICS
      ld returns zero when the link is successful.  A non-zero return code
      indicates that an error occurred.

 EXAMPLES
      Link part of a C program for later processing by ld.  (Note the .o
      suffix for the output object file; this is an HP-UX convention for
      indicating a linkable object file):

	   ld -r file1.o file2.o -o prog.o

      On 32-bit, link a simple FORTRAN program for use with the dde symbolic
      debugger (see dde(1)).  Output file name is a.out since there is no -o
      option in the command line.

	   ld /usr/ccs/lib/crt0.o ftn.o -lcl -lisamstub \
		-lc /opt/langtools/lib/end.o

      To do this on 64-bit:

	   ld ftn.o -lcl -lisamstub \
		-lc /opt/langtools/lib/pa20_64/end.o

      On 64-bit, link a shared bound program in standard mode.	Note that
      crt0.o is not specified because for shared links, it is no longer
      necessary.

	   ld himom.o +std -lc

      On 64-bit, link a compatibility mode program.  crt0.o is included
      because this is an archive link.

	   ld /opt/langtools/lib/pa20_64/crt0.o himom.o +compat -a archive -lc

      Create a shared library:

	   ld -b -o libfunc.sl func1.o func2.o func3.o

      Create a shared library with an internal name:

	   ld -b -o libfoo1.1 foo1.o foo2.o +h libfoo1.1
	   ln -s libfoo1.1 libfoo1.sl
	   cc -g mytest.c -L. -lfoo1
	   chatr a.out



 Hewlett-Packard Company	   - 26 -   HP-UX Release 11i: November 2000






 ld(1)								       ld(1)




	   ...
	     shared library list:
	       dynamic	 ./libfoo1.1

      If you do not use +h, the shared library does not have an internal
      name.  The linker does not check whether .sl is a symbolic link.	It
      records the library name that it looks at, if it does not have the
      internal name.

	   chatr a.out
	   ...
	     shared library list:
	       dynamic	 ./libfoo1.sl

      On 32-bit, link a program with libfunc.sl but use the archive version
      of the C library.	 Specify the immediate binding mode together with
      the nonfatal modifier and allow verbose diagnostics to be displayed:

	   ld /usr/ccs/lib/crt0.o -B immediate -B nonfatal -B verbose \
		program.o -L . -lfunc -a archive -lc

      To do this on 64-bit:

	   ld -B immediate -B nonfatal -B verbose \
		program.o -L . -lfunc -a archive -lc

      On 32-bit, link a Pascal program:

	   ld /usr/ccs/lib/crt0.o main.o -lcl -lm -lc

      Note that in the above examples, /usr/ccs/lib/crt0.o can be replaced
      by /opt/langtools/lib/crt0.o.

 WARNINGS
      ld recognizes several names as having special meanings.  The symbol
      _end is reserved by the linker to refer to the first address beyond
      the end of the program's address space.  Similarly, the symbol _edata
      refers to the first address beyond the initialized data, and the
      symbol _etext refers to the first address beyond the program text.
      The symbols end, edata, and etext are also defined by the linker, but
      only if the program contains a reference to these symbols and does not
      define them (see end(3C) for details).  On 32-bit, the symbol __tdsize
      is the total thread local storage size required by the program or
      shared library.

      On 64-bit, the linker defines a few more symbols.	 The symbol
      __TLS_SIZE is the total thread local storage size.  The symbol
      _FPU_STATUS is the initial status of the FPU status register.  The
      symbol __SYSTEM_ID is the largest architecture revision level used by
      any compilation unit.




 Hewlett-Packard Company	   - 27 -   HP-UX Release 11i: November 2000






 ld(1)								       ld(1)




      The linker treats a user definition of any of the symbols listed here
      as an error.

      Through its options, the link editor gives users great flexibility.
      However, those who invoke the linker directly must assume some added
      responsibilities.	 Input options should ensure the following
      properties for programs:

	   +  When the link editor is called through cc(1), a start-up
	      routine is linked with the user's program.  This routine calls
	      exit(2) after execution of the main program.  If users call ld
	      directly, they must ensure that the program always calls
	      exit() rather than falling through the end of the entry
	      routine.

	   +  When linking for use with the symbolic debugger dde, the user
	      must ensure that the program contains a routine called main.
	      Also, the user must link in the file /opt/langtools/lib/end.o
	      on 32-bit and /opt/langtools/lib/pa20_64/end.o on 64-bit as
	      the last file named on the command line.

      There is no guarantee that the linker will pick up files from archive
      libraries and include them in the final program in the same relative
      order that they occur within the library.

      The linker emits warnings where ever it detects any compatibility
      issues.  Among other things, these issues include architectural ones,
      as well as functionality that may change over time.  Some of these
      include:

	   + Linking a PA 2.0 object file, which will not run on a PA 1.x
	     system.

	   + Incremental loading with the -A option.

	   + Procedure call parameter and return type checking, including
	     the -C option.

	   + Symbols with the same name but different types, such as CODE
	     and DATA.

	   + Checking of unsatisfied symbols by the linker, which sometimes
	     skips certain object files from an archived library.  This
	     warning is only given if the -v option is also provided.

	   + Versioning of objects within a shared library.

      These messages can be turned off with the +vnocompatwarnings option.

      As noted in the Options section, certain options no longer exist in a
      64-bit linker.  They are:



 Hewlett-Packard Company	   - 28 -   HP-UX Release 11i: November 2000






 ld(1)								       ld(1)




	   + -q
	   + -A
	   + -C
	   + -E
	   + -Q
	   + -S
	   + -T
	   + -X
	   + +dpv

      Some restrictions exist for 64-bit mode with executables built with
      shared libraries and with S-bit set (through +s enabled).	 The
      behavior of 64-bit executables does not match the behavior of
      equivalent 32-bit executables or executables built with +compat.	For
      any setuid or setgid programs, dld disables any dynamic library
      searching through environment variables, SHLIB_PATH for 32-bit and
      64-bit mode, and LD_LIBRARY_PATH for 64-bit mode.	 If a library only
      exists in the directory specified in SHLIB_PATH (or LD_LIBRARY_PATH),
      you get the runtime error "library not found" if the program is a
      setuid program (that is, uid not equal to euid or gid not equal to
      eguid) and it depends on that library.  dld uses the dynamic path
      lookup (with SHLIB_PATH) only if the following conditions are
      satisfied: getuid () == geteuid () &&amp&amp&&&amp&amp& getgid () == getegid ().  That
      is, if the uid or gid does not match its effective counterpart, dld
      searches only the recorded library path.	As a result, dld does not
      check the SHLIB_PATH which causes the runtime error "library not
      found".

 AUTHOR
      ld was developed by AT&T, the University of California, Berkeley, and
      HP.

 FILES
      /usr/lib/lib*			      32-bit system archive and
					      shared libraries

      /usr/lib/pa20_64/lib*		      64-bit system archive and
					      shared libraries

      /usr/ccs/lib*			      32-bit development archive and
					      shared libraries

      /opt/langtools/lib/pa20_64	      64-bit development object
					      files, archive and shared
					      libraries

      a.out				      output file

      /usr/lib/dld.sl			      32-bit dynamic loader





 Hewlett-Packard Company	   - 29 -   HP-UX Release 11i: November 2000






 ld(1)								       ld(1)




      /usr/lib/pa20_64/dld.sl		      64-bit dynamic loader

      /opt/langtools/lib/end.o		      for use with the 32-bit dde
					      debugger

      /opt/langtools/lib/pa20_64/end.o	      for use with the 64-bit dde
					      debugger

      /usr/ccs/lib/crt0.o		      32-bit run-time startup file

      /opt/langtools/lib/crt0.o		      Identical to
					      /usr/ccs/lib/crt0.o

      /opt/langtools/lib/pa20_64/crt0.o	      64-bit run-time startup file

      /usr/ccs/lib/dyncall.o		      32-bit only.  Used with -A
					      option links

      /opt/langtools/lib/mcrt0.o	      32-bit run-time startup with
					      profiling (see prof(1))

      /opt/langtools/lib/pa20_64/mcrt0.o      64-bit run-time startup with
					      profiling

      /usr/lib/milli.a			      32-bit millicode library
					      automatically searched by ld

      /usr/lib/pa20_64/milli.a		      64-bit millicode library
					      automatically searched by ld

      /opt/langtools/lib/gcrt0.o	      run-time start-up with
					      profiling (see gprof(1))

      /opt/langtools/lib/pa20_64/gcrt0.o      64-bit run-time start-up with
					      profiling (see gprof(1))

      /opt/langtools/lib/icrt0.o	      32-bit run-time start-up with
					      profiling (see discussion of
					      profile based optimization
					      above.)

      /opt/langtools/lib/pa20_64/icrt0.o      64-bit run-time start-up with
					      profiling (see discussion of
					      profile based optimization
					      above.)

      /usr/lib/nls/$LANG/ld.cat		      message catalog

      /var/tmp/ld*			      temporary files





 Hewlett-Packard Company	   - 30 -   HP-UX Release 11i: November 2000






 ld(1)								       ld(1)




      flow.data				      file containing profile data
					      generated by running an
					      instrumented executable

      /usr/ccs/bin/fdp			      program for creating the
					      procedure link order from a
					      profile database file created
					      by an instrumented executable;
					      forked by the -P option

      /opt/langtools/lbin/ucomp		      PA-RISC code generator

 SEE ALSO
    Profiling and Debugging Tools:
      adb(1)		absolute debugger
      gprof(1)		display call graph profile data
      prof(1)		display profile data
      dde(1)		C, C++, FORTRAN, and Pascal symbolic debugger

    System Tools:
      aCC(1)		invoke the HP-UX aC++ compiler
      ar(1)		create archived libraries
      CC(1)		invoke the HP-UX C++ compiler
      cc(1)		invoke the HP-UX C compiler
      chatr(1)		change program's internal attributes
      exec(2)		execute a file
      f77(1)		invoke the HP-UX FORTRAN 77 compiler
      f90(1)		invoke the HP-UX Fortran 90 compiler
      fastbind(1)	invoke the fastbind tool
      nm(1)		print name list of object file
      pc(1)		invoke the HP-UX Pascal compiler
      strip(1)		strip symbol and line number information from an
			object file

    Miscellaneous:
      a.out(4)		assembler, compiler, and linker output
      ar(4)		archive format
      crt0(3)		execution startup routine
      dld.sl(5)		dynamic loader
      end(3C)		symbol of the last locations in program

    Texts and Tutorials:
      HP-UX Linker and Libraries Online User Guide
			(See the +help option)
      HP-UX Linker and Libraries User's Guide
			(See manuals(5) for ordering information)

 STANDARDS CONFORMANCE
      ld: SVID2, SVID3, XPG2, XPG4





 Hewlett-Packard Company	   - 31 -   HP-UX Release 11i: November 2000