Page MenuHomeFreeBSD

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

Authored by bdragon on Feb 21 2020, 3:46 AM.
Referenced Files
F111030299: D23778.diff
Wed, Feb 26, 10:55 AM
Unknown Object (File)
Sat, Feb 22, 2:10 AM
Unknown Object (File)
Sat, Feb 8, 1:52 AM
Unknown Object (File)
Jan 23 2025, 9:33 AM
Unknown Object (File)
Jan 17 2025, 4:54 PM
Unknown Object (File)
Dec 9 2024, 2:14 PM
Unknown Object (File)
Nov 11 2024, 6:30 AM
Unknown Object (File)
Sep 23 2024, 7:43 PM

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.