tsgates/rust.ko — pull request #5 by ms705 (2014-07-13 16:03:36+00:00)
Title: Fixes for latest Rust master

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.