devtools: Fix verneed section parsing in pixie

I misunderstood the ELF specification for version symbols (verneed):
The `vn_aux` pointer is relative to the main verneed record, not the
start of the section.

This caused many symbols to not be versioned properly in the return
value of `elf.dyn_symbols`. This was discovered in #21454.

Fix it by correcting the offset computation.
pull/826/head
W. J. van der Laan 3 years ago
parent 3a2c84a6b5
commit 19e598bab0

@ -217,7 +217,7 @@ def _parse_verneed(section: Section, strings: bytes, eh: ELFHeader) -> Dict[int,
result = {} result = {}
while True: while True:
verneed = Verneed(data, ofs, eh) verneed = Verneed(data, ofs, eh)
aofs = verneed.vn_aux aofs = ofs + verneed.vn_aux
while True: while True:
vernaux = Vernaux(data, aofs, eh, strings) vernaux = Vernaux(data, aofs, eh, strings)
result[vernaux.vna_other] = vernaux.name result[vernaux.vna_other] = vernaux.name

Loading…
Cancel
Save