aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2025-09-01 06:55:00 -0700
committerH.J. Lu <hjl.tools@gmail.com>2025-09-03 05:38:23 -0700
commit8a94d92a468eb34f1a6c263d2e950b9036cfcc72 (patch)
tree2df620ea19cb31d43137e62f82b513238aa76ab0
parentaebc33d411dcbf876c1fa3b8af02361dd39de183 (diff)
downloadbinutils-8a94d92a468eb34f1a6c263d2e950b9036cfcc72.zip
binutils-8a94d92a468eb34f1a6c263d2e950b9036cfcc72.tar.gz
binutils-8a94d92a468eb34f1a6c263d2e950b9036cfcc72.tar.bz2
readelf: Call qsort only if all_relocations_count > 1
Don't call qsort if all_relocations_count < 1. PR binutils/33351 * readelf.c (process_got_section_contents): Call qsort only if all_relocations_count > 1. Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
-rw-r--r--binutils/readelf.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/binutils/readelf.c b/binutils/readelf.c
index 2f8dda8..3205cf2 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -21025,8 +21025,9 @@ process_got_section_contents (Filedata * filedata)
goto out;
}
- qsort (all_relocations_root, all_relocations_count,
- sizeof (elf_relocation), elf_relocation_cmp);
+ if (all_relocations_count > 1)
+ qsort (all_relocations_root, all_relocations_count,
+ sizeof (elf_relocation), elf_relocation_cmp);
initialise_dumps_byname (filedata);