Home Explore Blog CI



man-pages

41th chunk of `ld.man`
4b42f133b8ff8999930b342508ef934879587fce8d0dab7f0000000100000fc4
 value
           Sets the major number of the "os version".  Defaults to 4.  [This option is specific to the i386 PE targeted port of the linker]

       --major-subsystem-version value
           Sets the major number of the "subsystem version".  Defaults to 4.  [This option is specific to the i386 PE targeted port of the linker]

       --minor-image-version value
           Sets the minor number of the "image version".  Defaults to 0.  [This option is specific to the i386 PE targeted port of the linker]

       --minor-os-version value
           Sets the minor number of the "os version".  Defaults to 0.  [This option is specific to the i386 PE targeted port of the linker]

       --minor-subsystem-version value
           Sets the minor number of the "subsystem version".  Defaults to 0.  [This option is specific to the i386 PE targeted port of the linker]

       --output-def file
           The linker will create the file file which will contain a DEF file corresponding to the DLL the linker is generating.  This DEF file (which should be called "*.def") may be used to create an  import  library  with
           "dlltool" or may be used as a reference to automatically or implicitly exported symbols.  [This option is specific to the i386 PE targeted port of the linker]

       --enable-auto-image-base
       --enable-auto-image-base=value
           Automatically  choose  the  image  base  for DLLs, optionally starting with base value, unless one is specified using the "--image-base" argument.  By using a hash generated from the dllname to create unique image
           bases for each DLL, in‐memory collisions and relocations which can delay program execution are avoided.  [This option is specific to the i386 PE targeted port of the linker]

       --disable-auto-image-base
           Do not automatically generate a unique image base.  If there is no user‐specified image base ("--image-base") then use the platform default.  [This option is specific to the i386 PE targeted port of the linker]

       --dll-search-prefix string
           When linking dynamically to a dll without an import library, search for "<string><basename>.dll" in preference to "lib<basename>.dll". This behaviour allows easy distinction between  DLLs  built  for  the  various
           "subplatforms": native, cygwin, uwin, pw, etc.  For instance, cygwin DLLs typically use "--dll-search-prefix=cyg".  [This option is specific to the i386 PE targeted port of the linker]

       --enable-auto-import
           Do  sophisticated  linking  of  "_symbol"  to  "__imp__symbol" for DATA imports from DLLs, thus making it possible to bypass the dllimport mechanism on the user side and to reference unmangled symbol names.  [This
           option is specific to the i386 PE targeted port of the linker]

           The following remarks pertain to the original implementation of the feature and are obsolete nowadays for Cygwin and MinGW targets.

           Note: Use of the ’auto-import’ extension will cause the text section of the image file to be made writable. This does not conform to the PE‐COFF format specification published by Microsoft.

           Note - use of the ’auto-import’ extension will also cause read only data which would normally be placed into the .rdata section to be placed into the .data section instead.  This is  in  order  to  work  around  a
           problem with consts that is described here: http://www.cygwin.com/ml/cygwin/2004-09/msg01101.html

           Using ’auto-import’ generally will ’just work’ ‐‐ but sometimes you may see this message:

           "variable ’<var>’ can’t be auto‐imported. Please read the documentation for ld’s "--enable-auto-import" for details."

           This  message  occurs  when  some  (sub)expression  accesses an address ultimately given by the sum of two constants (Win32 import tables only allow one).  Instances where this may occur include accesses to member
           fields of struct variables imported

Title: LD (GNU Linker) i386 PE Specific Options: Versioning, DLL Handling, and Auto-Import
Summary
This section continues detailing i386 PE-specific linker options. It covers setting minor version numbers for image, OS, and subsystem, creating DEF files for DLLs, automatically generating image bases for DLLs to avoid collisions, specifying a DLL search prefix, and enabling auto-import for easier linking to DLL data imports, including caveats regarding writable text sections and potential issues with constant expressions in older implementations.