Page MenuHomeFreeBSD

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

Authored by scottph on Wed, Sep 9, 2:25 AM.

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
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

scottph created this revision.Wed, Sep 9, 2:25 AM
scottph requested review of this revision.Wed, Sep 9, 2:25 AM
manu added a comment.Wed, Sep 9, 6:43 AM

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).

emaste added a subscriber: kib.Wed, Sep 9, 5:43 PM
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.

kib added inline comments.Wed, Sep 9, 8:43 PM
stand/common/reloc_elf.c
197 ↗(On Diff #76795)

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

jhb accepted this revision.Thu, Sep 17, 11:19 PM

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

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