Page MenuHomeFreeBSD

EFI loaders: amd64 uses rela relocations
ClosedPublic

Authored by emaste on Nov 30 2016, 4:23 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Apr 8, 10:45 PM
Unknown Object (File)
Mon, Mar 25, 10:45 PM
Unknown Object (File)
Feb 11 2024, 9:47 PM
Unknown Object (File)
Feb 7 2024, 2:16 PM
Unknown Object (File)
Dec 27 2023, 7:43 PM
Unknown Object (File)
Dec 27 2023, 7:35 PM
Unknown Object (File)
Dec 22 2023, 9:58 PM
Unknown Object (File)
Nov 6 2023, 8:15 AM
Subscribers

Details

Summary

Prior to this change the loader self relocation code interpreted amd64's rela relocations as if they were rel relocations, discarding the addend. This "worked" because GNU ld 2.17.50 stores the addend also at the relocation target, for some reason.

Other linkers, and possibly other versions of GNU ld, don't have this behaviour, so we must interpret relocations correctly.

Reported by: George Rimar

Diff Detail

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

Event Timeline

emaste retitled this revision from to EFI loaders: amd64 uses rela relocations.
emaste updated this object.
emaste edited the test plan for this revision. (Show Details)
emaste added reviewers: andrew, jhb.
emaste added a subscriber: benno.
sys/boot/common/self_reloc.c
108 ↗(On Diff #22620)

Could we keep some of the comment? The code relies on being linked with a base address of 0 (at least on arm64).

Restore comment about link address. It applies to all of the _RELATIVE relocation types.

Also per conversation on IRC we should change this to either handle both relocation section types. Or, at least accept only whichever of DT_REL/DT_RELA is appropriate for the architecture. I intend to make that change soon.

andrew edited edge metadata.

I'm happy, but someone who knows more about arm64 should check those bits.

This revision is now accepted and ready to land.Nov 30 2016, 5:21 PM
emaste edited edge metadata.

Restore accidentally deleted #else

This revision now requires review to proceed.Nov 30 2016, 5:39 PM

I'm happy, but someone who knows more about arm64 should check those bits.

I assume you meant amd64 :) Hopefully @jhb is fine with this change (with the expectation that there's a future improvement as described above).

andrew edited edge metadata.

I'm happy, but someone who knows more about arm64 should check those bits.

I assume you meant amd64 :)

Yes

This revision is now accepted and ready to land.Dec 1 2016, 10:40 AM
This revision was automatically updated to reflect the committed changes.