Page MenuHomeFreeBSD

libelf: correct mips64 test to use ELF header
ClosedPublic

Authored by emaste on Oct 1 2018, 9:00 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Apr 13, 9:38 PM
Unknown Object (File)
Fri, Apr 12, 2:30 PM
Unknown Object (File)
Fri, Apr 12, 1:49 AM
Unknown Object (File)
Fri, Apr 12, 1:49 AM
Unknown Object (File)
Wed, Apr 10, 2:52 AM
Unknown Object (File)
Jan 17 2024, 8:25 AM
Unknown Object (File)
Dec 22 2023, 10:12 PM
Unknown Object (File)
Dec 11 2023, 11:43 PM
Subscribers

Details

Summary

libelf maintains two views of endianness: e_byteorder, and e_ident[EI_DATA] in the ELF header itself. e_byteorder is not necessarily always in sync, so use the ELF header endianness to test for mips64le.

PR: 231790
See also D15734

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

Use "mips64el" instead of "mips64le" in the commit message. Good sleuthing!

This revision is now accepted and ready to land.Oct 2 2018, 2:29 AM
This revision was automatically updated to reflect the committed changes.

We would also need to check for 64bit-ness prior to using the e_hdr64 field.

We would also need to check for 64bit-ness prior to using the e_hdr64 field.

Note that the original change in D15734 only calls _libelf_is_mips64el in 64-bit cases so in practice it won't be an issue (the test already checked e_ehdr64->e_machine), and I hope we can soon replace it with a general translator as you mentioned earlier. But I could add a safety-belt until that happens.