Commit
3097045a18a8 runs into an abort in objalloc_free_block when the
memory being bfd_release'd wasn't bfd_alloc'd. Fix that.
* coffgen.c (_bfd_coff_free_cached_info): Don't release
raw_syments when obj_coff_keep_raw_syms.
* libcoff-in.h (obj_coff_keep_raw_syms): Define.
(struct coff_tdata): Add keep_raw_syms.
* peicode.h (pe_ILF_build_a_bfd): Set obj_coff_keep_raw_syms.
* libcoff.h: Regenerate.
/* Free raw syms, and any other data bfd_alloc'd after raw syms
are read. */
- if (obj_raw_syments (abfd))
- bfd_release (abfd, obj_raw_syments (abfd));
- obj_raw_syments (abfd) = NULL;
- obj_symbols (abfd) = NULL;
- obj_convert (abfd) = NULL;
+ if (!obj_coff_keep_raw_syms (abfd) && obj_raw_syments (abfd))
+ {
+ bfd_release (abfd, obj_raw_syments (abfd));
+ obj_raw_syments (abfd) = NULL;
+ obj_symbols (abfd) = NULL;
+ obj_convert (abfd) = NULL;
+ }
}
return _bfd_generic_bfd_free_cached_info (abfd);
#define obj_relocbase(bfd) (coff_data (bfd)->relocbase)
#define obj_raw_syments(bfd) (coff_data (bfd)->raw_syments)
#define obj_raw_syment_count(bfd) (coff_data (bfd)->raw_syment_count)
+#define obj_coff_keep_raw_syms(bfd) (coff_data (bfd)->keep_raw_syms)
#define obj_convert(bfd) (coff_data (bfd)->conversion_table)
#define obj_conv_table_size(bfd) (coff_data (bfd)->conv_table_size)
#define obj_coff_external_syms(bfd) (coff_data (bfd)->external_syms)
backend flag _bfd_coff_long_section_names. */
bool long_section_names;
+ /* If this is TRUE, raw_syments may not be released. */
+ bool keep_raw_syms;
/* If this is TRUE, the external_syms may not be freed. */
bool keep_syms;
/* If this is TRUE, the strings may not be freed. */
#define obj_relocbase(bfd) (coff_data (bfd)->relocbase)
#define obj_raw_syments(bfd) (coff_data (bfd)->raw_syments)
#define obj_raw_syment_count(bfd) (coff_data (bfd)->raw_syment_count)
+#define obj_coff_keep_raw_syms(bfd) (coff_data (bfd)->keep_raw_syms)
#define obj_convert(bfd) (coff_data (bfd)->conversion_table)
#define obj_conv_table_size(bfd) (coff_data (bfd)->conv_table_size)
#define obj_coff_external_syms(bfd) (coff_data (bfd)->external_syms)
backend flag _bfd_coff_long_section_names. */
bool long_section_names;
+ /* If this is TRUE, raw_syments may not be released. */
+ bool keep_raw_syms;
/* If this is TRUE, the external_syms may not be freed. */
bool keep_syms;
/* If this is TRUE, the strings may not be freed. */
obj_raw_syments (abfd) = vars.native_syms;
obj_raw_syment_count (abfd) = vars.sym_index;
+ obj_coff_keep_raw_syms (abfd) = true;
obj_coff_external_syms (abfd) = (void *) vars.esym_table;
obj_coff_keep_syms (abfd) = true;