Home Explore Blog CI



man-pages

38th chunk of `ld.man`
61a6a30009cff5fefca7e3337f79db1bc21c01430091c47a0000000100000fb4
 linked file may be changed later by other tools, but the build ID bit string identifying the original linked file does not change.

           Passing "none" for style disables the setting from any "--build-id" options earlier on the command line.

       --package-metadata=JSON
           Request  the  creation  of  a  ".note.package"  ELF  note  section.   The  contents  of  the  note  are  in  JSON   format,   as   per   the   package   metadata   specification.    For   more   information   see:
           https://systemd.io/ELF_PACKAGE_METADATA/  If  the  JSON argument is missing/empty then this will disable the creation of the metadata note, if one had been enabled by an earlier occurrence of the --package-metdata
           option.  If the linker has been built with libjansson, then the JSON string will be validated.

       The i386 PE linker supports the -shared option, which causes the output to be a dynamically linked library (DLL) instead of a normal executable.  You should name the output  "*.dll"  when  you  use  this  option.   In
       addition,  the  linker fully supports the standard "*.def" files, which may be specified on the linker command line like an object file (in fact, it should precede archives it exports symbols from, to ensure that they
       get linked in, just like a normal object file).

       In addition to the options common to all targets, the i386 PE linker support additional command‐line options that are specific to the i386 PE target.  Options that take values may be separated  from  their  values  by
       either a space or an equals sign.

       --add-stdcall-alias
           If given, symbols with a stdcall suffix (@nn) will be exported as‐is and also with the suffix stripped.  [This option is specific to the i386 PE targeted port of the linker]

       --base-file file
           Use file as the name of a file in which to save the base addresses of all the relocations needed for generating DLLs with dlltool.  [This is an i386 PE specific option]

       --dll
           Create a DLL instead of a regular executable.  You may also use -shared or specify a "LIBRARY" in a given ".def" file.  [This option is specific to the i386 PE targeted port of the linker]

       --enable-long-section-names
       --disable-long-section-names
           The  PE variants of the COFF object format add an extension that permits the use of section names longer than eight characters, the normal limit for COFF.  By default, these names are only allowed in object files,
           as fully‐linked executable images do not carry the COFF string table required to support the longer names.  As a GNU extension, it is possible to allow their use in executable  images  as  well,  or  to  (probably
           pointlessly!)   disallow  it  in object files, by using these two options.  Executable images generated with these long section names are slightly non‐standard, carrying as they do a string table, and may generate
           confusing output when examined with non‐GNU PE‐aware tools, such as file viewers and dumpers.  However, GDB relies on the use of PE long section names to find Dwarf-2 debug information sections  in  an  executable
           image  at  runtime,  and  so  if  neither  option  is specified on the command‐line, ld will enable long section names, overriding the default and technically correct behaviour, when it finds the presence of debug
           information while linking an executable image and not stripping symbols.  [This option is valid for all PE targeted ports of the linker]

       --enable-stdcall-fixup
       --disable-stdcall-fixup
           If the link finds a symbol that it cannot resolve, it will attempt to do "fuzzy linking" by looking for another defined symbol that differs only in the format of the symbol name (cdecl vs stdcall) and will resolve
           that symbol by linking to the match.  For example, the undefined symbol "_foo" might be linked to the function "_foo@12",

Title: LD (GNU Linker) Options: Build IDs, Package Metadata, and i386 PE Specific Options
Summary
This section covers additional options for the GNU linker (ld). It expands on build IDs, explaining how to disable the feature and discusses the usage of package metadata, focusing on JSON formatting and validation. The section then pivots to i386 PE linker-specific options, including options related to DLL creation, stdcall aliases, base file generation, long section names, and stdcall fixups.