Page MenuHomeFreeBSD

stand/reloc_elf: Handle relative relocations for arm{,64} and riscv
ClosedPublic

Authored by scottph on Sep 9 2020, 2:25 AM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Dec 4, 9:34 PM
Unknown Object (File)
Wed, Dec 4, 9:33 PM
Unknown Object (File)
Wed, Dec 4, 9:33 PM
Unknown Object (File)
Wed, Dec 4, 9:10 PM
Unknown Object (File)
Nov 11 2024, 1:41 AM
Unknown Object (File)
Oct 7 2024, 2:21 PM
Unknown Object (File)
Sep 18 2024, 6:35 AM
Unknown Object (File)
Aug 13 2024, 4:53 PM
Subscribers

Details

Summary

Extend the powerpc relative relocation handling from r240782 to a
handful of other architectures. This is needed to properly read
dependency information from kernel modules.

MFC after: 1 week
Sponsored by: Ampere Computing, Inc.

Diff Detail

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

Event Timeline

Thanks !
My investigation of this problem 1 year ago lead me to think it was relocation related but I'm clueless on how that work.
I'll try to test that asap (especially arm where I don't think we had a problem).

In D26365#586260, @manu wrote:

Thanks !
My investigation of this problem 1 year ago lead me to think it was relocation related but I'm clueless on how that work.
I'll try to test that asap (especially arm where I don't think we had a problem).

When reloc returns EOPNOTSUPP, the load_elf code falls back to adding ef->off which gets set here for arm && !efi:

https://svnweb.freebsd.org/base/head/stand/common/load_elf.c?revision=358744&view=markup#l530

So I'd guess that's why arm doesn't have the problem before this change, but I haven't checked it.

stand/common/reloc_elf.c
197 ↗(On Diff #76795)

I suggest to add #else #error clause there, so that to #ifs stay in sync.

I like @kib's suggestion, but otherwise looks good to me.

This revision is now accepted and ready to land.Sep 17 2020, 11:19 PM