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
Unknown Object (File)
Mar 22 2024, 9:12 PM
Unknown Object (File)
Jan 12 2024, 9:16 AM
Unknown Object (File)
Jan 4 2024, 10:52 AM
Unknown Object (File)
Jan 4 2024, 10:52 AM
Unknown Object (File)
Jan 4 2024, 10:52 AM
Unknown Object (File)
Jan 4 2024, 10:51 AM
Unknown Object (File)
Jan 4 2024, 10:39 AM
Unknown Object (File)
Dec 20 2023, 7:51 AM
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 Not Applicable
Unit
Tests Not Applicable

Event Timeline

sys/riscv/riscv/elf_machdep.c
355

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)

359–360

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
359–360

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.