[PATCH 2/2] Speedup part #2

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

The second patch deals with the generation of the import library on the fly.

The implementation is inefficient because the linker makes a lot of calls to
realloc and memmove when importing the symbols in order to maintain a sorted
list of symbols.

This is fixable by relying on the fact that, for every linked DLL, the list of
symbols it exports is already sorted so you can import them en masse once you
have found the insertion point.

2018-03-13  Eric Botcazou  <ebotcazou@adacore.com

	* deffile.h (def_file_add_import_from): Declare.
	(def_file_add_import_at): Likewise.
	* deffilep.y (fill_in_import): New function extracted from...
	(def_file_add_import): ...here.  Call it.
	(def_file_add_import_from): New function.
	(def_file_add_import_at): Likewise.
	* pe-dll.c (pe_implied_import_dll): Use an optimized version of the
	insertion loop for imported symbols if possible.

 ld/deffile.h  |  10 ++++++
 ld/deffilep.y | 100 +++++++++++++++++++++++++++++++++++++++++++++++++++------
 ld/pe-dll.c   |  35 ++++++++++++++++++++
 3 files changed, 133 insertions(+), 12 deletions(-)

Eric Botcazou
-------------- next part --------------
A non-text attachment was scrubbed...
Name: p2.diff
Type: text/x-patch
Size: 6062 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20180313/1385a8b9/attachment.bin>

More information about the Binutils mailing list