Open
Description
I tried this code while compiling for release:
bin.rs
use elfredo::extended_data;
fn main() {
print!("{}", do_stuff_with_extended_data());
}
lib.rs
#[link_section = ".extended"]
#[used]
#[no_mangle]
pub static extended_data: u8 = 3;
fn do_stuff_with_extended_data() -> &str{
// Uses extended_data
}
I expected to see this happen (compiled with debug):
asaffisher@ubuntu:/mnt/hgfs/elfredo/target/debug$ readelf -S test_echo_patch_elf | grep extend
[18] .extended PROGBITS 000000000003cec8 0003cec8
Instead, this happened(compiled in release):
asaffisher@ubuntu:/mnt/hgfs/elfredo/target/release$ readelf -S test_echo_patch_elf | grep extend
asaffisher@ubuntu:/mnt/hgfs/elfredo/target/release$
Meta
rustc --version --verbose
:
rustc 1.53.0-nightly (42816d61e 2021-04-24)
binary: rustc
commit-hash: 42816d61ead7e46d462df997958ccfd514f8c21c
commit-date: 2021-04-24
host: x86_64-unknown-linux-gnu
release: 1.53.0-nightly
LLVM version: 12.0.0