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)
Jan 5 2024, 4:37 PM
Unknown Object (File)
Dec 22 2023, 10:39 PM
Unknown Object (File)
Oct 27 2023, 12:44 PM
Unknown Object (File)
Sep 3 2023, 3:30 AM
Unknown Object (File)
Jul 13 2023, 12:42 PM
Unknown Object (File)
Apr 1 2023, 9:48 PM
Unknown Object (File)
Apr 1 2023, 9:45 PM
Unknown Object (File)
Mar 29 2023, 8:42 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 Skipped
Unit
Tests Skipped

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

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