[PATCH 2/4] objdump: don't compare sections by name
Jan Beulich
jbeulich@suse.com
Wed Feb 26 11:58:55 GMT 2025
Multiple sections of the same name may exist (32-bit HPPA for example
looks to be keeping sections separate when combining object files with
ld -r). And really there's no reason to go by section name: We can
simply compare section pointers, as only a match with the section being
disassembled is of interest.
---
Tests put in place by subsequent patches will cover this, on HPPA 32-bit
ELF.
--- a/binutils/objdump.c
+++ b/binutils/objdump.c
@@ -1133,8 +1133,8 @@ compare_symbols (const void *ap, const v
Don't sort symbols from other sections by section, since there
isn't much reason to prefer one section over another otherwise.
See sym_ok comment for why we compare by section name. */
- as = strcmp (compare_section->name, a->section->name) == 0;
- bs = strcmp (compare_section->name, b->section->name) == 0;
+ as = compare_section == a->section;
+ bs = compare_section == b->section;
if (as && !bs)
return -1;
if (!as && bs)
More information about the Binutils
mailing list