[PATCH 0/2] Speed up direct linking with DLLs on Windows

Eric Botcazou ebotcazou@adacore.com
Tue Mar 13 17:53:00 GMT 2018


Hi,

linking with DLLs on Windows normally involves a couple of intermediate steps:
on the executable size, an indirection layer must be added, usually by means
of preprocessor macros based on the dllimport directive for C-based languages;
on the DLL side, an import library must be generated for the DLL.

The GNU linker makes it possible to bypass both steps independently, the 1st
one thanks to the "auto-import" feature (with support from the runtime) and 
the 2nd one by generating the import library on the fly during the link.
But the implementation of both features is quite inefficient for large apps 
linking with many DLLs and this couple of patches is aimed at fixing that.

Tested on i686-pc-mingw32 and x86_64-pc-mingw32.  We have been using this in 
production for the past couple of months on large C/C++/Ada applications for 
both platforms.  The speedup can be up to 15x for very large executables.

Eric Botcazou (2):
  Speedup part #1.
  Speedup part #2.

 ld/deffile.h        |  10 ++
 ld/deffilep.y       | 100 ++++++++++++--
 ld/emultempl/pe.em  | 143 ++------------------
 ld/emultempl/pep.em | 121 ++---------------
 ld/ld.texinfo       |  19 +--
 ld/pe-dll.c         | 374 +++++++++++++++++++++++++++++++++------------------
 ld/pe-dll.h         |   6 +-
 ld/pep-dll.c        |   5 +-
 ld/pep-dll.h        |   7 +-
 9 files changed, 385 insertions(+), 400 deletions(-)

-- 
Eric Botcazou



More information about the Binutils mailing list