Could not insert module: Exec format error
I am very much new to Rust for Linux. My first attempt to build the kernel with rust support, and insert the example rust module failed with the following error.
santosh@x86-vm ~ $ modprobe rust_example.ko
modprobe: FATAL: Module rust_example.ko not found in directory /lib/modules/5.12.0-rc3+ santosh@x86-vm ~ $ modprobe rust_example
modprobe: ERROR: could not insert 'rust_example': Operation not permitted santosh@x86-vm ~ $ sudo modprobe rust_example
modprobe: ERROR: could not insert 'rust_example': Exec format error santosh@x86-vm ~ $ sudo modprobe rust_example_2
modprobe: ERROR: could not insert 'rust_example_2': Exec format error santosh@x86-vm ~ $ sudo modprobe rust_example_3
modprobe: ERROR: could not insert 'rust_example_3': Exec format error santosh@x86-vm ~ $
I followed the 'quick-start.rst' by the letter. What am I doing wrong?
I am building the kernel on a x86 host and running it on a x86 qemu VM.
Thanks,
Santosh
Hi Santosh,
Quoted 2 lines · Santosh Sivaraj
I am building the kernel on a x86 host and running it on a x86 qemu VM.
Is that by chance 32-bit x86?
Cheers,
Miguel
Hi Miguel,
Quoted 7 lines · Miguel Ojeda
Hi Santosh,
Quoted 2 lines · Santosh Sivaraj
I am building the kernel on a x86 host and running it on a x86 qemu VM.
Is that by chance 32-bit x86?
No, it is a 64-bit x86 guest. I also saw this in the dmesg:
[ 43.409639] module: rust_example_3: Unknown rela relocation: 9
Googling took me to https://github.com/rust-lang/rust/issues/57390, and tried to pass -Z plt=y in quiet_cmd_rustc_procmacro, but still the same issue.
Thanks,
Santosh
Quoted 3 lines
Cheers,
Miguel
Quoted 4 lines · Santosh Sivaraj
No, it is a 64-bit x86 guest. I also saw this in the dmesg:
[ 43.409639] module: rust_example_3: Unknown rela relocation: 9
Ah, we saw this with the latest nightlies -- I'll take a look soon. Please give a go to the 2021-02-20, that one should work.
Cheers,
Miguel