Page MenuHomeFreeBSD

loader: fix endianness conversion
ClosedPublic

Authored by royger on Feb 8 2018, 5:22 PM.
Tags
None
Referenced Files
F106138762: D14267.diff
Thu, Dec 26, 1:08 AM
Unknown Object (File)
Nov 12 2024, 6:46 PM
Unknown Object (File)
Sep 19 2024, 2:54 PM
Unknown Object (File)
Sep 17 2024, 1:34 AM
Unknown Object (File)
Sep 15 2024, 1:29 PM
Unknown Object (File)
Sep 8 2024, 7:29 PM
Unknown Object (File)
Sep 8 2024, 11:03 AM
Unknown Object (File)
Sep 7 2024, 11:08 PM
Subscribers

Details

Summary

r328536 broke symbol loading on amd64 at least (and probably other
arches). r328826 contained the problem to ppc only by adding
pre-processors guards.

Fix this properly by moving the endianness conversion to separate
helper functions, and make the conversion more robust by using sizeof
instead of having to manually code the size of each field.

Finally list the fields in each structure in a macro in order to avoid
code repetition.

Sponsored by: Citrix Systems R&D

Test Plan

Tested on AMD64 only, seems to WFM.

Diff Detail

Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 14874
Build 14986: arc lint + arc unit

Event Timeline

This revision is now accepted and ready to land.Feb 8 2018, 5:39 PM

Existing indentation in this file is a mess, but there are a couple of new cases that don't match either of the two existing styles. I suggest tweaking this change to match the surrounding cases, and then someone (@imp or me, perhaps) should follow up with reformatting the portions that don't conform to style(9).

stand/common/load_elf.c
238

indentation - I think this one should be 2 tabs

510

indentation

587–588

indentation

This works in my QEMU test case and LGTM, modulo indentation nits.

Existing indentation in this file is a mess, but there are a couple of new cases that don't match either of the two existing styles. I suggest tweaking this change to match the surrounding cases, and then someone (@imp or me, perhaps) should follow up with reformatting the portions that don't conform to style(9).

Thanks! I've fixed those, but maybe we should think about re-formatting the whole file to match the coding standards. I think @imp has already done that for other loader related files.

stand/common/load_elf.c
154

I've constified ehdr here and below.

This revision was automatically updated to reflect the committed changes.