This is the mail archive of the
binutils-cvs@sourceware.org
mailing list for the binutils project.
[binutils-gdb] mn10300: Don't free cached internal symbol table
- From: H.J.Lu <hjl at sourceware dot org>
- To: bfd-cvs at sourceware dot org
- Date: 9 Oct 2017 22:07:59 -0000
- Subject: [binutils-gdb] mn10300: Don't free cached internal symbol table
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=478c006f9b4a64d59c31aed081c14c1d7dd4ba68
commit 478c006f9b4a64d59c31aed081c14c1d7dd4ba68
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Mon Oct 9 15:05:03 2017 -0700
mn10300: Don't free cached internal symbol table
Since ELF linker may cache internal symbol table in init_reloc_cookie,
we should check if it is cached, before free it.
* elf-m10300.c (mn10300_elf_check_relocs): Don't free cached
isymbuf.
Diff:
---
bfd/ChangeLog | 5 +++++
bfd/elf-m10300.c | 2 +-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index c14a3bc..81d2785 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,10 @@
2017-10-09 H.J. Lu <hongjiu.lu@intel.com>
+ * elf-m10300.c (mn10300_elf_check_relocs): Don't free cached
+ isymbuf.
+
+2017-10-09 H.J. Lu <hongjiu.lu@intel.com>
+
* elf32-bfin.c (bfin_size_dynamic_sections): Don't create the
.interp section with "ld --no-dynamic-linker".
diff --git a/bfd/elf-m10300.c b/bfd/elf-m10300.c
index 9214a57..b5951c6 100644
--- a/bfd/elf-m10300.c
+++ b/bfd/elf-m10300.c
@@ -1377,7 +1377,7 @@ mn10300_elf_check_relocs (bfd *abfd,
result = TRUE;
fail:
- if (isymbuf != NULL)
+ if (isymbuf != NULL && symtab_hdr->contents != (unsigned char *) isymbuf)
free (isymbuf);
return result;