From: H.J. Lu Date: Mon, 1 Sep 2025 13:55:00 +0000 (-0700) Subject: readelf: Call qsort only if all_relocations_count > 1 X-Git-Tag: gdb-17-branchpoint~68 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8a94d92a468eb34f1a6c263d2e950b9036cfcc72;p=thirdparty%2Fbinutils-gdb.git 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 --- diff --git a/binutils/readelf.c b/binutils/readelf.c index 2f8dda88913..3205cf2e69e 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);