This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] binutils: Improve symbols lookup
On Thu, Dec 12, 2019 at 04:07:35PM +1030, Alan Modra wrote:
> The right way to prefer function and object symbols is to modify
> compare_symbols.
Well, the problem there is, is that the section pointer comparison comes
before we even get to look at the flags and we exit there early:
A: in_suspend, sect: 0x55c40bd0d630
B: __smp_locks_end, sect: 0x55c40bd0d500
a sec > b sec
A: __nosave_begin, sect: 0x55c40bd0d630
B: __smp_locks_end, sect: 0x55c40bd0d500
a sec > b sec
A: __nosave_begin, sect: 0x55c40bd0d630
B: in_suspend, sect: 0x55c40bd0d630
leading to this sort order:
779278: 0xffffffff9b230000 __smp_locks_end
779279: 0xffffffff9b230000 in_suspend
779280: 0xffffffff9b230000 __nosave_begin
because __smp_locks_end is in the section with the smaller address. It
is placed earlier in the binary:
718847: ffffffff9b230000 0 NOTYPE GLOBAL DEFAULT 65 __nosave_begin
779597: ffffffff9b230000 4 OBJECT GLOBAL DEFAULT 65 in_suspend
792880: ffffffff9b230000 0 NOTYPE GLOBAL DEFAULT 63 __smp_locks_end
It is in section 63 while the other two are in 65. Which leads to the
first symbol to be selected in this case.
And my currently proposed solution takes care of the issue by doing a
"second pass" only on the symbols in question, so to speak.
I'm open to suggestions, of course, as I might be missing some aspect of
your compare_symbols() suggestion.
Thx.
--
Regards/Gruss,
Boris.
SUSE Software Solutions Germany GmbH, GF: Felix Imendörffer, HRB 36809, AG Nürnberg