[patch] Fix PR ld/24574

Eric Botcazou ebotcazou@adacore.com
Thu Sep 5 15:57:00 GMT 2019


Hi,

when I overhauled the auto-import feature of the PE-COFF linker about one year 
ago, I dropped a line in pe_find_data_imports because it was surrounded by a 
slightly scary comment:

-	      /* We replace original name with __imp_ prefixed, this
-		 1) may trash memory 2) leads to duplicate symbol generation.
-		 Still, IMHO it's better than having name polluted.  */
-	      undef->root.string = sym->root.string;

As reported in the PR, the __imp_ prefix is needed in DLLs by GDB to recognize 
that this is an import symbol and not the real one when the symbol is extern, 
so the attached patch simply puts the line back.

Tested on i686-pc-mingw32, OK for mainline, 2.32 and 2.31 branches?


2019-09-05  Eric Botcazou  <ebotcazou@adacore.com>

ld/
	PR ld/24574
	* pe-dll.c (pe_find_data_imports): Replace again the original name of
	the undefined symbol with the __imp_ prefixed one after it is resolved.

-- 
Eric Botcazou
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr24574.diff
Type: text/x-patch
Size: 632 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20190905/f13d06e1/attachment.bin>


More information about the Binutils mailing list