Page MenuHomeFreeBSD

[PowerPC] Fix LLD10 linking of ofw loader on ppc
ClosedPublic

Authored by bdragon on Feb 21 2020, 3:46 AM.
Referenced Files
Unknown Object (File)
Feb 21 2024, 3:13 PM
Unknown Object (File)
Dec 12 2023, 9:54 PM
Unknown Object (File)
Oct 29 2023, 2:02 PM
Unknown Object (File)
Sep 27 2023, 6:13 PM
Unknown Object (File)
Sep 6 2023, 7:59 AM
Unknown Object (File)
Sep 6 2023, 7:53 AM
Unknown Object (File)
Aug 29 2023, 6:45 AM
Unknown Object (File)
Aug 29 2023, 6:43 AM

Details

Summary

LLD and bfd, without this change, will link the ofw loader very differently. LLD creates several PT_LOAD sections with varying permissions, which OF does not grok.

Like we do for the kernel, specify the program headers manually.

Also, to work around a crash in ld.bfd, explicitly assign the section output to the text section. (LLD doesn't care, but our ld.bfd will outright crash.)

This removes the GNU_STACK header as well. This is harmless because we are using a statically-allocated stack, and OpenFirmware does not honor it anyway.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

"LLD and bfd will link the ofw loader very differently." In what way? Please expand on this.

Without this change, lld10 will create a binary with *several* PT_LOAD sections, which ofw does not understand.

With this change, both linkers create an acceptable output.

Looks good.

stand/powerpc/ofw/ldscript.powerpc
18 ↗(On Diff #68624)

This uses the rule that program headers are propagated to SHF_ALLOC sections, so .hash will be added to text as well.

This revision is now accepted and ready to land.Feb 23 2020, 6:43 PM
This revision was automatically updated to reflect the committed changes.