[Toybox] One for Elliott.
Rob Landley
rob at landley.net
Wed May 13 14:00:45 PDT 2020
On 5/13/20 11:10 AM, enh wrote:
> yeah, i actually left a comment in the source about this one.
>
> basically, binutils readelf lies --- it takes two passes over the
> array, counting non-null entries the first time and then only
> admitting to the existence of the non-null entries. at the same time
> (and it's hard to know which way round the causality goes here) some
> versions of some of binutils' linkers would leave a bunch of null
> entries at the end, as you see from this genuine example that _wasn't_
> specifically picked for that purpose.
>
> i resolved in favor of telling the exact truth (on the theory that
> that's kind of why anyone's running readelf in the first place). but i
> can see an argument for doing what the other guy does too, and can
> send you the patch if you'd rather do that. at least we have the code
> comment to explain the otherwise unnecessary first pass over the array
> :-)
I'm happy to go with the simpler implementation, and "binutils' readelf lies to
hide binutils ld's bug" sounds very gnu.
I could run the output through "head -n xx" to make them consistent in the test....
>> -Dynamic section at offset 0xd98 contains 33 entries:
>> +Dynamic section at offset 0xd98 contains 29 entries:
Modulo that.
>> Tag Type Name/Value
>> 0x0000000000000001 (NEEDED) Shared library: [libc.so]
>> 0x0000000000000001 (NEEDED) Shared library: [libm.so]
>> @@ -30,7 +30,3 @@
>> 0x000000006ffffff0 (VERSYM) 0x528
>> 0x000000006ffffff9 (RELACOUNT) 4
>> 0x0000000000000000 (NULL) 0x0
>> - 0x0000000000000000 (NULL) 0x0
>> - 0x0000000000000000 (NULL) 0x0
>> - 0x0000000000000000 (NULL) 0x0
>> - 0x0000000000000000 (NULL) 0x0
Hmmm... maybe it would be better to add a test binary that binutils _doesn't_
lie about? I can "toyonly" this one with a comment about binutils lying to hide
trailing NULL entries...
Anyway, "not accidental or regression, known issue, should have TODO".
Thanks,
Rob
More information about the Toybox
mailing list