summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@gcc.gnu.org>2019-09-05 18:23:37 +0200
committerEric Botcazou <ebotcazou@gcc.gnu.org>2019-09-05 18:37:38 +0200
commit34a30b6758db4fe53b2872d7bd3824c778f6118c (patch)
tree0c2f6a38ad198fe9320e82f5918379370af4112b
parent8a1285a1a3048f77abc56be3ff2f83a782506a04 (diff)
downloadbinutils-gdb-34a30b6758db4fe53b2872d7bd3824c778f6118c.tar.gz
Fix PR ld/24574
This restores a line that has been dropped when the auto-import feature of the PE-COFF linker was overhauled about one year. It is necessary for GDB to properly resolve extern symbol in DLLs. ld/ChangeLog * 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.
-rw-r--r--ld/ChangeLog6
-rw-r--r--ld/pe-dll.c5
2 files changed, 11 insertions, 0 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index ce912f0368f..dc5c933e049 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,9 @@
+2019-09-05 Eric Botcazou <ebotcazou@adacore.com>
+
+ 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.
+
2019-05-17 Alan Modra <amodra@gmail.com>
PR 24567
diff --git a/ld/pe-dll.c b/ld/pe-dll.c
index 8cf522b15fe..77ccd50b14c 100644
--- a/ld/pe-dll.c
+++ b/ld/pe-dll.c
@@ -1445,6 +1445,11 @@ pe_find_data_imports (const char *symhead,
undef->u.def.value = sym->u.def.value;
undef->u.def.section = sym->u.def.section;
+ /* We replace the original name with the __imp_ prefixed one, this
+ 1) may trash memory 2) leads to duplicate symbols. But this is
+ better than having a misleading name that can confuse GDB. */
+ undef->root.string = sym->root.string;
+
if (link_info.pei386_auto_import == -1)
{
static bfd_boolean warned = FALSE;