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>
This commit is contained in:
H.J. Lu
2025-09-01 06:55:00 -07:00
parent aebc33d411
commit 8a94d92a46

View File

@@ -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);