aboutsummaryrefslogtreecommitdiff
path: root/bfd/elfxx-sparc.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2025-01-11 16:20:36 +1030
committerAlan Modra <amodra@gmail.com>2025-01-20 07:13:46 +1030
commitcb6326b5ceb7cfc784003c05b90b351d78c755fd (patch)
tree7f9ee6febac9179e3bbea81799c7dc5c99edffdc /bfd/elfxx-sparc.c
parent354ed4d4a26da57cf2a2b9b463c4262b18c48021 (diff)
downloadgdb-cb6326b5ceb7cfc784003c05b90b351d78c755fd.zip
gdb-cb6326b5ceb7cfc784003c05b90b351d78c755fd.tar.gz
gdb-cb6326b5ceb7cfc784003c05b90b351d78c755fd.tar.bz2
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.
Diffstat (limited to 'bfd/elfxx-sparc.c')
-rw-r--r--bfd/elfxx-sparc.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/bfd/elfxx-sparc.c b/bfd/elfxx-sparc.c
index 91ffece..7106162 100644
--- a/bfd/elfxx-sparc.c
+++ b/bfd/elfxx-sparc.c
@@ -2403,6 +2403,7 @@ _bfd_sparc_elf_late_size_sections (bfd *output_bfd,
BFD_ASSERT (s != NULL);
s->size = htab->dynamic_interpreter_size;
s->contents = (unsigned char *) htab->dynamic_interpreter;
+ s->alloced = 1;
htab->interp = s;
}
}
@@ -2579,6 +2580,7 @@ _bfd_sparc_elf_late_size_sections (bfd *output_bfd,
s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->size);
if (s->contents == NULL)
return false;
+ s->alloced = 1;
}
if (elf_hash_table (info)->dynamic_sections_created)