Is there a way to store the version information in a Rust compiled executable or library?

While I don't think there is an immediate way to use ELF facilities for versioning (they are not cross-platform anyway), it is possible to use version information from Cargo:

const VERSION: &'static str = env!("CARGO_PKG_VERSION");

VERSION will now be equal to the version specified in the manifest when cargo build is run. Alternatively, you can use env_opt!() if you want to build your program without Cargo:

const VERSION: Option<&'static str> = env_opt!("CARGO_PKG_VERSION");