[binutils-gdb] elflink.c: miscellaneous formatting/style fixes
Alan Modra via Binutils-cvs <[email protected]>
| Newsgroups | gmane.comp.gnu.binutils.cvs |
|---|---|
| Message-ID | <[email protected]> |
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=7dbe19b12a5856292e863f654e5cb26874086251 commit 7dbe19b12a5856292e863f654e5cb26874086251 Author: Alan Modra <[email protected]> Date: Thu Aug 6 11:14:54 2026 +0930 elflink.c: miscellaneous formatting/style fixes * elf32-arm.c (elf32_arm_check_relocs): Use dynobj rather than reading the same from htab. Remove unnecessary casts. Formatting. (elf32_arm_late_size_sections): Remove unnecessary cast. * elfnn-aarch64.c (elfNN_aarch64_check_relocs): Likewise. (elfNN_aarch64_late_size_sections): Likewise. * elf32-metag.c (elf_metag_check_relocs): Likewise. * elf64-alpha.c (elf64_alpha_check_relocs): Likewise. * elfnn-loongarch.c (loongarch_elf_check_relocs): Likewise. * elfxx-tilegx.c (tilegx_elf_check_relocs): Likewise. Diff: --- bfd/elf32-arm.c | 13 +++++-------- bfd/elf32-metag.c | 3 +-- bfd/elf64-alpha.c | 3 +-- bfd/elfnn-aarch64.c | 13 ++++++------- bfd/elfnn-loongarch.c | 3 +-- bfd/elfxx-tilegx.c | 4 +--- 6 files changed, 15 insertions(+), 24 deletions(-) diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c index 275cadec050..252029a0ebf 100644 --- a/bfd/elf32-arm.c +++ b/bfd/elf32-arm.c @@ -15429,7 +15429,7 @@ elf32_arm_check_relocs (bfd *abfd, struct bfd_link_info *info, case R_ARM_GOTOFF32: case R_ARM_GOTPC: if (htab->root.sgot == NULL - && !create_got_section (htab->root.dynobj, info)) + && !create_got_section (dynobj, info)) return false; break; @@ -15594,9 +15594,8 @@ elf32_arm_check_relocs (bfd *abfd, struct bfd_link_info *info, /* Create a reloc section in dynobj. */ if (sreloc == NULL) { - sreloc = _bfd_elf_make_dynamic_reloc_section - (sec, dynobj, 2, abfd, ! htab->use_rel); - + sreloc = _bfd_elf_make_dynamic_reloc_section (sec, dynobj, 2, abfd, + !htab->use_rel); if (sreloc == NULL) return false; } @@ -15615,9 +15614,7 @@ elf32_arm_check_relocs (bfd *abfd, struct bfd_link_info *info, p = *head; if (p == NULL || p->sec != sec) { - size_t amt = sizeof *p; - - p = (struct elf_dyn_relocs *) bfd_alloc (htab->root.dynobj, amt); + p = bfd_alloc (dynobj, sizeof (*p)); if (p == NULL) return false; p->next = *head; @@ -17034,7 +17031,7 @@ elf32_arm_late_size_sections (struct bfd_link_info *info) continue; /* Allocate memory for the section contents. */ - s->contents = (unsigned char *) bfd_zalloc (dynobj, s->size); + s->contents = bfd_zalloc (dynobj, s->size); if (s->contents == NULL) return false; s->alloced = 1; diff --git a/bfd/elf32-metag.c b/bfd/elf32-metag.c index da7c5f1756b..f4d765e614f 100644 --- a/bfd/elf32-metag.c +++ b/bfd/elf32-metag.c @@ -2305,8 +2305,7 @@ elf_metag_check_relocs (bfd *abfd, hdh_p = *hdh_head; if (hdh_p == NULL || hdh_p->sec != sec) { - hdh_p = ((struct elf_dyn_relocs *) - bfd_alloc (dynobj, sizeof *hdh_p)); + hdh_p = bfd_alloc (dynobj, sizeof *hdh_p); if (hdh_p == NULL) return false; hdh_p->next = *hdh_head; diff --git a/bfd/elf64-alpha.c b/bfd/elf64-alpha.c index 10175882d88..20374c297f0 100644 --- a/bfd/elf64-alpha.c +++ b/bfd/elf64-alpha.c @@ -1955,8 +1955,7 @@ elf64_alpha_check_relocs (bfd *abfd, struct bfd_link_info *info, if (!rent) { - size_t amt = sizeof (struct alpha_elf_reloc_entry); - rent = (struct alpha_elf_reloc_entry *) bfd_alloc (abfd, amt); + rent = bfd_alloc (abfd, sizeof (*rent)); if (!rent) return false; diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c index 6194d182259..a1119bfbf31 100644 --- a/bfd/elfnn-aarch64.c +++ b/bfd/elfnn-aarch64.c @@ -8163,9 +8163,10 @@ elfNN_aarch64_check_relocs (bfd *abfd, struct bfd_link_info *info, if (htab->root.dynobj == NULL) htab->root.dynobj = abfd; - sreloc = _bfd_elf_make_dynamic_reloc_section - (sec, htab->root.dynobj, LOG_FILE_ALIGN, abfd, /*rela? */ true); - + sreloc = _bfd_elf_make_dynamic_reloc_section (sec, + htab->root.dynobj, + LOG_FILE_ALIGN, + abfd, true); if (sreloc == NULL) return false; } @@ -8203,9 +8204,7 @@ elfNN_aarch64_check_relocs (bfd *abfd, struct bfd_link_info *info, p = *head; if (p == NULL || p->sec != sec) { - size_t amt = sizeof *p; - p = ((struct elf_dyn_relocs *) - bfd_zalloc (htab->root.dynobj, amt)); + p = bfd_zalloc (htab->root.dynobj, sizeof (*p)); if (p == NULL) return false; p->next = *head; @@ -9826,7 +9825,7 @@ elfNN_aarch64_late_size_sections (struct bfd_link_info *info) section's contents are written out. This should not happen, but this way if it does, we get a R_AARCH64_NONE reloc instead of garbage. */ - s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->size); + s->contents = bfd_zalloc (dynobj, s->size); if (s->contents == NULL) return false; s->alloced = 1; diff --git a/bfd/elfnn-loongarch.c b/bfd/elfnn-loongarch.c index a930b4b4d74..a66a9d7bec8 100644 --- a/bfd/elfnn-loongarch.c +++ b/bfd/elfnn-loongarch.c @@ -1552,8 +1552,7 @@ loongarch_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, p = *head; if (p == NULL || p->sec != sec) { - bfd_size_type amt = sizeof *p; - p = (struct elf_dyn_relocs *) bfd_alloc (htab->elf.dynobj, amt); + p = bfd_alloc (htab->elf.dynobj, sizeof (*p)); if (p == NULL) return false; p->next = *head; diff --git a/bfd/elfxx-tilegx.c b/bfd/elfxx-tilegx.c index f0af9f2f2f5..dcdd7cafe0e 100644 --- a/bfd/elfxx-tilegx.c +++ b/bfd/elfxx-tilegx.c @@ -1989,9 +1989,7 @@ tilegx_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, p = *head; if (p == NULL || p->sec != sec) { - size_t amt = sizeof *p; - p = ((struct elf_dyn_relocs *) - bfd_alloc (htab->elf.dynobj, amt)); + p = bfd_alloc (htab->elf.dynobj, sizeof (*p)); if (p == NULL) return false; p->next = *head;