-
Notifications
You must be signed in to change notification settings - Fork 13.9k
Description
I have a prototype of a toy Linux kernel module written in Rust. I previously had it working until recently when I rebuilt it with a newer version of Rust and LLVM and insmod module.ko started throwing an error in dmesg logs about unknown rela relocation 9. I did a readelf and realized that all of the extern "C" functions I'd declared were generating ELF entries with the R_X86_64_GOTPCREL relocation entry type which is defined as having a value of 9. This is apparently illegal for kernel modules after looking at the allowable ELF relocation types in the kernel module infrastructure.
I have a few questions:
- Is this change recent?
- If so, was this a change on the Rust side or LLVM side?
- Would you be willing to work with me on either finding a linking-based solution (if possible) or a PR for tuning the resulting relocation type of extern-declared functions?
I am not sure if there's a simple linking flag I'm missing but the ones I've tested, as well as using any of the relocation strategies available through codegen options, yield the same results.