From 478c006f9b4a64d59c31aed081c14c1d7dd4ba68 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Mon, 9 Oct 2017 15:05:03 -0700 Subject: [PATCH] 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. --- bfd/ChangeLog | 5 +++++ bfd/elf-m10300.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index c14a3bc491..81d27857fc 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,8 @@ +2017-10-09 H.J. Lu + + * elf-m10300.c (mn10300_elf_check_relocs): Don't free cached + isymbuf. + 2017-10-09 H.J. Lu * elf32-bfin.c (bfin_size_dynamic_sections): Don't create the diff --git a/bfd/elf-m10300.c b/bfd/elf-m10300.c index 9214a5745c..b5951c6005 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; -- 2.34.1