This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: memory usage with large debug sections


Hi Kevin,

if ((sec->flags & SEC_RELOC) != 0)
{
	size_t ext_size;

	ext_size = elf_section_data (sec)->rel_hdr.sh_size;
	if (ext_size > max_external_reloc_size)
	max_external_reloc_size = ext_size;
	if (sec->reloc_count > max_internal_reloc_count)
	max_internal_reloc_count = sec->reloc_count;
}

Is it really the case that the size of a debug section has
to be used to calculate the malloc size for these relocation
structures?

No, but this size is guaranteed to be safe - there can never be more relocs in a debug section than if the entire section held relocs and nothing else.


If you would like to try to improve this code you could write a function to count the number of relocs in the debug section and then use this figure in the malloc.

Cheers
  Nick



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]