While reviewing and upstreaming ELF Tool Chain changes from FreeBSD I discovered a number of endianness issues that are not yet addressed upstream.
libelf: fix .note conversion for non-native byte order ELF files
https://reviews.freebsd.org/rS273443
elfcopy: copy raw (untranslated) contents to binary output
https://reviews.freebsd.org/rS327489
elfcopy: fix little-endian MIPS64 objects (Ticket #559)
https://reviews.freebsd.org/D15734
https://reviews.freebsd.org/rS344855
https://reviews.freebsd.org/rS339083
https://reviews.freebsd.org/rS339473
just-committed readelf change [r3766] is not endian-aware
It seems I had this unsubmitted in a forgotten browser tab, from shortly after [r3766] was committed (i.e., just after 2019-06-29). It's possible that there have been changes that affect these issues or introduce new ones since.
Related
Commit: [r3766]
This change would perform arithmetic on the note header's fields while these are still in their file representation. I'm not sure that is correct.
A related issue here is that the libelf test suite is missing test cases for Elf note conversions---I did not get around to writing those. I've filed [#584] to keep track of this pending task.
Related
Tickets: #584
Yes, I pasted the wrong rev; FreeBSD r273443 correctly identified the issue but the commit was incorrect; I reverted it and applied the correct fix in https://reviews.freebsd.org/rS275430
And this first issue is already fixed by [r3158]
Related
Commit: [r3158]
First two are now fixed (2nd by [r3832]). The 3rd group (MIPS) are also related to ticket [#559]. I need to figure out what the right way to handle [r3766] is.
Related
Commit: [r3766]
Commit: [r3832]
Tickets: #559
For the readelf the best approach is probably to teach libelf how to translate the ELF notes used by various operating sytems, @jkoshy do you agree?
@emaste: yes, that seems the best approach.