Page MenuHomeFreeBSD

riscv: fix relocation handling for R_RISCV_64
ClosedPublic

Authored by mhorne on Oct 18 2022, 6:13 PM.
Tags
None
Referenced Files
F102786312: D37039.diff
Sun, Nov 17, 4:32 AM
Unknown Object (File)
Wed, Oct 30, 8:18 AM
Unknown Object (File)
Mon, Oct 21, 7:36 PM
Unknown Object (File)
Sep 30 2024, 7:12 PM
Unknown Object (File)
Sep 27 2024, 12:51 PM
Unknown Object (File)
Sep 24 2024, 9:56 AM
Unknown Object (File)
Sep 24 2024, 3:54 AM
Unknown Object (File)
Sep 22 2024, 9:56 PM
Subscribers

Details

Summary

It requires the addend. In practice this doesn't seem to be a problem,
since relocations of this type are all with an addend of zero.
Obviously, we still want to handle this correctly if that ever changes.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 47882
Build 44769: arc lint + arc unit

Event Timeline

sys/riscv/riscv/elf_machdep.c
343

Better to keep these just before the store IMO, no need to hoist them and clearer not to (otherwise someone might think lookup clobbers it)

348

This loses the condition that other architectures have... I don't know why it exists but maybe it's a good idea to have?.. (perhaps for if this can be reached a second time after marking pages read-only? I know we do some really disgusting things with IFUNCs...)

377

We should really delete all this crap too, RISC-V kernel modules are shared libraries not relocatable object files so we don't need to handle any of the static relocations (some of which ISTR are pretty buggily implemented here)...

mhorne marked an inline comment as done.

Restore the positioning of the before64 assignment.

mhorne added inline comments.
sys/riscv/riscv/elf_machdep.c
348

IFUNCs might make sense, only it dates back to the initial support for loadable modules on alpha and i386. So I think it was just intended as a micro-optimization.

377

The "constructive" part of this criticism is missing.

You are of course correct that it can be removed. But if you are going to label the work of others as "crap" then please, take enough ownership to actually ask me to do it, or commit to making the change yourself. We both know it is a small effort.

sys/riscv/riscv/elf_machdep.c
377

Yeah sorry I wasn't expecting you to do it, I was just reminded that I've meant to do it for years and should get round to taking the 5 minutes it needs to do it.

This revision is now accepted and ready to land.Oct 20 2022, 1:23 PM
This revision was automatically updated to reflect the committed changes.
mhorne marked an inline comment as done.