Home Explore Blog CI



man-pages

39th chunk of `ld.man`
33ce949587e83a257505481855c308af3871c8a1b995f1040000000100000fb8
 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", or the undefined symbol "_bar@16" might be linked to the function "_bar".  When the  linker
           does  this,  it  prints  a  warning,  since  it  normally  should  have  failed  to  link,  but  sometimes  import  libraries  generated  from  third‐party  dlls may need this feature to be usable.  If you specify
           --enable-stdcall-fixup, this feature is fully enabled and warnings are not printed.  If you specify --disable-stdcall-fixup, this feature is disabled and such mismatches are considered to be errors.  [This  option
           is specific to the i386 PE targeted port of the linker]

       --leading-underscore
       --no-leading-underscore
           For most targets default symbol‐prefix is an underscore and is defined in target’s description. By this option it is possible to disable/enable the default underscore symbol‐prefix.

       --export-all-symbols
           If  given,  all  global  symbols  in  the  objects  used to build a DLL will be exported by the DLL.  Note that this is the default if there otherwise wouldn’t be any exported symbols.  When symbols are explicitly
           exported via DEF files or implicitly exported via function attributes, the default is to  not  export  anything  else  unless  this  option  is  given.   Note  that  the  symbols  "DllMain@12",  "DllEntryPoint@0",
           "DllMainCRTStartup@12",  and  "impure_ptr"  will  not be automatically exported.  Also, symbols imported from other DLLs will not be re‐exported, nor will symbols specifying the DLL’s internal layout such as those
           beginning with "_head_" or ending with "_iname".  In addition, no symbols from "libgcc", "libstd++", "libmingw32", or "crtX.o" will be exported.  Symbols whose names begin with "__rtti_" or "__builtin_"  will  not
           be  exported,  to help with C++ DLLs.  Finally, there is an extensive list of cygwin‐private symbols that are not exported (obviously, this applies on when building DLLs for cygwin targets).  These cygwin‐excludes
           are: "_cygwin_dll_entry@12", "_cygwin_crt0_common@8", "_cygwin_noncygwin_dll_entry@12", "_fmode", "_impure_ptr", "cygwin_attach_dll", "cygwin_premain0", "cygwin_premain1", "cygwin_premain2", "cygwin_premain3", and
           "environ".  [This option is specific to the i386 PE targeted port of the linker]

       --exclude-symbols symbol,symbol,...
           Specifies a list of symbols which should not be automatically exported.  The symbol names may be delimited by commas or colons.  [This option is specific to the i386 PE targeted port of the linker]

       --exclude-all-symbols
           Specifies no symbols should be automatically exported.  [This option is specific to the i386 PE targeted port of the linker]

       --file-alignment
           Specify the file alignment.  Sections in the file will always begin at file offsets which are multiples of this number.  This defaults to 512.  [This option is specific to the i386 PE targeted port of the

Title: LD (GNU Linker) i386 PE Specific Options: Fixups, Symbol Handling, and File Alignment
Summary
This section describes i386 PE linker-specific options. It details '--enable-stdcall-fixup' and '--disable-stdcall-fixup', which control fuzzy linking for cdecl/stdcall symbol mismatches. The use of '--leading-underscore' and '--no-leading-underscore' to enable or disable default symbol prefixes. It also discusses options for controlling symbol exports in DLLs, including '--export-all-symbols', '--exclude-symbols', and '--exclude-all-symbols'. Finally, it covers '--file-alignment', which determines section alignment within the output file.