summaryrefslogtreecommitdiff
path: root/ld/pe-dll.c
diff options
context:
space:
mode:
authorChristopher Faylor <me+cygwin@cgf.cx>2006-10-29 17:14:37 +0000
committerChristopher Faylor <me+cygwin@cgf.cx>2006-10-29 17:14:37 +0000
commit148a3648036beb80fa3f916c70558375389dca54 (patch)
treee9cc8d9103c57b494b2ba441fcde6086856f89b3 /ld/pe-dll.c
parentcb29ee2f6a52b0beb25a9650c20fe5075bcc7c4b (diff)
downloadbinutils-redhat-148a3648036beb80fa3f916c70558375389dca54.tar.gz
* pe-dll.c (make_singleton_name_thunk): Re-add the NULL terminator.
Diffstat (limited to 'ld/pe-dll.c')
-rw-r--r--ld/pe-dll.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/ld/pe-dll.c b/ld/pe-dll.c
index a308c94dbb..c264622e69 100644
--- a/ld/pe-dll.c
+++ b/ld/pe-dll.c
@@ -2080,16 +2080,17 @@ make_singleton_name_thunk (const char *import, bfd *parent)
quick_symbol (abfd, U ("_nm_thnk_"), import, "", id4, BSF_GLOBAL, 0);
quick_symbol (abfd, U ("_nm_"), import, "", UNDSEC, BSF_GLOBAL, 0);
- bfd_set_section_size (abfd, id4, PE_IDATA4_SIZE);
- d4 = xmalloc (PE_IDATA4_SIZE);
+ /* We need space for the real thunk and for the null terminator. */
+ bfd_set_section_size (abfd, id4, PE_IDATA4_SIZE * 2);
+ d4 = xmalloc (PE_IDATA4_SIZE * 2);
id4->contents = d4;
- memset (d4, 0, PE_IDATA4_SIZE);
+ memset (d4, 0, PE_IDATA4_SIZE * 2);
quick_reloc (abfd, 0, BFD_RELOC_RVA, 2);
save_relocs (id4);
bfd_set_symtab (abfd, symtab, symptr);
- bfd_set_section_contents (abfd, id4, d4, 0, PE_IDATA4_SIZE);
+ bfd_set_section_contents (abfd, id4, d4, 0, PE_IDATA4_SIZE * 2);
bfd_make_readable (abfd);
return abfd;