sec->alloced and freeing section contents

This modifies _bfd_elf_free_cached_info to unmap/free section
contents.  To do that we need to *not* free sections where contents
are bfd_alloc'd or point to constant strings or somesuch.  I've chosen
to implement this be adding another flag to struct bfd_section,
"alloced" to say the section contents can't be freed.  Most of the
patch is about setting that flag in many places.
This commit is contained in:
Alan Modra
2025-01-11 16:20:36 +10:30
parent 354ed4d4a2
commit cb6326b5ce
60 changed files with 193 additions and 24 deletions

View File

@@ -1857,6 +1857,7 @@ ldelf_before_allocation (char *audit, char *depaudit,
if (default_interpreter_name != NULL)
{
sinterp->contents = (bfd_byte *) default_interpreter_name;
sinterp->alloced = 1;
sinterp->size = strlen ((char *) sinterp->contents) + 1;
}
}