I created a new box with cargo new aand typed this in src/lib.rs:
pub fn xor(a: i32, b: i32) -> i32 {
a ^ b
}
pub fn xor_inline(a: i32, b: i32) -> i32 {
a ^ b
}
When I compile with cargo build --release, the generated one .rlibcontains only xor, not xor_inline:
$ gnm -D -C target/release/deps/liba-6a3c2798185fafee.rlib
gnm: __.SYMDEF: File format not recognized
a-6a3c2798185fafee.0.o:
0000000000000000 T a::xor::hf0d97103d53d3286
gnm: rust.metadata.bin: File format not recognized
gnm: a-6a3c2798185fafee.0.bytecode.deflate: File format not recognized
( gnmis GNU nminstalled on MacOS via Homebrew.)
I have two questions:
Why is xor_inlinenot inside the object file? I believe that its source must be present in rust.metadata.binorder to work with a cross-box, but why is a simple function not exported from an object file?
- rustc, cargo rustc --release -- ..., , #[inline] ? (, --crate-type -C?)
( , , .)