When I tried this example on Rust 0.11 and the current nightly master, it failed to build. I had a dig in and fixed everything (I think) -- the resulting kernel module now builds and inserts correctly on my local Ubuntu 14.04 setup with Rust nightly of July 13.
Note that I am no Rust expert -- in fact, this was my first substantial piece of Rust coding, so I'm sure some of the fixes I made are far from optimal/idiomatic.
I also had to change the ELF section targeted by the fixup binary: in my setup, the type of the printk() symbol in the ".rela.text.rust_main" section had to be changed; the old version was looking for symbols in ".rela.text" instead. It is possible that both sections need to be processed in order to always yield correct results.
Hello,
When I tried this example on Rust 0.11 and the current nightly master, it failed to build. I had a dig in and fixed everything (I think) -- the resulting kernel module now builds and inserts correctly on my local Ubuntu 14.04 setup with Rust nightly of July 13.
Note that I am no Rust expert -- in fact, this was my first substantial piece of Rust coding, so I'm sure some of the fixes I made are far from optimal/idiomatic.
I also had to change the ELF section targeted by the fixup binary: in my setup, the type of the printk() symbol in the ".rela.text.rust_main" section had to be changed; the old version was looking for symbols in ".rela.text" instead. It is possible that both sections need to be processed in order to always yield correct results.
Cheers, M.