Home Explore Blog CI



man-pages

27th chunk of `ld.man`
ee3609559b9fe22dec6a6f3a5f42476a7eff48edf3ec59c90000000100000fae
           memset function.

       --error-handling-script=scriptname
           If  this  option is provided then the linker will invoke scriptname whenever an error is encountered.  Currently however only two kinds of error are supported: missing symbols and missing libraries.  Two arguments
           will be passed to script: the keyword "undefined‐symbol" or ‘missing-lib" and the name of the undefined symbol or missing library.  The intention is that the script will provide suggestions to the user as to where
           the symbol or library might be found.  After the script has finished then the normal linker error message will be displayed.

           The availability of this option is controlled by a configure time switch, so it may not be present in specific implementations.

       --no-undefined-version
           Normally when a symbol has an undefined version, the linker will ignore it. This option disallows symbols with undefined version and a fatal error will be issued instead.

       --default-symver
           Create and use a default symbol version (the soname) for unversioned exported symbols.

       --default-imported-symver
           Create and use a default symbol version (the soname) for unversioned imported symbols.

       --no-warn-mismatch
           Normally ld will give an error if you try to link together input files that are mismatched for some reason, perhaps because they have been compiled for different processors or  for  different  endiannesses.   This
           option  tells  ld  that  it  should  silently  permit  such  possible  errors.   This  option should only be used with care, in cases when you have taken some special action that ensures that the linker errors are
           inappropriate.

       --no-warn-search-mismatch
           Normally ld will give a warning if it finds an incompatible library during a library search.  This option silences the warning.

       --no-whole-archive
           Turn off the effect of the --whole-archive option for subsequent archive files.

       --noinhibit-exec
           Retain the executable output file whenever it is still usable.  Normally, the linker will not produce an output file if it encounters errors during the link process; it exits without writing an output file when it
           issues any error whatsoever.

       -nostdlib
           Only search library directories explicitly specified on the command line.  Library directories specified in linker scripts (including linker scripts specified on the command line) are ignored.

       --oformat=output‐format
           ld may be configured to support more than one kind of object file.  If your ld is configured this way, you can use the --oformat option to specify the binary format for the output object file.   Even  when  ld  is
           configured to support alternative object formats, you don’t usually need to specify this, as ld should be configured to produce as a default output format the most usual format on each machine.  output‐format is a
           text  string,  the  name of a particular format supported by the BFD libraries.  (You can list the available binary formats with objdump -i.)  The script command "OUTPUT_FORMAT" can also specify the output format,
           but this option overrides it.

       --out-implib file
           Create an import library in file corresponding to the executable the linker is generating (eg. a DLL or ELF program).  This import library (which should be called "*.dll.a" or "*.a" for DLLs) may be used  to  link
           clients against the generated executable; this behaviour makes it possible to skip a separate import library creation step (eg. "dlltool" for DLLs).  This option is only available for the i386 PE and ELF targetted
           ports of the linker.

       -pie
       --pic-executable
           Create  a  position independent executable.  This is currently only supported on ELF platforms.  Position independent executables

Title: LD (GNU Linker) Options: Error Handling Script, Symbol Versioning, Warning Suppression, Archive Handling, Output Control, and Position Independent Executables
Summary
This section details more options for the GNU linker, including invoking a script on error (--error-handling-script), controlling symbol versioning (--default-symver, --default-imported-symver), suppressing warnings about mismatches (--no-warn-mismatch, --no-warn-search-mismatch), disabling --whole-archive (--no-whole-archive), retaining executables on error (--noinhibit-exec), limiting library search to explicit directories (-nostdlib), specifying the output format (--oformat), creating an import library (--out-implib), and creating position independent executables (-pie, --pic-executable).