Home Explore Blog CI



man-pages

3rd chunk of `ld.man`
fcbf79b48a08a3389af160850a2a5837ae970164b51deb200000000100000fbc
 multiple‐letter options, such as:

                 gcc foo.o bar.o -Wl,-eENTRY -Wl,-Map=a.map

       Here is a table of the generic command‐line switches accepted by the GNU linker:

       @file
           Read command‐line options from file.  The options read are inserted in place of the original @file option.  If file does not exist, or cannot be read, then the option will be treated literally, and not removed.

           Options  in  file are separated by whitespace.  A whitespace character may be included in an option by surrounding the entire option in either single or double quotes.  Any character (including a backslash) may be
           included by prefixing the character to be included with a backslash.  The file may itself contain additional @file options; any such options will be processed recursively.

       -a keyword
           This option is supported for HP/UX compatibility.  The keyword argument must be one of the strings archive, shared, or default.  -aarchive is functionally equivalent to -Bstatic, and the  other  two  keywords  are
           functionally equivalent to -Bdynamic.  This option may be used any number of times.

       --audit AUDITLIB
           Adds  AUDITLIB to the "DT_AUDIT" entry of the dynamic section.  AUDITLIB is not checked for existence, nor will it use the DT_SONAME specified in the library.  If specified multiple times "DT_AUDIT" will contain a
           colon separated list of audit interfaces to use. If the linker finds an object with an audit entry while searching for shared libraries, it will add a corresponding "DT_DEPAUDIT" entry in the  output  file.   This
           option is only meaningful on ELF platforms supporting the rtld‐audit interface.

       -b input‐format
       --format=input‐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 -b option to specify the binary format for input object files that follow this option on the
           command line.  Even when ld is configured to support alternative object formats, you don’t usually need to specify this, as ld should be configured to expect as a default input format the most usual format on each
           machine.  input‐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.)

           You may want to use this option if you are linking files with an unusual binary format.  You can also use -b to switch formats explicitly (when linking object files of different formats), by  including  -b  input‐
           format before each group of object files in a particular format.

           The default format is taken from the environment variable "GNUTARGET".

           You can also define the input format from a script, using the command "TARGET";

       -c MRI‐commandfile
       --mri-script=MRI‐commandfile
           For  compatibility  with  linkers  produced  by  MRI,  ld  accepts  script  files written in an alternate, restricted command language, described in the MRI Compatible Script Files section of GNU ld documentation.
           Introduce MRI script files with the option -c; use the -T option to run linker scripts written in the general‐purpose ld scripting language.  If MRI‐cmdfile does not exist, ld  looks  for  it  in  the  directories
           specified by any -L options.

       -d
       -dc
       -dp These  three  options  are  equivalent; multiple forms are supported for compatibility with other linkers.  They assign space to common symbols even if a relocatable output file is specified (with -r).  The script
           command "FORCE_COMMON_ALLOCATION" has the same effect.

       --depaudit AUDITLIB
       -P AUDITLIB
           Adds AUDITLIB to the "DT_DEPAUDIT" entry of the dynamic section.  AUDITLIB is not checked for existence, nor will it use the DT_SONAME specified in the library.  If  specified  multiple

Title: LD (GNU Linker) - Command Line Options A to P
Summary
This section details the command line options for the GNU linker (ld), starting with options 'A' through 'P'. Options include: - `@file` for reading options from a file, - `-a` for HP/UX compatibility, - `--audit` for adding AUDITLIB to the DT_AUDIT entry, - `-b` or `--format` for specifying the input object file format, - `-c` or `--mri-script` for using MRI script files, - `-d`, `-dc`, `-dp` for assigning space to common symbols, and - `--depaudit` or `-P` for adding AUDITLIB to the DT_DEPAUDIT entry.