aboutsummaryrefslogtreecommitdiff
path: root/bfd/elfxx-sparc.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2024-12-16 15:04:57 +1030
committerAlan Modra <amodra@gmail.com>2024-12-16 19:37:40 +1030
commitf5a8cdea567a2fc2fc00090d3967f81fc6e55499 (patch)
tree379179361c7792857772a2aa89c853d9d0da9282 /bfd/elfxx-sparc.c
parent1c82e1ee93d57a2013c5acf94558c382e3e2e5c3 (diff)
downloadgdb-f5a8cdea567a2fc2fc00090d3967f81fc6e55499.zip
gdb-f5a8cdea567a2fc2fc00090d3967f81fc6e55499.tar.gz
gdb-f5a8cdea567a2fc2fc00090d3967f81fc6e55499.tar.bz2
section tdata tidy
Any _new_section_hook that is not itself called from another _new_section_hook will always see used_by_bfd NULL. Remove those NULL checks in such hooks, and tidy code a little.
Diffstat (limited to 'bfd/elfxx-sparc.c')
-rw-r--r--bfd/elfxx-sparc.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/bfd/elfxx-sparc.c b/bfd/elfxx-sparc.c
index 4ab3ab8..3f642ae 100644
--- a/bfd/elfxx-sparc.c
+++ b/bfd/elfxx-sparc.c
@@ -2660,16 +2660,12 @@ _bfd_sparc_elf_late_size_sections (bfd *output_bfd,
bool
_bfd_sparc_elf_new_section_hook (bfd *abfd, asection *sec)
{
- if (!sec->used_by_bfd)
- {
- struct _bfd_sparc_elf_section_data *sdata;
- size_t amt = sizeof (*sdata);
+ struct _bfd_sparc_elf_section_data *sdata;
- sdata = bfd_zalloc (abfd, amt);
- if (sdata == NULL)
- return false;
- sec->used_by_bfd = sdata;
- }
+ sdata = bfd_zalloc (abfd, sizeof (*sdata));
+ if (sdata == NULL)
+ return false;
+ sec->used_by_bfd = sdata;
return _bfd_elf_new_section_hook (abfd, sec);
}